eigen/unsupported/doc/examples/MatrixPower.cpp

17 lines
390 B
C++
Raw Normal View History

2012-08-19 18:12:04 +08:00
#include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main() {
2012-08-19 18:12:04 +08:00
const double pi = std::acos(-1.0);
Matrix3d A;
A << cos(1), -sin(1), 0, sin(1), cos(1), 0, 0, 0, 1;
std::cout << "The matrix A is:\n"
<< A
<< "\n\n"
"The matrix power A^(pi/4) is:\n"
<< A.pow(pi / 4) << std::endl;
2012-08-19 18:12:04 +08:00
return 0;
}