aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cholesky.cpp8
-rw-r--r--test/lu.cpp7
2 files changed, 7 insertions, 8 deletions
diff --git a/test/cholesky.cpp b/test/cholesky.cpp
index 148a0b388..b7abc230b 100644
--- a/test/cholesky.cpp
+++ b/test/cholesky.cpp
@@ -91,12 +91,12 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
matX = chollo.solve(matB);
VERIFY_IS_APPROX(symm * matX, matB);
- // Verify that the estimated condition number is within a factor of 10 of the
- // truth.
const MatrixType symmLo_inverse = chollo.solve(MatrixType::Identity(rows,cols));
RealScalar rcond = (RealScalar(1) / matrix_l1_norm<MatrixType, Lower>(symmLo)) /
matrix_l1_norm<MatrixType, Lower>(symmLo_inverse);
RealScalar rcond_est = chollo.rcond();
+ // Verify that the estimated condition number is within a factor of 10 of the
+ // truth.
VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10);
// test the upper mode
@@ -160,12 +160,12 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
matX = ldltlo.solve(matB);
VERIFY_IS_APPROX(symm * matX, matB);
- // Verify that the estimated condition number is within a factor of 10 of the
- // truth.
const MatrixType symmLo_inverse = ldltlo.solve(MatrixType::Identity(rows,cols));
RealScalar rcond = (RealScalar(1) / matrix_l1_norm<MatrixType, Lower>(symmLo)) /
matrix_l1_norm<MatrixType, Lower>(symmLo_inverse);
RealScalar rcond_est = ldltlo.rcond();
+ // Verify that the estimated condition number is within a factor of 10 of the
+ // truth.
VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10);
diff --git a/test/lu.cpp b/test/lu.cpp
index 53b3fcee4..9787f4d86 100644
--- a/test/lu.cpp
+++ b/test/lu.cpp
@@ -151,10 +151,10 @@ template<typename MatrixType> void lu_invertible()
MatrixType m1_inverse = lu.inverse();
VERIFY_IS_APPROX(m2, m1_inverse*m3);
- // Verify that the estimated condition number is within a factor of 10 of the
- // truth.
RealScalar rcond = (RealScalar(1) / matrix_l1_norm(m1)) / matrix_l1_norm(m1_inverse);
const RealScalar rcond_est = lu.rcond();
+ // Verify that the estimated condition number is within a factor of 10 of the
+ // truth.
VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10);
// test solve with transposed
@@ -197,10 +197,9 @@ template<typename MatrixType> void lu_partial_piv()
MatrixType m1_inverse = plu.inverse();
VERIFY_IS_APPROX(m2, m1_inverse*m3);
- // Test condition number estimation.
RealScalar rcond = (RealScalar(1) / matrix_l1_norm(m1)) / matrix_l1_norm(m1_inverse);
- // Verify that the estimate is within a factor of 10 of the truth.
const RealScalar rcond_est = plu.rcond();
+ // Verify that the estimate is within a factor of 10 of the truth.
VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10);
// test solve with transposed