diff options
author | Hauke Heibel <hauke.heibel@gmail.com> | 2009-05-22 14:27:58 +0200 |
---|---|---|
committer | Hauke Heibel <hauke.heibel@gmail.com> | 2009-05-22 14:27:58 +0200 |
commit | 2c247fc8a85f1e31bdef8804488a4959f7ce99cc (patch) | |
tree | 99d99b45b68c7eaeffd77591ce560f76bb2d1d3f /test/lu.cpp | |
parent | 5c5789cf0f28b375e3bfebe3e61756fc0b00fe0c (diff) |
LU and PartialLU decomposition interface unification.
Added default ctor and public compute method as well
as safe-guards against uninitialized usage.
Added unit tests for the safe-guards.
Diffstat (limited to 'test/lu.cpp')
-rw-r--r-- | test/lu.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/lu.cpp b/test/lu.cpp index 625241330..923acee3e 100644 --- a/test/lu.cpp +++ b/test/lu.cpp @@ -92,6 +92,37 @@ template<typename MatrixType> void lu_invertible() VERIFY(lu.solve(m3, &m2)); } +template<typename MatrixType> void lu_verify_assert() +{ + MatrixType tmp; + + LU<MatrixType> lu; + VERIFY_RAISES_ASSERT(lu.matrixLU()) + VERIFY_RAISES_ASSERT(lu.permutationP()) + VERIFY_RAISES_ASSERT(lu.permutationQ()) + VERIFY_RAISES_ASSERT(lu.computeKernel(&tmp)) + VERIFY_RAISES_ASSERT(lu.computeImage(&tmp)) + VERIFY_RAISES_ASSERT(lu.kernel()) + VERIFY_RAISES_ASSERT(lu.image()) + VERIFY_RAISES_ASSERT(lu.solve(tmp,&tmp)) + VERIFY_RAISES_ASSERT(lu.determinant()) + VERIFY_RAISES_ASSERT(lu.rank()) + VERIFY_RAISES_ASSERT(lu.dimensionOfKernel()) + VERIFY_RAISES_ASSERT(lu.isInjective()) + VERIFY_RAISES_ASSERT(lu.isSurjective()) + VERIFY_RAISES_ASSERT(lu.isInvertible()) + VERIFY_RAISES_ASSERT(lu.computeInverse(&tmp)) + VERIFY_RAISES_ASSERT(lu.inverse()) + + PartialLU<MatrixType> plu; + VERIFY_RAISES_ASSERT(plu.matrixLU()) + VERIFY_RAISES_ASSERT(plu.permutationP()) + VERIFY_RAISES_ASSERT(plu.solve(tmp,&tmp)) + VERIFY_RAISES_ASSERT(plu.determinant()) + VERIFY_RAISES_ASSERT(plu.computeInverse(&tmp)) + VERIFY_RAISES_ASSERT(plu.inverse()) +} + void test_lu() { for(int i = 0; i < g_repeat; i++) { @@ -104,4 +135,11 @@ void test_lu() CALL_SUBTEST( lu_invertible<MatrixXcf>() ); CALL_SUBTEST( lu_invertible<MatrixXcd>() ); } + + CALL_SUBTEST( lu_verify_assert<Matrix3f>() ); + CALL_SUBTEST( lu_verify_assert<Matrix3d>() ); + CALL_SUBTEST( lu_verify_assert<MatrixXf>() ); + CALL_SUBTEST( lu_verify_assert<MatrixXd>() ); + CALL_SUBTEST( lu_verify_assert<MatrixXcf>() ); + CALL_SUBTEST( lu_verify_assert<MatrixXcd>() ); } |