port the QR module to PermutationMatrix

This commit is contained in:
Benoit Jacob
2009-11-17 08:14:54 -05:00
parent 30b610a10f
commit 9f21e2aab7
4 changed files with 17 additions and 23 deletions

View File

@@ -51,11 +51,8 @@ template<typename MatrixType> void qr()
// FIXME need better way to construct trapezoid
for(int i = 0; i < rows; i++) for(int j = 0; j < cols; j++) if(i>j) r(i,j) = Scalar(0);
MatrixType b = qr.matrixQ() * r;
MatrixType c = qr.matrixQ() * r * qr.colsPermutation().inverse();
MatrixType c = MatrixType::Zero(rows,cols);
for(int i = 0; i < cols; ++i) c.col(qr.colsPermutation().coeff(i)) = b.col(i);
VERIFY_IS_APPROX(m1, c);
MatrixType m2 = MatrixType::Random(cols,cols2);