Muresan Mircea Paul Muresan Mircea Paul - 1 year ago 123
C++ Question

Eigen log and exp functions type casting error

I am working with Eigen in order to obtain the exponential and the logarithm of a matrix. I do not understand why the following code gives me a compilation error. The code is:

Eigen::Matrix4d speedT = Eigen::Matrix4d::Identity();
//some other operations with speedT
Eigen::Matrix4d v = speedT.log();

The error is:
Error 17 error C2440: 'type cast' : cannot convert from 'const Eigen::MatrixExponentialReturnValue' to 'Eigen::Matrix4d'

Error 16 error C2027: use of undefined type 'Eigen::MatrixExponentialReturnValue'

For the exponential function (exp) the same issue appears. I have tried different variations of it also make a type cast (Eigen::Matrix4d) speedT.log(); however the result was the same...
The version of eigen is Eigen 3.2.8

Ash Ash
Answer Source

I think this error shows up if you forget to

#include <unsupported/Eigen/MatrixFunctions>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download