fix tests when scalar is bfloat16, half
diff --git a/test/array_for_matrix.cpp b/test/array_for_matrix.cpp index 6d7d0dd..237ac67 100644 --- a/test/array_for_matrix.cpp +++ b/test/array_for_matrix.cpp
@@ -26,7 +26,7 @@ // Prevent overflows for integer types. if (Eigen::NumTraits<Scalar>::IsInteger) { - constexpr Scalar kMaxVal = Scalar(10000); + Scalar kMaxVal = Scalar(10000); m1.array() = m1.array() - kMaxVal * (m1.array() / kMaxVal); m2.array() = m2.array() - kMaxVal * (m2.array() / kMaxVal); }
diff --git a/test/product.h b/test/product.h index 31f577f..74f01b0 100644 --- a/test/product.h +++ b/test/product.h
@@ -72,7 +72,7 @@ // Prevent overflows for integer types. if (Eigen::NumTraits<Scalar>::IsInteger) { - constexpr Scalar kMaxVal = Scalar(10000); + Scalar kMaxVal = Scalar(10000); m1.array() = m1.array() - kMaxVal * (m1.array() / kMaxVal); m2.array() = m2.array() - kMaxVal * (m2.array() / kMaxVal); v1.array() = v1.array() - kMaxVal * (v1.array() / kMaxVal);
diff --git a/test/redux.cpp b/test/redux.cpp index 872e44f..42c269a 100644 --- a/test/redux.cpp +++ b/test/redux.cpp
@@ -24,7 +24,7 @@ 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 + // The entries of m1 are uniformly distributed in [-1,1), so m1.prod() is very small. This may lead to test // 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; @@ -32,7 +32,7 @@ m2.setRandom(); // Prevent overflows for integer types. if (Eigen::NumTraits<Scalar>::IsInteger) { - constexpr Scalar kMaxVal = Scalar(10000); + Scalar kMaxVal = Scalar(10000); m1.array() = m1.array() - kMaxVal * (m1.array() / kMaxVal); m2.array() = m2.array() - kMaxVal * (m2.array() / kMaxVal); }
diff --git a/test/stl_iterators.cpp b/test/stl_iterators.cpp index 4b60e68..fee8ef5 100644 --- a/test/stl_iterators.cpp +++ b/test/stl_iterators.cpp
@@ -466,7 +466,7 @@ VectorType col = VectorType::Random(rows); // Prevent overflows for integer types. if (Eigen::NumTraits<Scalar>::IsInteger) { - constexpr Scalar kMaxVal = Scalar(1000); + Scalar kMaxVal = Scalar(1000); row.array() = row.array() - kMaxVal * (row.array() / kMaxVal); col.array() = col.array() - kMaxVal * (col.array() / kMaxVal); }