Skip to content

Bug fix - aliasing errors

Compare
Choose a tag to compare
@allanleal allanleal released this 18 Jun 08:03
31b0020

This is an important bug fix that corrects aliasing. As reported in #32 , operations such as:

dual a = 1;
a = a - 2*a;

did not work as expected, because a is used on the right-hand side expression. As this expression is evaluated, a changes and so does the other occurrences of a in the expression.

To prevent this, the default behavior needs to be such that the result of the expression is stored in a temporary, and then the self dual object is assigned to this temporary.

In a future release, something similar to Eigen .noalias() method could be envisioned if the user is sure there is no alias on the right-hand side expression.