You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
508 B

  1. #include <unsupported/Eigen/MatrixFunctions>
  2. #include <iostream>
  3. using namespace Eigen;
  4. int main()
  5. {
  6. MatrixXd A = MatrixXd::Random(3,3);
  7. std::cout << "A = \n" << A << "\n\n";
  8. MatrixXd sinA = A.sin();
  9. std::cout << "sin(A) = \n" << sinA << "\n\n";
  10. MatrixXd cosA = A.cos();
  11. std::cout << "cos(A) = \n" << cosA << "\n\n";
  12. // The matrix functions satisfy sin^2(A) + cos^2(A) = I,
  13. // like the scalar functions.
  14. std::cout << "sin^2(A) + cos^2(A) = \n" << sinA*sinA + cosA*cosA << "\n\n";
  15. }