Boost logo

Ublas :

Subject: Re: [ublas] Matrix with vector interface.
From: Joaquim Duran (jduran.gm_at_[hidden])
Date: 2012-09-17 05:11:46

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);

      matrix m;
      std::sort(m.begin(), m.end(), less_module);

Joaquim Duran