From ccd70ba123562b77f132c562f76d1286af7d5fe3 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 9 Oct 2014 23:29:01 +0200 Subject: Various numerical fixes in D&C SVD: I cannot make it fail with double, but still need to tune for single precision, and carefully test with duplicated singular values --- test/svd_common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/svd_common.h') diff --git a/test/svd_common.h b/test/svd_common.h index b880efce5..e902d2320 100644 --- a/test/svd_common.h +++ b/test/svd_common.h @@ -146,6 +146,7 @@ void svd_min_norm(const MatrixType& m, unsigned int computationOptions) m2.setRandom(); } while(SVD_FOR_MIN_NORM(MatrixType2)(m2).setThreshold(test_precision()).rank()!=rank && (++guard)<10); VERIFY(guard<10); + RhsType2 rhs2 = RhsType2::Random(rank); // use QR to find a reference minimal norm solution HouseholderQR qr(m2.adjoint()); @@ -159,7 +160,7 @@ void svd_min_norm(const MatrixType& m, unsigned int computationOptions) VERIFY_IS_APPROX(m2*x21, rhs2); VERIFY_IS_APPROX(m2*x22, rhs2); VERIFY_IS_APPROX(x21, x22); - + // Now check with a rank deficient matrix typedef Matrix MatrixType3; typedef Matrix RhsType3; @@ -172,7 +173,6 @@ void svd_min_norm(const MatrixType& m, unsigned int computationOptions) VERIFY_IS_APPROX(m3*x3, rhs3); VERIFY_IS_APPROX(m3*x21, rhs3); VERIFY_IS_APPROX(m2*x3, rhs2); - VERIFY_IS_APPROX(x21, x3); } @@ -209,7 +209,7 @@ void svd_test_all_computation_options(const MatrixType& m, bool full_only) CALL_SUBTEST(( svd_least_square(m, ComputeFullU | ComputeThinV) )); CALL_SUBTEST(( svd_least_square(m, ComputeThinU | ComputeFullV) )); CALL_SUBTEST(( svd_least_square(m, ComputeThinU | ComputeThinV) )); - + CALL_SUBTEST(( svd_min_norm(m, ComputeFullU | ComputeThinV) )); CALL_SUBTEST(( svd_min_norm(m, ComputeThinU | ComputeFullV) )); CALL_SUBTEST(( svd_min_norm(m, ComputeThinU | ComputeThinV) )); -- cgit v1.2.3