aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cholesky.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-06-15 15:08:16 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-06-15 15:08:16 +0200
commit3946c981b12827c94f62fc1862f121468f972a2c (patch)
tree145d851e0976162106d953a458cd834fb38fb4cc /test/cholesky.cpp
parent2212e40e955a4e333ab7f6d4f42b5a2f1c7aa112 (diff)
Relax tolerance when testing LDLT on singular problems
Diffstat (limited to 'test/cholesky.cpp')
-rw-r--r--test/cholesky.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/cholesky.cpp b/test/cholesky.cpp
index 9335270f4..16db380f6 100644
--- a/test/cholesky.cpp
+++ b/test/cholesky.cpp
@@ -225,7 +225,20 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
ldltlo.compute(A);
VERIFY_IS_APPROX(A, ldltlo.reconstructedMatrix());
vecX = ldltlo.solve(vecB);
- VERIFY_IS_APPROX(A * vecX, vecB);
+
+ if(ldltlo.vectorD().real().cwiseAbs().minCoeff()>RealScalar(0))
+ {
+ 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;
+ }
}
}