From 2840ac7e948ecb3c7b19ba8f581f829a4a4e1fea Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Wed, 28 Oct 2009 18:19:29 -0400 Subject: big huge changes, so i dont remember everything. * renaming, e.g. LU ---> FullPivLU * split tests framework: more robust, e.g. dont generate empty tests if a number is skipped * make all remaining tests use that splitting, as needed. * Fix 4x4 inversion (see stable branch) * Transform::inverse() and geo_transform test : adapt to new inverse() API, it was also trying to instantiate inverse() for 3x4 matrices. * CMakeLists: more robust regexp to parse the version number * misc fixes in unit tests --- test/lu.cpp | 54 +++++++++++++++++++++++++----------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) (limited to 'test/lu.cpp') diff --git a/test/lu.cpp b/test/lu.cpp index 1813172cd..b7214ae12 100644 --- a/test/lu.cpp +++ b/test/lu.cpp @@ -58,13 +58,13 @@ template void lu_non_invertible() int rank = ei_random(1, std::min(rows, cols)-1); // The image of the zero matrix should consist of a single (zero) column vector - VERIFY((MatrixType::Zero(rows,cols).lu().image(MatrixType::Zero(rows,cols)).cols() == 1)); + VERIFY((MatrixType::Zero(rows,cols).fullPivLu().image(MatrixType::Zero(rows,cols)).cols() == 1)); MatrixType m1(rows, cols), m3(rows, cols2); CMatrixType m2(cols, cols2); createRandomMatrixOfRank(rank, rows, cols, m1); - LU lu(m1); + FullPivLU lu(m1); KernelMatrixType m1kernel = lu.kernel(); ImageMatrixType m1image = lu.image(m1); @@ -75,20 +75,16 @@ template void lu_non_invertible() VERIFY(!lu.isInvertible()); VERIFY(!lu.isSurjective()); VERIFY((m1 * m1kernel).isMuchSmallerThan(m1)); - VERIFY(m1image.lu().rank() == rank); + VERIFY(m1image.fullPivLu().rank() == rank); DynamicMatrixType sidebyside(m1.rows(), m1.cols() + m1image.cols()); sidebyside << m1, m1image; - VERIFY(sidebyside.lu().rank() == rank); + VERIFY(sidebyside.fullPivLu().rank() == rank); m2 = CMatrixType::Random(cols,cols2); m3 = m1*m2; m2 = CMatrixType::Random(cols,cols2); // test that the code, which does resize(), may be applied to an xpr m2.block(0,0,m2.rows(),m2.cols()) = lu.solve(m3); VERIFY_IS_APPROX(m3, m1*m2); - - CMatrixType m4(cols, cols), m5(cols, cols); - createRandomMatrixOfRank(cols/2, cols, cols, m4); - VERIFY(!m4.computeInverseWithCheck(&m5)); } template void lu_invertible() @@ -109,14 +105,14 @@ template void lu_invertible() m1 += a * a.adjoint(); } - LU lu(m1); + FullPivLU lu(m1); VERIFY(0 == lu.dimensionOfKernel()); VERIFY(lu.kernel().cols() == 1); // the kernel() should consist of a single (zero) column vector VERIFY(size == lu.rank()); VERIFY(lu.isInjective()); VERIFY(lu.isSurjective()); VERIFY(lu.isInvertible()); - VERIFY(lu.image(m1).lu().isInvertible()); + VERIFY(lu.image(m1).fullPivLu().isInvertible()); m3 = MatrixType::Random(size,size); m2 = lu.solve(m3); VERIFY_IS_APPROX(m3, m1*m2); @@ -127,7 +123,7 @@ template void lu_verify_assert() { MatrixType tmp; - LU lu; + FullPivLU lu; VERIFY_RAISES_ASSERT(lu.matrixLU()) VERIFY_RAISES_ASSERT(lu.permutationP()) VERIFY_RAISES_ASSERT(lu.permutationQ()) @@ -142,10 +138,10 @@ template void lu_verify_assert() VERIFY_RAISES_ASSERT(lu.isInvertible()) VERIFY_RAISES_ASSERT(lu.inverse()) - PartialLU plu; + PartialPivLU plu; VERIFY_RAISES_ASSERT(plu.matrixLU()) VERIFY_RAISES_ASSERT(plu.permutationP()) - VERIFY_RAISES_ASSERT(plu.solve(tmp,&tmp)) + VERIFY_RAISES_ASSERT(plu.solve(tmp)) VERIFY_RAISES_ASSERT(plu.determinant()) VERIFY_RAISES_ASSERT(plu.inverse()) } @@ -153,26 +149,26 @@ template void lu_verify_assert() void test_lu() { for(int i = 0; i < g_repeat; i++) { - CALL_SUBTEST1( lu_non_invertible() ); - CALL_SUBTEST1( lu_verify_assert() ); + CALL_SUBTEST_1( lu_non_invertible() ); + CALL_SUBTEST_1( lu_verify_assert() ); - CALL_SUBTEST2( (lu_non_invertible >()) ); - CALL_SUBTEST2( (lu_verify_assert >()) ); + CALL_SUBTEST_2( (lu_non_invertible >()) ); + CALL_SUBTEST_2( (lu_verify_assert >()) ); - CALL_SUBTEST3( lu_non_invertible() ); - CALL_SUBTEST3( lu_invertible() ); - CALL_SUBTEST3( lu_verify_assert() ); + CALL_SUBTEST_3( lu_non_invertible() ); + CALL_SUBTEST_3( lu_invertible() ); + CALL_SUBTEST_3( lu_verify_assert() ); - CALL_SUBTEST4( lu_non_invertible() ); - CALL_SUBTEST4( lu_invertible() ); - CALL_SUBTEST4( lu_verify_assert() ); + CALL_SUBTEST_4( lu_non_invertible() ); + CALL_SUBTEST_4( lu_invertible() ); + CALL_SUBTEST_4( lu_verify_assert() ); - CALL_SUBTEST5( lu_non_invertible() ); - CALL_SUBTEST5( lu_invertible() ); - CALL_SUBTEST5( lu_verify_assert() ); + CALL_SUBTEST_5( lu_non_invertible() ); + CALL_SUBTEST_5( lu_invertible() ); + CALL_SUBTEST_5( lu_verify_assert() ); - CALL_SUBTEST6( lu_non_invertible() ); - CALL_SUBTEST6( lu_invertible() ); - CALL_SUBTEST6( lu_verify_assert() ); + CALL_SUBTEST_6( lu_non_invertible() ); + CALL_SUBTEST_6( lu_invertible() ); + CALL_SUBTEST_6( lu_verify_assert() ); } } -- cgit v1.2.3