aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/main.h
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-09-01 17:31:21 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-09-01 17:31:21 +0000
commit46fe7a3d9ec14ea56a879c48ba7f15e78342c8cb (patch)
treec708710574525c93c9732d23e7e935863434b9ac /test/main.h
parent49ff9b204c8ddd448fe214fdaf8622c4fe97c795 (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/main.h')
-rw-r--r--test/main.h21
1 files changed, 1 insertions, 20 deletions
diff --git a/test/main.h b/test/main.h
index b1410386f..4e9621543 100644
--- a/test/main.h
+++ b/test/main.h
@@ -135,6 +135,7 @@ namespace Eigen
#define EIGEN_INTERNAL_DEBUGGING
+#define EIGEN_NICE_RANDOM
#include <Eigen/Core>
namespace Eigen {
@@ -221,26 +222,6 @@ inline bool test_ei_isMuchSmallerThan(const MatrixBase<Derived>& m,
return m.isMuchSmallerThan(s, test_precision<typename ei_traits<Derived>::Scalar>());
}
-template<typename T> T test_random();
-
-template<> int test_random() { return ei_random<int>(-100,100); }
-template<> float test_random() { return float(ei_random<int>(-1000,1000)) / 256.f; }
-template<> double test_random() { return double(ei_random<int>(-1000,1000)) / 256.; }
-template<> std::complex<float> test_random()
-{ return std::complex<float>(test_random<float>(),test_random<float>()); }
-template<> std::complex<double> test_random()
-{ return std::complex<double>(test_random<double>(),test_random<double>()); }
-
-template<typename MatrixType>
-MatrixType test_random_matrix(int rows = MatrixType::RowsAtCompileTime, int cols = MatrixType::ColsAtCompileTime)
-{
- MatrixType res(rows, cols);
- for (int j=0; j<cols; ++j)
- for (int i=0; i<rows; ++i)
- res.coeffRef(i,j) = test_random<typename MatrixType::Scalar>();
- return res;
-}
-
} // end namespace Eigen