aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/doc/examples/MatrixSine.cpp
blob: 2bbf99bbb670394401ad26d83a8f02f89c1e6e1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#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);
  std::cout << "sin(A) = \n" << sinA << "\n\n";

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