Re: [eigen] Array of Eigen matrices |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
Hello all,
In my simulation tool I have a 1D grid and for each grid point there is
an equally sized and quadratic matrix. For each matrix a certain update
operation is subsequently carried out. Currently, the matrix size is
known at compile time, i.e., something like
typedef Eigen::Matrix<double, N, N> my_matrix_t;
Using this type, I allocate the memory using
my_matrix_t *matrices = new my_matrix_t[num_gridpoints];
Now I would like to address matrices whose sizes are only known at run
time, i.e.,
typedef Eigen::Matrix<double, Dynamic, Dynamic> my_matrix_t;
(but still quadratic). The allocation procedure remains the same and the
code seems to work. However, I assume that the array "matrices" contains
only the pointers to the each individual matrix storage and the overall
performance will degrade as the memory has to be collected from random
places before the operation on each matrix can be carried out.
Does anyone have experience with such a use case? Is having a contiguous
memory region actually beneficial or does it not make any difference?
Can I allocate memory for the complete array of matrices so that I have
a contiguous memory region and, if yes, how?
Thanks in advance for your comments!
Best regards,
Michael
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |