diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-10-26 11:18:23 -0400 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-10-26 11:18:23 -0400 |
commit | ec02388a5da8e3974e5dd5ab42dfc1565ee3b7e7 (patch) | |
tree | 970e46048570835219b0dfdad64d61009fa6be42 /test | |
parent | 68d48511b27b43b80d9268953a8567cc8abd66c1 (diff) |
big rewrite in Inverse.h
in particular, the API is essentially finalized and the 4x4 case is fixed to be numerically stable.
Diffstat (limited to 'test')
-rw-r--r-- | test/inverse.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/inverse.cpp b/test/inverse.cpp index 6fc65786c..b8170a738 100644 --- a/test/inverse.cpp +++ b/test/inverse.cpp @@ -53,9 +53,6 @@ template<typename MatrixType> void inverse(const MatrixType& m) m2 = m1.inverse(); VERIFY_IS_APPROX(m1, m2.inverse() ); - m1.computeInverse(&m2); - VERIFY_IS_APPROX(m1, m2.inverse() ); - VERIFY_IS_APPROX((Scalar(2)*m2).inverse(), m2.inverse()*Scalar(0.5)); VERIFY_IS_APPROX(identity, m1.inverse() * m1 ); @@ -66,17 +63,23 @@ 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()); - //computeInverseWithCheck tests +#if !defined(EIGEN_TEST_PART_5) && !defined(EIGEN_TEST_PART_6) + //computeInverseAndDetWithCheck tests //First: an invertible matrix - bool invertible = m1.computeInverseWithCheck(&m2); + bool invertible; + RealScalar det; + m1.computeInverseAndDetWithCheck(m2, det, invertible); VERIFY(invertible); VERIFY_IS_APPROX(identity, m1*m2); + VERIFY_IS_APPROX(det, m1.determinant()); //Second: a rank one matrix (not invertible, except for 1x1 matrices) VectorType v3 = VectorType::Random(rows); MatrixType m3 = v3*v3.transpose(), m4(rows,cols); - invertible = m3.computeInverseWithCheck( &m4 ); + m3.computeInverseAndDetWithCheck(m4, det, invertible); VERIFY( rows==1 ? invertible : !invertible ); + VERIFY_IS_APPROX(det, m3.determinant()); +#endif } void test_inverse() |