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

using namespace Eigen;

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

  MatrixXd sinA = A.sin();
  std::cout << "sin(A) = \n" << sinA << "\n\n";

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