aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/LeastSquaresQR.cpp
diff options
context:
space:
mode:
authorGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2014-01-18 01:16:17 +0000
committerGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2014-01-18 01:16:17 +0000
commitaa0db35185f7eda94eb103b6bb92630c432512e5 (patch)
tree65896c945099ddba0d913646c57000e153e20e28 /doc/snippets/LeastSquaresQR.cpp
parenta58325ac2f7be7326be358ac51c4f0eebcf7fbf9 (diff)
Add doc page on computing Least Squares.
Diffstat (limited to 'doc/snippets/LeastSquaresQR.cpp')
-rw-r--r--doc/snippets/LeastSquaresQR.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/snippets/LeastSquaresQR.cpp b/doc/snippets/LeastSquaresQR.cpp
new file mode 100644
index 000000000..6c9704547
--- /dev/null
+++ b/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;