From f0394edfa7d063e37256e673cdecacd9f55f44ae Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 22 Aug 2008 17:48:36 +0000 Subject: * bugfix in SolveTriangular found by Timothy Hunter (did not compiled for very small fixed size matrices) * bugfix in Dot unroller * added special random generator for the unit tests and reduced the tolerance threshold by an order of magnitude this fixes issues with sum.cpp but other tests still failed sometimes, this have to be carefully checked... --- test/main.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'test/main.h') diff --git a/test/main.h b/test/main.h index 19f453922..d4cdced60 100644 --- a/test/main.h +++ b/test/main.h @@ -164,8 +164,8 @@ namespace Eigen { template inline typename NumTraits::Real test_precision(); template<> inline int test_precision() { return 0; } -template<> inline float test_precision() { return 1e-3f; } -template<> inline double test_precision() { return 1e-5; } +template<> inline float test_precision() { return 1e-4f; } +template<> inline double test_precision() { return 1e-6; } template<> inline float test_precision >() { return test_precision(); } template<> inline double test_precision >() { return test_precision(); } @@ -221,6 +221,26 @@ inline bool test_ei_isMuchSmallerThan(const MatrixBase& m, return m.isMuchSmallerThan(s, test_precision::Scalar>()); } +template T test_random(); + +template<> int test_random() { return ei_random(-100,100); } +template<> float test_random() { return float(ei_random(-1000,1000)) / 256.f; } +template<> double test_random() { return double(ei_random(-1000,1000)) / 256.; } +template<> std::complex test_random() +{ return std::complex(test_random(),test_random()); } +template<> std::complex test_random() +{ return std::complex(test_random(),test_random()); } + +template +MatrixType test_random_matrix(int rows = MatrixType::RowsAtCompileTime, int cols = MatrixType::ColsAtCompileTime) +{ + MatrixType res(rows, cols); + for (int j=0; j(); + return res; +} + } // end namespace Eigen -- cgit v1.2.3