diff options
author | Gael Guennebaud <g.gael@free.fr> | 2015-10-27 21:37:03 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2015-10-27 21:37:03 +0100 |
commit | 827d8a9bad6f6c8a8e0211358b51c60db18a2cfb (patch) | |
tree | 2b9eec6832ec6846bc6aeb10270afd36f78da624 /test | |
parent | d4cf436cb1a8c2af96c9351114195847bc3ff1f1 (diff) |
Fix false negative in redux test
Diffstat (limited to 'test')
-rw-r--r-- | test/redux.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/redux.cpp b/test/redux.cpp index 849faf55e..bfd9a8d50 100644 --- a/test/redux.cpp +++ b/test/redux.cpp @@ -24,7 +24,7 @@ template<typename MatrixType> void matrixRedux(const MatrixType& m) MatrixType m1 = MatrixType::Random(rows, cols); // The entries of m1 are uniformly distributed in [0,1], so m1.prod() is very small. This may lead to test - // failures if we underflow into denormals. Thus, we scale so that entires are close to 1. + // failures if we underflow into denormals. Thus, we scale so that entries are close to 1. MatrixType m1_for_prod = MatrixType::Ones(rows, cols) + RealScalar(0.2) * m1; VERIFY_IS_MUCH_SMALLER_THAN(MatrixType::Zero(rows, cols).sum(), Scalar(1)); @@ -71,7 +71,9 @@ template<typename MatrixType> void matrixRedux(const MatrixType& m) // test nesting complex expression VERIFY_EVALUATION_COUNT( (m1.matrix()*m1.matrix().transpose()).sum(), (MatrixType::SizeAtCompileTime==Dynamic ? 1 : 0) ); - VERIFY_EVALUATION_COUNT( ((m1.matrix()*m1.matrix().transpose())*Scalar(2)).sum(), (MatrixType::SizeAtCompileTime==Dynamic ? 1 : 0) ); + Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> m2(rows,rows); + m2.setRandom(); + VERIFY_EVALUATION_COUNT( ((m1.matrix()*m1.matrix().transpose())+m2).sum(), (MatrixType::SizeAtCompileTime==Dynamic ? 1 : 0) ); } |