MatrixLogarithm.cpp 375 B

123456789101112131415
  1. #include <unsupported/Eigen/MatrixFunctions>
  2. #include <iostream>
  3. using namespace Eigen;
  4. int main()
  5. {
  6. using std::sqrt;
  7. MatrixXd A(3,3);
  8. A << 0.5*sqrt(2), -0.5*sqrt(2), 0,
  9. 0.5*sqrt(2), 0.5*sqrt(2), 0,
  10. 0, 0, 1;
  11. std::cout << "The matrix A is:\n" << A << "\n\n";
  12. std::cout << "The matrix logarithm of A is:\n" << A.log() << "\n";
  13. }