Re: [eigen] Blocks and EvalBeforeAssign

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


Hi Michael,

On Sun, May 19, 2013 at 12:12 AM, Michael Tao <mtao@xxxxxxxxxxxxxxx> wrote:
> Hey all,
> Currently assigning sub-blocks of variables to themselves like
> x = x.head(1);
> returns garbage because Block doesn't have EvalBeforeAssigningBit set in
> its Flags.  Is there a particular reason why EvalBeforeAssigningBit
> isn't set in Block?

Yes this is done on purpose to avoid temporaries that would be costly
and useless in 99% of the cases. The only exception is for
matrix-matrix products because 1) aliasing is more frequent, and more
importantly because 2) matrix product of O(N^3) operations for which
an extra temporary is most of the time negligible.

This is documented there:
http://eigen.tuxfamily.org/dox-devel/group__TopicAliasing.html.

gael

> Here's a small full example where it breaks...
> http://pastebin.com/3UYvYWwG
> Though it usually outputs 0, sometimes it'll return something e-317,
> which when casted as a double* is always approximately the value of
> A.data().  Does anyone know why that might be happening?
> Thanks,
> Michael Tao
>
>



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