aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp
diff options
context:
space:
mode:
authorGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2010-05-04 17:11:32 +0100
committerGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2010-05-04 17:11:32 +0100
commit2d74f1ac9292dab56cf725ba9c09e22a77f5fb10 (patch)
tree0f7970e50e9c4bad1ef70c27e84b9457fed6277c /doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp
parent6ea6276f20cee16e86e35d60e8ce81cc48a46cb3 (diff)
Document SelfAdjointEigenSolver and add examples.
Diffstat (limited to 'doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp')
-rw-r--r--doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp9
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;