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

[ Thread Index | Date Index | More 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
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);


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+