Registered Member
|
Here is the code.
And the results: 1: 0.333333 0.333333 0.333333 0.333333 0.428571 0.428571 0.428571 0.428571 0.567568 0.567568 0.567568 0.567568 2: 0.333333 0.333333 0.333333 0.333333 0.333333 0.333333 0.333333 0.333333 0.333333 0.333333 0.333333 0.333333 It seems that if we don't eval the summation, it's still an expression. Each time we access the elements of it, the value will be re-calculated. Although this approach results in no-temporary variable, it's inefficient and weird. Is there anyother method to work like the second one without temporary variable? |
Moderator
|
This is an aliasing issue discussed there: http://eigen.tuxfamily.org/dox/group__T ... asing.html
|
Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]