aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/svd_common.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-10-15 23:37:47 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-10-15 23:37:47 +0200
commitc566cfe2ba0aad4ef054a55b402209980a90d994 (patch)
treee6530bff48d9bdb8c097c2fc5a54930b2c5a022b /test/svd_common.h
parentfd1aaf4772515f7a0ff124d2d79ed94aa3f66bdc (diff)
Make SVD unit test even more tough
Diffstat (limited to 'test/svd_common.h')
-rw-r--r--test/svd_common.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/svd_common.h b/test/svd_common.h
index 347ea8046..4c172cf9d 100644
--- a/test/svd_common.h
+++ b/test/svd_common.h
@@ -269,12 +269,14 @@ void svd_fill_random(MatrixType &m)
m = U * d.asDiagonal() * VT;
- // cancel some coeffs
+ // (partly) cancel some coeffs
if(!(dup && unit_uv))
{
- Index n = internal::random<Index>(0,m.size()-1);
+ Matrix<Scalar,Dynamic,1> samples(7);
+ samples << 0, 5.60844e-313, -5.60844e-313, 4.94e-324, -4.94e-324, -1./NumTraits<RealScalar>::highest(), 1./NumTraits<RealScalar>::highest();
+ Index n = internal::random<Index>(0,m.size()-1);
for(Index i=0; i<n; ++i)
- m(internal::random<Index>(0,m.rows()-1), internal::random<Index>(0,m.cols()-1)) = Scalar(0);
+ m(internal::random<Index>(0,m.rows()-1), internal::random<Index>(0,m.cols()-1)) = samples(internal::random<Index>(0,6));
}
}