Boost logo

Ublas :

Subject: Re: [ublas] Matrix with vector interface.
From: Joaquim Duran (jduran.gm_at_[hidden])
Date: 2012-09-18 04:16:43


Thanks for your suggestion, but I should implement other operations
like size and resize.

Joaquim Duran

2012/9/17 Oswin Krause <Oswin.Krause_at_[hidden]>:
> 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
>> ublas_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/ublas
>> Sent to: Oswin.Krause_at_[hidden]
>
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: jduran.gm_at_[hidden]