2010-01-12 02:05:30 +08:00
|
|
|
#include <unsupported/Eigen/MatrixFunctions>
|
2010-03-09 03:34:24 +08:00
|
|
|
#include <iostream>
|
2010-01-12 02:05:30 +08:00
|
|
|
|
|
|
|
using namespace Eigen;
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
MatrixXd A = MatrixXd::Random(3,3);
|
|
|
|
std::cout << "A = \n" << A << "\n\n";
|
|
|
|
|
2010-03-17 01:26:55 +08:00
|
|
|
MatrixXd sinA = A.sin();
|
2010-01-12 02:05:30 +08:00
|
|
|
std::cout << "sin(A) = \n" << sinA << "\n\n";
|
|
|
|
|
2010-03-17 01:26:55 +08:00
|
|
|
MatrixXd cosA = A.cos();
|
2010-01-12 02:05:30 +08:00
|
|
|
std::cout << "cos(A) = \n" << cosA << "\n\n";
|
|
|
|
|
|
|
|
// The matrix functions satisfy sin^2(A) + cos^2(A) = I,
|
|
|
|
// like the scalar functions.
|
|
|
|
std::cout << "sin^2(A) + cos^2(A) = \n" << sinA*sinA + cosA*cosA << "\n\n";
|
|
|
|
}
|