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
524 B

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