Question on the use of Eigen::MatrixXf to form an array

As we know that in c++, the Eigen::MatrixXf can be used to define a Matrix with the dimension of (3*3), but if I want define an array (named a) which is composed by 10 matrices of with the dimension of (3*3), could I define it in this way:
    Eigen::MatrixXf a [10]
If not, How can I define this array?
Furthermore, How can I quote the ith element of this array?
Thanks & best wishes
As we know that in c++, the Eigen::MatrixXf can be used to

No, we do not know. The C++ core language or the C++ Standard Library does not have any "Eigen::MatrixXf". We can guess things though.


Perhaps you could read:
http://www.cplusplus.com/doc/tutorial/arrays/
http://www.cplusplus.com/reference/array/array/
http://www.cplusplus.com/reference/vector/vector/
you can certainly make an array of arrays of arrays etc.

you can use a typedef to do this with arrays, or vectors, or whatever.

it would probably look like

matrixtype x[10];

x[0].matrix[row][col] = 3.14;

or something like that representing an array (x) of matrices.

there seems to be a lot of matrix stuff on here lately. Ill say it again, one-d is your friend when you get to the advanced stuff. Its easier to plug in to clapack, its easier to transpose or resize or reshape or factor or dozens of other operations. Storing them in an array of one-d matrices is still ok, but the actual deep storage works better 1d; here, that would be the 'matrix' type under x.


Last edited on
Presumably you are referring to the Eigen template library, the online documentation for which is here: http://eigen.tuxfamily.org/dox/GettingStarted.html
I recommend you read that documentation as it has examples showing how to do the kinds of things you are asking about.
Topic archived. No new replies allowed.