Bugzilla – Bug 1310
.hnormalized() of .triangularView<> product issues a compilation error
Last modified: 2016-09-30 20:51:10 UTC
Created attachment 738 [details]
VC14 log output
I have the following code which does not compile Eigen 3.3-rc1 (it does with Eigen 3.2.9 though):
(K.triangularView<Eigen::Upper>() * u.homogeneous()).hnormalized();
I've attached the compiler output. The code was compiled using the following command-line:
cl /W4 /EHsc test.cpp
For me it does not compile with 3.2. I get a static assertion:
You are right. I missed an .eval() in front of .hnormalized() (i.e. after the product).
(K.triangularView<Eigen::Upper>() * u.homogeneous()).eval().hnormalized();
However, it would be nice if such expressions could be evaluated without an explicit .eval() call.
Alright, so in 3.2, what happened is that in this case u.homogeneous() gets evaluated into a Vector3d before the product takes place:
K.triangularView<Eigen::Upper>() * (u.homogeneous()).eval()
In 3.2, this was done implicitly, so the easy "fix" would be to do the same explicitly in 3.3 before we add a special optimized path.
Since this compiled in 3.2, here is a quick workaround for 3.3: