aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/Tutorial_solve_singular.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/snippets/Tutorial_solve_singular.cpp')
-rw-r--r--doc/snippets/Tutorial_solve_singular.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/snippets/Tutorial_solve_singular.cpp b/doc/snippets/Tutorial_solve_singular.cpp
new file mode 100644
index 000000000..da94ad445
--- /dev/null
+++ b/doc/snippets/Tutorial_solve_singular.cpp
@@ -0,0 +1,9 @@
+Matrix3f A;
+Vector3f b;
+A << 1,2,3, 4,5,6, 7,8,9;
+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.partialLu().solve(b, &x);
+cout << "The solution is:" << endl << x << endl;