summaryrefslogtreecommitdiffhomepage
path: root/eigen/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'eigen/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp')
-rw-r--r--eigen/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/eigen/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp b/eigen/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp
new file mode 100644
index 0000000..114c65f
--- /dev/null
+++ b/eigen/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;