Registered Member
|
Consider this small program:
And the output:
When I use .adjoint().eval() instead of just .adjoint() the (2,3) in the upper right corner goes away, as I'd expect it to. But shouldn't eigen autodetect that? If not, a warning in the documentation / in the tutorial would be appropriate, IMHO. Cheers, Moritz |
Registered Member
|
You are right that a warning in the documentation is much needed. In fact, we have a transposeInPlace() method but we are lacking adjointInPlace(). I take care of that now, thanks.
There is no reasonable way that Eigen could detect that automatically for you: * first, we don't want to put an eval-before-assign flag on the adjoint expression, because it is very cheap to evaluate so the relative cost of the redundant copy would be high in "a = b.adjoint();" * second, we can't test if a != b to determine whether to evaluate because that test by itself would be a constant overhead, and because it would be impossible to do in a completely reliable way (e.g. what if a is a Map on b's data...) For example, for matrix products "m = m*m;" Eigen always evaluates-before-assign because the product expression is so costly that the potentially useless copy is relatively cheap. Here the difference is that adjoint() is a lightweight expression.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
[quote='bjacob' pid='57251' dateline='1238500669']
You are right that a warning in the documentation is much needed. In fact, we have a transposeInPlace() method but we are lacking adjointInPlace(). I take care of that now, thanks.
Ah, I wondered what kind of magic autodetection it uses to make m = m * m work, but that of course explains it :-) Thanks, Moritz |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell