Re: [eigen] Unexpected behavior with rowwise().reverse()

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


On 22.11.2013 17:52, Rob Conde wrote:
Results:
1 2 3 4 5
5 4 3 4 5
5 4 3 2 1

Isn't eigen supposed to detect these scenarios and call eval if necessary?

It is very hard to detect all possible aliasing issues. If we introduced a detection for this case, we would rather assert than calling eval -- at least we already do so for A = A.transpose();

There is a blah.reverseInPlace(); however this seems to be missing for rowwise() and colwise().
As a workaround until we implement that, something like this should work:
  int width = blah.cols()/2;
  blah.leftCols(3).swap(blah.rightCols(3).rowwise().reverse());

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/