summaryrefslogtreecommitdiffhomepage
path: root/eigen/doc/snippets/HouseholderQR_householderQ.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'eigen/doc/snippets/HouseholderQR_householderQ.cpp')
-rw-r--r--eigen/doc/snippets/HouseholderQR_householderQ.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/eigen/doc/snippets/HouseholderQR_householderQ.cpp b/eigen/doc/snippets/HouseholderQR_householderQ.cpp
new file mode 100644
index 0000000..e859ce5
--- /dev/null
+++ b/eigen/doc/snippets/HouseholderQR_householderQ.cpp
@@ -0,0 +1,7 @@
+MatrixXf A(MatrixXf::Random(5,3)), thinQ(MatrixXf::Identity(5,3)), Q;
+A.setRandom();
+HouseholderQR<MatrixXf> qr(A);
+Q = qr.householderQ();
+thinQ = qr.householderQ() * thinQ;
+std::cout << "The complete unitary matrix Q is:\n" << Q << "\n\n";
+std::cout << "The thin matrix Q is:\n" << thinQ << "\n\n";