Re: [eigen] [FAQ] how to have an initialized static Matrix

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On 21.03.2013 11:54, Helmut Jarausch wrote:
On 03/21/2013 11:44:14 AM, Christoph Hertzberg wrote:
I found another very hacked solution. It requires that the data layout
of Matrix will not change (especially, no extra fields will be
introduced):

EIGEN_ALIGN16
static const double C3_data[] = {1.0/5, 3.0/10, 4.0/5, 8.0/9, 1.0, 1..0};
static const Vec6d& C3 = reinterpret_cast<const Vec6d&>(*C3_data);

That's the case for my application : matrix and vectors of weights in
higher order Runge-Kutta methods.

What I meant was that Eigen's internal structure must not change (which should be the case for basic data types at least for Eigen 3.x

Still, for a "real" matrix one would have to enter the transposed matrix
if one likes to stay to
column ordering for efficiency.

You can declare all your matrices as row-major, you have an overhead only for operations where you mix column ordering, I don't think col-major is generally superior to row-major.

Christoph

--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/