[eigen] Array of Eigen matrices |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] Array of Eigen matrices
- From: Michael Riesch <michael.riesch@xxxxxx>
- Date: Wed, 24 Jul 2019 16:34:32 +0200
- Authentication-results: postout.lrz.de (amavisd-new); dkim=pass (2048-bit key) reason="pass (just generated, assumed good)" header.d=tum.de
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tum.de; h= content-transfer-encoding:content-type:content-type:mime-version :user-agent:date:date:message-id:subject:subject:from:from :received:received; s=postout; t=1563978872; bh=OORQuZhwyvgpbv9W CZ4jEgsmBxU2kHkOyLTVVO2Y/JE=; b=jQ34nNTbR6NKZzn7NzFHvrlT84ehn7eK xb79rKjXWM3g3fNNwQqgLguFoyiW+wj4KRJrFgFZS4BS7lB0MeI0Exv8awcmEdi/ Jil32nKTIHmDqBaaFKraGVbN0zrHXaUYrW3dqxrNsyDxEB9z4p7HpaJvbCgM0Hnm Mfzmm74T2s8WC7DvaTNrz+yq/x5ubG0svdPPEbkOhkmqUqYQK9+V+rO9AHYL5G07 JPLtM0hs44DQ2/T+GQluBJ9wSNLmzu8JCcOLsahx1m47V5AqFppxEiTZIp0a0FQy kpKmZmC7FKutl9HjdY6uDlZGY2L7mNTaZ/EsLhdKZmojbKrlPvsWAQ==
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