mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
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.
This commit is contained in:
38
test/lu.cpp
38
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>() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user