Re: Matrix with vector interface.

Joaquim Duran <[email protected]>
Newsgroups gmane.comp.lib.boost.ublas
Message-ID <CANdawSEU=83v7UVA-0nMye84RvWMKdzOGBmcFVodZ-mkWoeYNA@mail.gmail.com>
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]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.