From 0c463a21c4a87e9ff3daf7df365082f7df55e3dd Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Tue, 10 May 2011 09:59:58 +0100 Subject: Forgot to 'hg add' example file in last commit. --- unsupported/doc/examples/MatrixSquareRoot.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 unsupported/doc/examples/MatrixSquareRoot.cpp (limited to 'unsupported/doc/examples/MatrixSquareRoot.cpp') diff --git a/unsupported/doc/examples/MatrixSquareRoot.cpp b/unsupported/doc/examples/MatrixSquareRoot.cpp new file mode 100644 index 000000000..88e7557d7 --- /dev/null +++ b/unsupported/doc/examples/MatrixSquareRoot.cpp @@ -0,0 +1,16 @@ +#include +#include + +using namespace Eigen; + +int main() +{ + const double pi = std::acos(-1.0); + + MatrixXd A(2,2); + A << cos(pi/3), -sin(pi/3), + sin(pi/3), cos(pi/3); + std::cout << "The matrix A is:\n" << A << "\n\n"; + std::cout << "The matrix square root of A is:\n" << A.sqrt() << "\n\n"; + std::cout << "The square of the last matrix is:\n" << A.sqrt() * A.sqrt() << "\n"; +} -- cgit v1.2.3