Registered Member
|
I am confused with the function of HouseholderQr.
1. If I have a matrix M with size m * n (let m > n). I want get the orthogonal columns Q of M just like the Matlab command [Q,R]=qr(M,0). But if I use Q = M.householderQr().matrixQ(), I find that Q has a size m * m not m * n as expected. So how can I obtain the right Q like Matlab. 2. As the help said, matrixQ() returns a Householder sequence but not a matrix. It seems faster if we store a Householder sequence, and use Householder reflection instead of using matrix multiplication. But there is lack of documentation describing how to do this, can any one give an example? Thanks!! |
Moderator
|
I'm sorry but by definition the 'right' Q matrix is a squared unitary matrix. Here is an example showing how to compute the 'thin' Q. This example also shows how to directly use the returned householder sequence for matrix products:
|
Registered Member
|
Thanks!
But can you provide an example on how to compute the product Q*N (N is another matrix) directly using householder reflection? (Because storing Q of size m * m is hard). |
Moderator
|
just do qr.householderQ() * N !!
|
Registered users: Baidu [Spider], Bing [Bot], Google [Bot]