diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2008-09-01 17:31:21 +0000 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2008-09-01 17:31:21 +0000 |
commit | 46fe7a3d9ec14ea56a879c48ba7f15e78342c8cb (patch) | |
tree | c708710574525c93c9732d23e7e935863434b9ac /test/lu.cpp | |
parent | 49ff9b204c8ddd448fe214fdaf8622c4fe97c795 (diff) |
if EIGEN_NICE_RANDOM is defined, the random functions will return numbers with
few bits left of the comma and for floating-point types will never return zero.
This replaces the custom functions in test/main.h, so one does not anymore need
to think about that when writing tests.
Diffstat (limited to 'test/lu.cpp')
-rw-r--r-- | test/lu.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/lu.cpp b/test/lu.cpp index 0f4e0ab64..e34462c95 100644 --- a/test/lu.cpp +++ b/test/lu.cpp @@ -56,7 +56,7 @@ template<typename MatrixType> void lu_non_invertible() int rank = ei_random<int>(1, std::min(rows, cols)-1); MatrixType m1(rows, cols), m2(cols, cols2), m3(rows, cols2), k(1,1); - m1 = test_random_matrix<MatrixType>(rows,cols); + m1 = MatrixType::Random(rows,cols); if(rows <= cols) for(int i = rank; i < rows; i++) m1.row(i).setZero(); else @@ -72,12 +72,12 @@ template<typename MatrixType> void lu_non_invertible() VERIFY((m1 * lu.kernel()).isMuchSmallerThan(m1)); lu.computeKernel(&k); VERIFY((m1 * k).isMuchSmallerThan(m1)); - m2 = test_random_matrix<MatrixType>(cols,cols2); + m2 = MatrixType::Random(cols,cols2); m3 = m1*m2; - m2 = test_random_matrix<MatrixType>(cols,cols2); + m2 = MatrixType::Random(cols,cols2); lu.solve(m3, &m2); VERIFY_IS_APPROX(m3, m1*m2); - m3 = test_random_matrix<MatrixType>(rows,cols2); + m3 = MatrixType::Random(rows,cols2); VERIFY(!lu.solve(m3, &m2)); } @@ -90,12 +90,12 @@ template<typename MatrixType> void lu_invertible() int size = ei_random<int>(10,200); MatrixType m1(size, size), m2(size, size), m3(size, size); - m1 = test_random_matrix<MatrixType>(size,size); + m1 = MatrixType::Random(size,size); if (ei_is_same_type<RealScalar,float>::ret) { // let's build a matrix more stable to inverse - MatrixType a = test_random_matrix<MatrixType>(size,size*2); + MatrixType a = MatrixType::Random(size,size*2); m1 += a * a.adjoint(); } @@ -105,11 +105,11 @@ template<typename MatrixType> void lu_invertible() VERIFY(lu.isInjective()); VERIFY(lu.isSurjective()); VERIFY(lu.isInvertible()); - m3 = test_random_matrix<MatrixType>(size,size); + m3 = MatrixType::Random(size,size); lu.solve(m3, &m2); VERIFY_IS_APPROX(m3, m1*m2); VERIFY_IS_APPROX(m2, lu.inverse()*m3); - m3 = test_random_matrix<MatrixType>(size,size); + m3 = MatrixType::Random(size,size); VERIFY(lu.solve(m3, &m2)); } |