Relax tolerance when testing LDLT on singular problems

This commit is contained in:
Gael Guennebaud 2015-06-15 15:08:16 +02:00
parent 2212e40e95
commit 3946c981b1

View File

@ -225,8 +225,21 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
ldltlo.compute(A); ldltlo.compute(A);
VERIFY_IS_APPROX(A, ldltlo.reconstructedMatrix()); VERIFY_IS_APPROX(A, ldltlo.reconstructedMatrix());
vecX = ldltlo.solve(vecB); vecX = ldltlo.solve(vecB);
if(ldltlo.vectorD().real().cwiseAbs().minCoeff()>RealScalar(0))
{
VERIFY_IS_APPROX(A * vecX,vecB); VERIFY_IS_APPROX(A * vecX,vecB);
} }
else
{
RealScalar large_tol = std::sqrt(test_precision<RealScalar>());
VERIFY((A * vecX).isApprox(vecB, large_tol));
++g_test_level;
VERIFY_IS_APPROX(A * vecX,vecB);
--g_test_level;
}
}
} }
// update/downdate // update/downdate