Reply to topic

Getting Q and R out of HouseHolderQR (eigen 3.0.4)

BenBenBen
Registered Member
Posts
2
Karma
0
Hello,

First of all, thank you for the amazing work you've done with eigen. This library is a pleasure to use, with a great API.
However, I'm a bit confused by the documentation of HouseHolderQR, and haven't found a solution in this forum.

I'm looking to get the Q and R matrix of a QR decomposition of a matrix using HouseHolderQR. The documentation indicates that the method matrixQR() yields "a reference to the matrix where the Householder QR decomposition is stored in a LAPACK-compatible way."

What is the easiest way to get Q and R ? Is there a way to get these matrices using eigen, or do I have to look at the way lapack stores this matrix and retrieve it "by hand" ? If this is the case, should this function be added to the existing implementation ? It would prevent errors related to row-wise vs column-wise storage, etc...
I do need Q and R because I'm dealing with an algorithm that uses these matrices as a basis for other things, so my goal is not simply to solve a linear system.

Thank you for the help, and congratulation for your work ! I'm really looking forward eigen 3.1 with MKL integration.

Benoit
BenBenBen
Registered Member
Posts
2
Karma
0
I am replying to myself, because the answer might be of some use for other people.

By looking at the implementation of HouseHolderQR, there is a member function householderQ() that does not have any comments even though it is public. I believe this is the reason why it doesn't appear in the documentation http://eigen.tuxfamily.org/dox/classEigen_1_1HouseholderQR.html.

So, to get the Q Matrix, one just has to convert m.householderQ() into a MatrixXd for instance, and then the R matrix is the upper triangular matrix of matrixQR().

Should these indications be added to the documentation ? Shouldn't householderQ() be documented ?
jitseniesen
Registered Member
Posts
186
Karma
2
Yes, to both question. It seems that the documentation of the HouseHolderQR class can be greatly improved. A patch would be very welcome.

 
Reply to topic

Bookmarks



Who is online

Registered users: apater, Baidu [Spider], bcooksley, Bing [Bot], Exabot [Bot], Google [Bot], Majestic-12 [Bot], mmistretta, MSNbot Media, onesandzeros, shmerl, Uri_Herrera, Yahoo [Bot]