Hi All, It looks like that on the 3.3 branch, matrix exponential (from the unsupported module) no longer works for mapped matrices. Below is an example, modified from the documentation: ===================================================================== #include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace Eigen; int main() { const double pi = std::acos(-1.0); MatrixXd A(3, 3); A << 0, -pi/4, 0, pi/4, 0, 0, 0, 0, 0; std::cout << "The matrix A is:\n" << A << "\n\n"; std::cout << "The matrix exponential of A is:\n" << A.exp() << "\n\n"; // fine Map<MatrixXd> B(A.data(), 3, 3); std::cout << "The matrix B is:\n" << B << "\n\n"; std::cout << "The matrix exponential of B is:\n" << B.exp() << "\n\n"; // fails on Eigen 3.3 return 0; } ===================================================================== This is due to this line: https://bitbucket.org/eigen/eigen/src/0f635ff77c58/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h?at=default&fileviewer=file-view-default#MatrixExponential.h-354, where `MatrixType` is `Map<MatrixXd>` that does not have a default constructor. Best, Yixuan
Fixed: https://bitbucket.org/eigen/eigen/commits/9210b3d60b03/ (devel) https://bitbucket.org/eigen/eigen/commits/c6dc8157ad27/ (3.3)
Thank you Gael.
Hi Gael, I have tried this patch, but it seems that the problem has not been fully resolved. I compiled the example code above under the newest 3.3 branch, and it generated the following errors: ===================================================================== ./unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h:359:40: error: no matching function for call to ‘Eigen::internal::matrix_exp_computeUV<Eigen::Map<Eigen::Matrix<double, -1, -1>, 0, Eigen::Stride<0, 0> >, double>::run(const Eigen::Map<Eigen::Matrix<double, -1, -1>, 0, Eigen::Stride<0, 0> >&, Eigen::MatrixBase<Eigen::Map<Eigen::Matrix<double, -1, -1>, 0, Eigen::Stride<0, 0> > >::PlainObject&, Eigen::MatrixBase<Eigen::Map<Eigen::Matrix<double, -1, -1>, 0, Eigen::Stride<0, 0> > >::PlainObject&, int&)’ matrix_exp_computeUV<MatrixType>::run(arg, U, V, squarings); // Pade approximant is (U+V) / (-U+V) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ ./unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h:232:15: note: candidate: template<class ArgType> static void Eigen::internal::matrix_exp_computeUV<MatrixType, double>::run(const ArgType&, MatrixType&, MatrixType&, int&) [with ArgType = ArgType; MatrixType = Eigen::Map<Eigen::Matrix<double, -1, -1>, 0, Eigen::Stride<0, 0> >] static void run(const ArgType& arg, MatrixType& U, MatrixType& V, int& squarings) ^~~ ./unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h:232:15: note: template argument deduction/substitution failed: ./unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h:359:40: note: cannot convert ‘U’ (type ‘Eigen::MatrixBase<Eigen::Map<Eigen::Matrix<double, -1, -1>, 0, Eigen::Stride<0, 0> > >::PlainObject {aka Eigen::Matrix<double, -1, -1>}’) to type ‘Eigen::Map<Eigen::Matrix<double, -1, -1>, 0, Eigen::Stride<0, 0> >&’ matrix_exp_computeUV<MatrixType>::run(arg, U, V, squarings); // Pade approximant is (U+V) / (-U+V) ===================================================================== Thanks! Best, Yixuan
Right, here is a more complete fix: https://bitbucket.org/eigen/eigen/commits/cf029096b7b7/ (devel) https://bitbucket.org/eigen/eigen/commits/a19f8531ea35/ (3.3)
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1380.