aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/MatrixBase_marked.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/snippets/MatrixBase_marked.cpp')
-rw-r--r--doc/snippets/MatrixBase_marked.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/snippets/MatrixBase_marked.cpp b/doc/snippets/MatrixBase_marked.cpp
new file mode 100644
index 000000000..5c08cd9ca
--- /dev/null
+++ b/doc/snippets/MatrixBase_marked.cpp
@@ -0,0 +1,9 @@
+Matrix3d m = Matrix3d::zero();
+m.part<Eigen::Upper>().setOnes();
+cout << "Here is the matrix m:" << endl << m << endl;
+Matrix3d n = Matrix3d::ones();
+n.part<Eigen::Lower>() *= 2;
+cout << "Here is the matrix n:" << endl << n << endl;
+cout << "And now here is m.inverse()*n, taking advantage of the fact that"
+ " m is upper-triangular:" << endl
+ << m.marked<Eigen::Upper>().inverseProduct(n);