COSC-4P80-Assignment-2/lib/eigen-3.4.0/doc/snippets/HouseholderQR_householderQ.cpp

8 lines
300 B
C++
Raw Normal View History

2024-10-21 16:42:03 -04:00
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";