Boost logo

Ublas :

Subject: Re: [ublas] noaliasing assignment
From: Matwey V. Kornilov (matwey.kornilov_at_[hidden])
Date: 2011-11-09 11:28:27


Thanks. The documentation is just not clear.

But there is a class of transformations that can be performed element-wise
independently. I.e. Let u and w are vectors.

w = u - w * 2;

As far as I understand it creates temp object for right-hand side. Can I use
noalias(w) here? Are there guarantees that result will be right and
determined?

Oswin Krause wrote:

> Hi,
>
> yes, you have to specify it every time when the result is not on the right
> of the expression
>
> e.g
>
> noalias(A)=prod(B,C)+D;
>
> but:
>
> A=prod(B,A)+D
>
> This is needed, because ublas wants to be fail-safe in case 2. if noalias
> would be the default, the second expression would result in wrong results.