another test in the non invertible case

This commit is contained in:
Manuel Yguel 2009-07-04 14:55:25 +02:00
parent d457ec5810
commit c398d0edcf

View File

@ -66,9 +66,20 @@ 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
//First: an invertible matrix
bool invertible = m1.computeInverseWithCheck(&m2);
VERIFY(invertible);
VERIFY_IS_APPROX(identity, m1*m2);
//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 );
if( 1 == rows ){
VERIFY( invertible ); }
else{
VERIFY( !invertible ); }
}
void test_inverse()