这是特征矩阵log()实现中的错误吗?

时间:2018-10-16 09:08:04

标签: eigen logarithm

这个简单的测试程序...

#include <iostream>
#include <Eigen/Dense>
#include <unsupported/Eigen/MatrixFunctions>

using namespace Eigen;

int main()
{
  Matrix<double,1,1> m11;
  Matrix<double,2,2> m22;
  Matrix<double,3,3> m33;
  Matrix<double,4,4> m44;
  m22.setZero();
  m33.setZero();
  m44.setZero();
  std::cout << "Eigen version: " << EIGEN_WORLD_VERSION << "."
            << EIGEN_MAJOR_VERSION << "." << EIGEN_MINOR_VERSION << "\n";
  std::cout << "11: " << m11.log() << "\n";
  std::cout << "22: " << m22.log() << "\n";
  std::cout << "33: " << m33.log() << "\n";
  std::cout << "44: " << m44.log() << "\n";
}

显然在计算m33.log()时挂起,给出输出:

Eigen version: 3.3.5
11: -728.932
22: -nan -nan
-nan -nan
[hangs here at 100% cpu]

使用

g++ --version
g++ (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6)

以及

clang++ --version
clang version 5.0.2 (tags/RELEASE_502/final)

所以我知道它是无效的,但是也许失败比挂起更好,还是我真的总是需要在调用log()之前检查isInvertible()和&所有本征值吗?

0 个答案:

没有答案