Re: Matrix with vector interface.
"Oswin Krause" <[email protected]>
| Newsgroups | gmane.comp.lib.boost.ublas |
|---|---|
| Message-ID | <[email protected]> |
The easisest way, which dos not require a poxy would be to use
boost.range and implement a suitable
begin(m) and end(m) along with the required iterator and typedefs.
than your example would look like:
main()
{
matrix m;
std::sort(begin(m), end(m), less_module);
}
On 2012-09-17 11:11, Joaquim Duran wrote:
> Sorry to send the example unfinished. Here it is completed.
>
> Example: Sort the columns of a matrix based on their module:
>
> using namespace boost::numeric::ublas;
>
> template <typedef Vector>
> bool less_module(const Vector& v1, const Vector& v2)
> {
> return norm_2(v1) < norm_2(v2);
> }
>
> main()
> {
> matrix m;
> column_facade(m);
> std::sort(m.begin(), m.end(), less_module);
> }
>
> Joaquim Duran
> _______________________________________________
> ublas mailing list
> [email protected]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: [email protected]
_______________________________________________
ublas mailing list
[email protected]
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: [email protected]