aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-06-29 22:07:37 +0200
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-06-29 22:07:37 +0200
commit7b750182f244683d37de585b6181cf59bf24ff2b (patch)
treeac97489c1d12ec3ceed6055dfb18b8f001d39819 /test
parent126a031a391390f42d95f2adb9a13db6345ab007 (diff)
* polish computeInverseWithCheck to share more code, fix documentation, fix coding style
* add snippet for computeInverseWithCheck documentation * expand unit-tests to cover computeInverseWithCheck
Diffstat (limited to 'test')
-rw-r--r--test/inverse.cpp4
-rw-r--r--test/lu.cpp5
2 files changed, 9 insertions, 0 deletions
diff --git a/test/inverse.cpp b/test/inverse.cpp
index 90b897197..cdac7cdec 100644
--- a/test/inverse.cpp
+++ b/test/inverse.cpp
@@ -65,6 +65,10 @@ template<typename MatrixType> void inverse(const MatrixType& m)
// since for the general case we implement separately row-major and col-major, test that
VERIFY_IS_APPROX(m1.transpose().inverse(), m1.inverse().transpose());
+
+ bool invertible = m1.computeInverseWithCheck(&m2);
+ VERIFY(invertible);
+ VERIFY_IS_APPROX(identity, m1*m2);
}
void test_inverse()
diff --git a/test/lu.cpp b/test/lu.cpp
index 60e45ff2b..4ad92bb11 100644
--- a/test/lu.cpp
+++ b/test/lu.cpp
@@ -57,6 +57,11 @@ template<typename MatrixType> void lu_non_invertible()
VERIFY_IS_APPROX(m3, m1*m2);
m3 = MatrixType::Random(rows,cols2);
VERIFY(!lu.solve(m3, &m2));
+
+ typedef Matrix<typename MatrixType::Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;
+ SquareMatrixType m4(rows, rows), m5(rows, rows);
+ createRandomMatrixOfRank(rows/2, rows, rows, m4);
+ VERIFY(!m4.computeInverseWithCheck(&m5));
}
template<typename MatrixType> void lu_invertible()