summaryrefslogtreecommitdiffhomepage
path: root/eigen/doc/snippets/LeastSquaresQR.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'eigen/doc/snippets/LeastSquaresQR.cpp')
-rw-r--r--eigen/doc/snippets/LeastSquaresQR.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/eigen/doc/snippets/LeastSquaresQR.cpp b/eigen/doc/snippets/LeastSquaresQR.cpp
new file mode 100644
index 0000000..6c97045
--- /dev/null
+++ b/eigen/doc/snippets/LeastSquaresQR.cpp
@@ -0,0 +1,4 @@
+MatrixXf A = MatrixXf::Random(3, 2);
+VectorXf b = VectorXf::Random(3);
+cout << "The solution using the QR decomposition is:\n"
+ << A.colPivHouseholderQr().solve(b) << endl;