Keyword auto with Eigen library

Jun 25, 2018 min read

Today I encountered a weird problem when using Eigen library with keyword auto. The scenario is as follows:

Eigen::Affine3d aff;
// aff is assigned with a valid value ...

auto r = aff.rotation();
auto res = r * r;

In the end, the result variable res contains a 3x3 matrix with only zero values, no matter what values aff has. After a bit of googling, I found out some relevant issues and Eigen documentation:

I still have not quite understand this issue. As a temporary solution, using auto with Eigen library should be avoided as much as possible.

I will post another article once I understand it fully.

comments powered by Disqus