aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/SelfAdjointEigenSolver_operatorSqrt.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_operatorSqrt.cpp
parent6ea6276f20cee16e86e35d60e8ce81cc48a46cb3 (diff)
Document SelfAdjointEigenSolver and add examples.
Diffstat (limited to 'doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp')
-rw-r--r--doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp b/doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp
new file mode 100644
index 000000000..eeacca74b
--- /dev/null
+++ b/doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp
@@ -0,0 +1,8 @@
+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);
+MatrixXd sqrtA = es.operatorSqrt();
+cout << "The square root of A is: " << endl << sqrtA << endl;
+cout << "If we square this, we get: " << endl << sqrtA*sqrtA << endl;