Re: [eigen] Blocks and EvalBeforeAssign

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


On 19.05.2013 00:12, Michael Tao wrote:
Currently assigning sub-blocks of variables to themselves like
x = x.head(1);

If you want the head of a vector or a top-left corner of your matrix, you can use conservativeResize():
http://eigen.tuxfamily.org/dox-devel/classEigen_1_1PlainObjectBase.html#a4ac24a195e3e35ce2d8946cee5873e51

its Flags.  Is there a particular reason why EvalBeforeAssigningBit
isn't set in Block?

Block methods are usually not intended to assign any kind of overlapping sub matrices of the same matrix. Maybe a warning for that should be put into the docu somewhere.

A.data().  Does anyone know why that might be happening?

I think first a new data area is allocated and the old one is deallocated. Then during the assignment, the data pointer of the block is already the new one, so the actual assignment is essentially a NOP. I guess it's not guaranteed that it happens exactly that way, because the compiler might be allowed to do certain optimizations which might cause your program to accidentally work in rare cases.


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/