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 list ublas@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/ublas Sent to: Ralf.Denzer@web.de