Re: Matrix with vector interface.
Joaquim Duran <[email protected]>
| Newsgroups | gmane.comp.lib.boost.ublas |
|---|---|
| Message-ID | <CANdawSF2VJ2fVsqHEriDC4Kd5WFqdZ3=NRUWEwfP2arAqC=GSg@mail.gmail.com> |
Thanks for your suggestion, but I should implement other operations like size and resize. Joaquim Duran 2012/9/17 Oswin Krause <[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] _______________________________________________ ublas mailing list [email protected] http://lists.boost.org/mailman/listinfo.cgi/ublas Sent to: [email protected]