2010-01-12 02:05:30 +08:00
|
|
|
#include <unsupported/Eigen/MatrixFunctions>
|
2010-03-09 03:34:24 +08:00
|
|
|
#include <iostream>
|
2010-01-12 02:05:30 +08:00
|
|
|
|
|
|
|
using namespace Eigen;
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
MatrixXf A = MatrixXf::Random(3,3);
|
|
|
|
std::cout << "A = \n" << A << "\n\n";
|
|
|
|
|
2010-03-17 01:26:55 +08:00
|
|
|
MatrixXf sinhA = A.sinh();
|
2010-01-12 02:05:30 +08:00
|
|
|
std::cout << "sinh(A) = \n" << sinhA << "\n\n";
|
|
|
|
|
2010-03-17 01:26:55 +08:00
|
|
|
MatrixXf coshA = A.cosh();
|
2010-01-12 02:05:30 +08:00
|
|
|
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";
|
|
|
|
}
|