This forum has been archived. All content is frozen. Please use KDE Discuss instead.

QR decomposition doesn't return an upper triangular matrix R

Tags: None
(comma "," separated)
zhengda
Registered Member
Posts
1
Karma
0
Hello,

I perform QR decomposition with HouseholderQR.
Eigen::HouseholderQR<Eigen::MatrixXd> qr = tmp.householderQr();
Eigen::MatrixXd Qj = qr.householderQ();
std::cout << Qj << std::endl;
std::cout << qr.matrixQR() << std::endl;
When I print the R matrix, I found R isn't an upper triangular matrix.
I also verified the Q matrix with the result returned by qr() in R, these two Q matrices also differ a little when the matrix gets larger (tried 80 x 80).

Does anyone gets the same problem?
I notice that there are two other versions of QR decomposition in eigen: ColPivHouseholderQR and FullPivHouseholderQR, but it seems they don't do the same thing as HouseholderQR.

Thanks,
Da
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
As stated in the documentation of the matrixQR() method, this method returns an internal representation of the QR factorization, where the upper triangular part correspond to the R factor:

qr.matrixQR().triangular<Upper>()

The rest of the matrix return by matrixQR() stores the Householder reflectors permitting to form the factor Q as returned by the householderQ() method.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]