diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-04-28 18:51:38 -0400 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-04-28 18:51:38 -0400 |
commit | e2775869588e1df2d19265eac5c167651168a414 (patch) | |
tree | 8ca0d2fdbc1f8945405fb3fd99c5634b60f3189f /test/product.h | |
parent | 4f83d6ad1959f3c76cd5eb328ec65ced4ca4f339 (diff) |
Complete rework of global math functions and NumTraits.
* Now completely generic so all standard integer types (like char...) are supported.
** add unit test for that (integer_types).
* NumTraits does no longer inherit numeric_limits
* All math functions are now templated
* Better guard (static asserts) against using certain math functions on integer types.
Diffstat (limited to 'test/product.h')
-rw-r--r-- | test/product.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/product.h b/test/product.h index f6109fae4..277b73c45 100644 --- a/test/product.h +++ b/test/product.h @@ -39,7 +39,7 @@ template<typename MatrixType> void product(const MatrixType& m) */ typedef typename MatrixType::Scalar Scalar; - typedef typename NumTraits<Scalar>::FloatingPoint FloatingPoint; + typedef typename NumTraits<Scalar>::NonInteger NonInteger; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> RowVectorType; typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> ColVectorType; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> RowSquareMatrixType; @@ -101,7 +101,7 @@ template<typename MatrixType> void product(const MatrixType& m) // test the previous tests were not screwed up because operator* returns 0 // (we use the more accurate default epsilon) - if (NumTraits<Scalar>::HasFloatingPoint && std::min(rows,cols)>1) + if (!NumTraits<Scalar>::IsInteger && std::min(rows,cols)>1) { VERIFY(areNotApprox(m1.transpose()*m2,m2.transpose()*m1)); } @@ -110,7 +110,7 @@ template<typename MatrixType> void product(const MatrixType& m) res = square; res.noalias() += m1 * m2.transpose(); VERIFY_IS_APPROX(res, square + m1 * m2.transpose()); - if (NumTraits<Scalar>::HasFloatingPoint && std::min(rows,cols)>1) + if (!NumTraits<Scalar>::IsInteger && std::min(rows,cols)>1) { VERIFY(areNotApprox(res,square + m2 * m1.transpose())); } @@ -122,7 +122,7 @@ template<typename MatrixType> void product(const MatrixType& m) res = square; res.noalias() -= m1 * m2.transpose(); VERIFY_IS_APPROX(res, square - (m1 * m2.transpose())); - if (NumTraits<Scalar>::HasFloatingPoint && std::min(rows,cols)>1) + if (!NumTraits<Scalar>::IsInteger && std::min(rows,cols)>1) { VERIFY(areNotApprox(res,square - m2 * m1.transpose())); } @@ -146,7 +146,7 @@ template<typename MatrixType> void product(const MatrixType& m) res2 = square2; res2.noalias() += m1.transpose() * m2; VERIFY_IS_APPROX(res2, square2 + m1.transpose() * m2); - if (NumTraits<Scalar>::HasFloatingPoint && std::min(rows,cols)>1) + if (!NumTraits<Scalar>::IsInteger && std::min(rows,cols)>1) { VERIFY(areNotApprox(res2,square2 + m2.transpose() * m1)); } |