Boost logo

Ublas :

Subject: Re: [ublas] set of ublas matrix
From: Masanao Yajima (yajiyajijp_at_[hidden])
Date: 2011-08-04 11:40:51


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