mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
04a4e22c58
As discussed on mailing list; see http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2010/02/msg00190.html
21 lines
524 B
C++
21 lines
524 B
C++
#include <unsupported/Eigen/MatrixFunctions>
|
|
#include <iostream>
|
|
|
|
using namespace Eigen;
|
|
|
|
int main()
|
|
{
|
|
MatrixXf A = MatrixXf::Random(3,3);
|
|
std::cout << "A = \n" << A << "\n\n";
|
|
|
|
MatrixXf sinhA = A.sinh();
|
|
std::cout << "sinh(A) = \n" << sinhA << "\n\n";
|
|
|
|
MatrixXf coshA = A.cosh();
|
|
std::cout << "cosh(A) = \n" << coshA << "\n\n";
|
|
|
|
// The matrix functions satisfy cosh^2(A) - sinh^2(A) = I,
|
|
// like the scalar functions.
|
|
std::cout << "cosh^2(A) - sinh^2(A) = \n" << coshA*coshA - sinhA*sinhA << "\n\n";
|
|
}
|