mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
04a4e22c58
As discussed on mailing list; see http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2010/02/msg00190.html
21 lines
508 B
C++
21 lines
508 B
C++
#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";
|
|
}
|