diff --git a/test/qr.cpp b/test/qr.cpp index 036a3c9f2..864828750 100644 --- a/test/qr.cpp +++ b/test/qr.cpp @@ -31,12 +31,16 @@ template void qr(const MatrixType& m) int cols = m.cols(); typedef typename MatrixType::Scalar Scalar; - typedef Matrix SquareMatrixType; + typedef Matrix MatrixQType; typedef Matrix VectorType; MatrixType a = MatrixType::Random(rows,cols); HouseholderQR qrOfA(a); MatrixType r = qrOfA.matrixQR(); + + MatrixQType q = qrOfA.matrixQ(); + VERIFY_IS_UNITARY(q); + // 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); diff --git a/test/qr_colpivoting.cpp b/test/qr_colpivoting.cpp index 4b6f7dd6b..5c5c5d259 100644 --- a/test/qr_colpivoting.cpp +++ b/test/qr_colpivoting.cpp @@ -32,7 +32,7 @@ template void qr() int rank = ei_random(1, std::min(rows, cols)-1); typedef typename MatrixType::Scalar Scalar; - typedef Matrix SquareMatrixType; + typedef Matrix MatrixQType; typedef Matrix VectorType; MatrixType m1; createRandomMatrixOfRank(rank,rows,cols,m1); @@ -44,6 +44,10 @@ template void qr() VERIFY(!qr.isSurjective()); MatrixType r = qr.matrixQR(); + + MatrixQType q = qr.matrixQ(); + VERIFY_IS_UNITARY(q); + // 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); diff --git a/test/qr_fullpivoting.cpp b/test/qr_fullpivoting.cpp index 3a37bcb46..891c2a527 100644 --- a/test/qr_fullpivoting.cpp +++ b/test/qr_fullpivoting.cpp @@ -32,7 +32,7 @@ template void qr() int rank = ei_random(1, std::min(rows, cols)-1); typedef typename MatrixType::Scalar Scalar; - typedef Matrix SquareMatrixType; + typedef Matrix MatrixQType; typedef Matrix VectorType; MatrixType m1; createRandomMatrixOfRank(rank,rows,cols,m1); @@ -44,6 +44,10 @@ template void qr() VERIFY(!qr.isSurjective()); MatrixType r = qr.matrixQR(); + + MatrixQType q = qr.matrixQ(); + VERIFY_IS_UNITARY(q); + // 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);