2009-12-22 02:53:00 +08:00
|
|
|
#include <unsupported/Eigen/MatrixFunctions>
|
2010-03-09 03:34:24 +08:00
|
|
|
#include <iostream>
|
2009-12-22 02:53:00 +08:00
|
|
|
|
|
|
|
using namespace Eigen;
|
|
|
|
|
|
|
|
std::complex<double> expfn(std::complex<double> x, int)
|
|
|
|
{
|
|
|
|
return std::exp(x);
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2010-02-17 00:43:11 +08:00
|
|
|
std::cout << "The matrix A is:\n" << A << "\n\n";
|
|
|
|
std::cout << "The matrix exponential of A is:\n"
|
2010-03-17 01:26:55 +08:00
|
|
|
<< A.matrixFunction(expfn) << "\n\n";
|
2009-12-22 02:53:00 +08:00
|
|
|
}
|