aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/qr_fullpivoting.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-10-12 22:33:51 -0400
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-10-12 22:33:51 -0400
commitc4ab6a2032895957e0e8dbea564b0c9c7f88b48a (patch)
treecef64758138c2da22644ac64c263a4d70b4c3e3a /test/qr_fullpivoting.cpp
parente5bf72679c993e302df95aa2947402482aaded71 (diff)
also test that the matrix Q is unitary
Diffstat (limited to 'test/qr_fullpivoting.cpp')
-rw-r--r--test/qr_fullpivoting.cpp6
1 files changed, 5 insertions, 1 deletions
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<typename MatrixType> void qr()
int rank = ei_random<int>(1, std::min(rows, cols)-1);
typedef typename MatrixType::Scalar Scalar;
- typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime> SquareMatrixType;
+ typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType;
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> VectorType;
MatrixType m1;
createRandomMatrixOfRank(rank,rows,cols,m1);
@@ -44,6 +44,10 @@ template<typename MatrixType> 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);