aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/doc/examples/MatrixSine.cpp
blob: f8780ac92a502b361877a56f46d9218990ab2d67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <unsupported/Eigen/MatrixFunctions>

using namespace Eigen;

int main()
{
  MatrixXd A = MatrixXd::Random(3,3);
  std::cout << "A = \n" << A << "\n\n";

  MatrixXd sinA;
  ei_matrix_sin(A, &sinA);
  std::cout << "sin(A) = \n" << sinA << "\n\n";

  MatrixXd cosA;
  ei_matrix_cos(A, &cosA);
  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";
}