Registered Member
|
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 |
Moderator
|
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. |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]