diff options
author | Gael Guennebaud <g.gael@free.fr> | 2012-01-23 21:49:00 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2012-01-23 21:49:00 +0100 |
commit | 0d03492e1e6e70b8c835785bdb1a9b7720e09dd1 (patch) | |
tree | 036d7fe7d6c71cf9ad5e540b81bca6270c0eef00 /Eigen/src | |
parent | ee9f3e34b0c54d40c9613cce74233d86a1a96182 (diff) |
std::isfinite is non standard
Diffstat (limited to 'Eigen/src')
-rw-r--r-- | Eigen/src/Cholesky/LDLT.h | 3 | ||||
-rw-r--r-- | Eigen/src/Core/MathFunctions.h | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/Eigen/src/Cholesky/LDLT.h b/Eigen/src/Cholesky/LDLT.h index 6a2d2994b..94b679ede 100644 --- a/Eigen/src/Cholesky/LDLT.h +++ b/Eigen/src/Cholesky/LDLT.h @@ -354,6 +354,7 @@ template<> struct ldlt_inplace<Lower> template<typename MatrixType, typename WDerived> static bool updateInPlace(MatrixType& mat, MatrixBase<WDerived>& w, typename MatrixType::RealScalar sigma=1) { + using internal::isfinite; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::Index Index; @@ -367,7 +368,7 @@ template<> struct ldlt_inplace<Lower> for (Index j = 0; j < size; j++) { // Check for termination due to an original decomposition of low-rank - if (!std::isfinite(alpha)) + if (!isfinite(alpha)) break; // Update the diagonal terms diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index 3680be4a0..971019f06 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -837,6 +837,17 @@ template<> struct scalar_fuzzy_impl<bool> }; +/**************************************************************************** +* Special functions * +****************************************************************************/ + +// std::isfinite is non standard, so let's define our own version, +// even though it is not very efficient. +template<typename T> bool isfinite(const T& x) +{ + return x<NumTraits<T>::highest() && x>NumTraits<T>::lowest(); +} + } // end namespace internal #endif // EIGEN_MATHFUNCTIONS_H |