Re: [eigen] Blocks and EvalBeforeAssign |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: [eigen] Blocks and EvalBeforeAssign
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Tue, 21 May 2013 10:10:39 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=IWID13U2CxgZXyVAocwCxjpi8WvnsvA7EJtb747ymVE=; b=zlaBiXOwQFLTO1UpEap2W7WdtrbZhPxFW41LALlD1xA4BJKdRLLSMkadrDaP/xnsBL sbliUgs8/gEXqiIbF7C66MngS67exncEoXgtGDwKbEJ5sXS9NLptBJJ8NKK/fnVQoVHA R53sRq8URBk4wJ0H903kC8CW7WuPnoVzNvaAwX2y7tfN8UNpsT4ercxUGDP52wEGj0UC szgP4mKRmLRKNgUUaGbOOF6WDWmq2n4PjWqnIOsmiX7s8Yxl3i1+JqBM9lOe5h1Zc4Bp LEsDNkUSh2KslE0zeez33OrTh3FVrbMlqu2w/gPSFkdO9ne0BF05ZOS2tr5IjnRRFumm Y4bQ==
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
>
>