Re: [eigen] Discrepancy between 3.1.4 and 3.2.0 behavior on a snippet

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


On 06.09.2013 06:31, Rhys Ulerich wrote:
     typedef Array<double, Dynamic, Dynamic, ColMajor> array_type;
     array_type A = array_type::Random(3, 5);
     const VectorXd& b(A.row(2));

I guess that's the same issue as Bug 654
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=654
Beware however, that (even in 3.1.4) you store a reference to a temporary, which will compile but can lead to undefined behavior (check with valgrind for invalid memory access).

Maybe you want something like this (untested):
    Ref<const VectorXd,0,Stride<> > b=A.row(2);


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/