diff options
Diffstat (limited to 'doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp')
-rw-r--r-- | doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp b/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp new file mode 100644 index 000000000..114c65fb3 --- /dev/null +++ b/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp @@ -0,0 +1,9 @@ +MatrixXd X = MatrixXd::Random(4,4); +MatrixXd A = X * X.transpose(); +cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl; + +SelfAdjointEigenSolver<MatrixXd> es(A); +cout << "The inverse square root of A is: " << endl; +cout << es.operatorInverseSqrt() << endl; +cout << "We can also compute it with operatorSqrt() and inverse(). That yields: " << endl; +cout << es.operatorSqrt().inverse() << endl; |