|
Ublas : |
Subject: Re: [ublas] set of ublas matrix
From: Masanao Yajima (yajiyajijp_at_[hidden])
Date: 2011-08-06 11:12:46
Hi Ralf
That's fantastic!
Thanks for the info.
Cheers
Yajima
On Sat, Aug 6, 2011 at 6:12 AM, Ralf Philipp Denzer <Ralf.Denzer_at_[hidden]>wrote:
> **
> Hello Yajima,
>
> just a remark: you can access the component (k,l) of the i-th matrix A(i)
> directly by, e.g.
>
> A(i)(k,l) = 1.0;
>
> So, it's not necessary to introduce 'local' matrices b and/or c. But it's
> not wrong to do so.
>
> Bye
>
> Ralf
>
>
>
> On 08/04/2011 05:40 PM, Masanao Yajima wrote:
>
> Hi Ralf
>
> That is exactly what I was looking for.
> Your code worked perfectly.
> Thank you so much!
>
> Cheers
>
> Yajima
>
> On Thu, Aug 4, 2011 at 12:33 AM, Ralf Philipp Denzer <Ralf.Denzer_at_[hidden]>wrote:
>
>> Hello Yajima,
>>
>> you can do something like
>>
>> ublas::vector<ublas::matrix<double> > A;
>>
>> I.e.:
>>
>> ublas::vector<dmatrix> A;
>> A.resize(10); // vector containing 10 ublas::matrices
>>
>> for( int i=0;i<10;i++){
>> dmatrix b(10,10);
>> set values to b;
>>
>> // set the correct size of matrix A(i)
>> A(i).resize(b.size1(), b.size2());
>> A(i) =b;
>> }
>>
>> That should work ... (not tested)
>>
>> You can use also:
>> std::vector<ublas::matrix<double> > A;
>> or
>> std::map<int, ublas::matrix<double> > A;
>> or other containers ...
>> Depends what you prefer ...
>>
>> Bye
>>
>> Ralf
>>
>>
>>
>>
>>
>>
>> On 08/04/2011 01:03 AM, Masanao Yajima wrote:
>>
>> Hi List
>>
>> Is there away to create a "set" of ublas matrix.
>> (by set I mean it in the most abstract way)
>>
>> I would like to create bunch of matrix<double> and store it in some form
>> of a data structure
>> then retrieve them by an index and use it as a matrix<double>.
>>
>> Here is a vague pseudo code for what I would like to do
>>
>> something A;
>> for( int i=0;i<10;i++){
>> dmatrix b(10,10);
>> set values to b;
>> A(i) =b;
>> }
>>
>> //then use it as
>>
>> for( int i=0;i<10;i++){
>> dmatrix c = A(i);
>> do calculation with c
>> }
>>
>> Or if you have better way to do something similar, I'd appreciate your
>> input.
>>
>> Thank you for your help.
>>
>> Cheers
>> Yajima
>>
>>
>> _______________________________________________
>> ublas mailing listublas_at_[hidden]http://lists.boost.org/mailman/listinfo.cgi/ublas
>> Sent to: Ralf.Denzer_at_[hidden]
>>
>>
>>
>> _______________________________________________
>> ublas mailing list
>> ublas_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/ublas
>> Sent to: yajiyajijp_at_[hidden]
>>
>
>
>
> --
> Masanao Yajima
>
>
> _______________________________________________
> ublas mailing listublas_at_[hidden]http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: Ralf.Denzer_at_[hidden]
>
>
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: yajiyajijp_at_[hidden]
>
-- Masanao Yajima