From ac2165c11f3912c83e43bbb8239ef8fdb6b1ed2b Mon Sep 17 00:00:00 2001 From: Charles Schlosser Date: Thu, 20 Mar 2025 16:04:46 +0000 Subject: [PATCH] fix allFinite --- Eigen/src/Core/Visitor.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Eigen/src/Core/Visitor.h b/Eigen/src/Core/Visitor.h index 198ec952a..421d86556 100644 --- a/Eigen/src/Core/Visitor.h +++ b/Eigen/src/Core/Visitor.h @@ -632,6 +632,17 @@ struct functor_traits> { }; }; +template ::Scalar>::IsInteger> +struct all_finite_impl { + static EIGEN_DEVICE_FUNC inline bool run(const Derived& /*derived*/) { return true; } +}; +#if !defined(__FINITE_MATH_ONLY__) || !(__FINITE_MATH_ONLY__) +template +struct all_finite_impl { + static EIGEN_DEVICE_FUNC inline bool run(const Derived& derived) { return derived.array().isFiniteTyped().all(); } +}; +#endif + } // end namespace internal /** \fn DenseBase::minCoeff(IndexType* rowId, IndexType* colId) const @@ -781,7 +792,7 @@ EIGEN_DEVICE_FUNC inline bool DenseBase::hasNaN() const { */ template EIGEN_DEVICE_FUNC inline bool DenseBase::allFinite() const { - return derived().array().isFiniteTyped().all(); + return internal::all_finite_impl::run(derived()); } } // end namespace Eigen