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

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


Il 21/03/2013 10:30, Helmut Jarausch ha scritto:
> unfortunately, Eigen's elegant initialization is an expression.
>
> Is there an "elegant" solution for this ugly code (within a function)
>
>
>   static double _C[6] = { 1.0 / 5, 3.0 / 10, 4.0 / 5, 8.0 / 9, 1.0,
> 1.0 };
>   static const Eigen::Map<Eigen::Matrix<double,6,1>,0> C((double*)_C); 

What I currently use is

    EIGEN_ALIGN16 static const double C_data[] = { 1., 2., 3., 4. };
    static const Eigen::Matrix< double, 4, 1 >::ConstAlignedMapType
C(C_data);

I don't remember the pro/con, but it was my final choice when i looked
after it :-)

Thomas

-- 
Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>
http://www.freehackers.org/thomas/




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