aboutsummaryrefslogtreecommitdiff
path: root/doc/snippets/Tutorial_solve_triangular.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/snippets/Tutorial_solve_triangular.cpp')
-rw-r--r--doc/snippets/Tutorial_solve_triangular.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/snippets/Tutorial_solve_triangular.cpp b/doc/snippets/Tutorial_solve_triangular.cpp
new file mode 100644
index 000000000..9d13f22ec
--- /dev/null
+++ b/doc/snippets/Tutorial_solve_triangular.cpp
@@ -0,0 +1,8 @@
+Matrix3f A;
+Vector3f b;
+A << 1,2,3, 0,5,6, 0,0,10;
+b << 3, 3, 4;
+cout << "Here is the matrix A:" << endl << A << endl;
+cout << "Here is the vector b:" << endl << b << endl;
+Vector3f x = A.triangularView<Upper>().solve(b);
+cout << "The solution is:" << endl << x << endl;