Registered Member
|
To do economy QR of a matrix Y I'm currently using
to get economy QR, but this is quite slow for large matrices. Would HouseholderQR be suitable? As an aside, why can't I subset a matrix and reassign to itself, like
this gives me segfaults and valgrind complains about it too. Thanks. Edit: also, is there a better way of computing economy QR for large matrices? I've got matrices of 100K by 20, and 100K x 100K takes too much RAM. |
Moderator
|
internally, both HouseholderQR and the column pivoting variant does "economy QR" since the orthogonal factor Q is stored as householder reflectors. What is missing though is an easy way to evaluate the Householder sequence returned by householderQ() or matrixQ() which is an alias to a thin dense matrix. Currently, the best is:
MatrixXd thinQ = MatrixXd::Identity(Y.rows()m Y.cols()); thinQ = qr.householderQ() * thinQ; Regarding your second question: Q = Q.leftCols(Y.cols()); is not valid because of "aliasing" issue. Q is first resized and reallocated, and then the copy takes place, but that's too late ! You can use Q.conservativeResize(NoChange,Y.cols()); |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]