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.
This commit is contained in:
Benoit Jacob
2008-09-01 17:31:21 +00:00
parent 49ff9b204c
commit 46fe7a3d9e
15 changed files with 78 additions and 83 deletions

View File

@@ -31,7 +31,7 @@ template<typename MatrixType> void matrixSum(const MatrixType& m)
int rows = m.rows();
int cols = m.cols();
MatrixType m1 = test_random_matrix<MatrixType>(rows, cols);
MatrixType m1 = MatrixType::Random(rows, cols);
VERIFY_IS_MUCH_SMALLER_THAN(MatrixType::Zero(rows, cols).sum(), Scalar(1));
VERIFY_IS_APPROX(MatrixType::Ones(rows, cols).sum(), Scalar(rows*cols));
@@ -45,7 +45,7 @@ template<typename VectorType> void vectorSum(const VectorType& w)
typedef typename VectorType::Scalar Scalar;
int size = w.size();
VectorType v = test_random_matrix<VectorType>(size);
VectorType v = VectorType::Random(size);
for(int i = 1; i < size; i++)
{
Scalar s = Scalar(0);