aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Rasmus Munk Larsen <rmlarsen@google.com>2021-02-26 09:07:00 -0800
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2021-02-26 09:07:00 -0800
commitfb5b59641aef640f154d2c3fc863885f68fc6034 (patch)
tree349b78e02588e876a3d6a92ba3dc34a6e5ddc278 /Eigen
parent4cb0592af706df224f6fed40bcf0bf56326a66f4 (diff)
Defer default for minCoeff/maxCoeff to templated variant.
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/Core/DenseBase.h14
-rw-r--r--Eigen/src/Core/Redux.h22
2 files changed, 11 insertions, 25 deletions
diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h
index 94dddd27d..eeb1a2e8f 100644
--- a/Eigen/src/Core/DenseBase.h
+++ b/Eigen/src/Core/DenseBase.h
@@ -449,14 +449,22 @@ template<typename Derived> class DenseBase
EIGEN_DEVICE_FUNC Scalar prod() const;
- EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar minCoeff() const;
- EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar maxCoeff() const;
-
template<int NaNPropagation>
EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar minCoeff() const;
template<int NaNPropagation>
EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar maxCoeff() const;
+ // By default, the fastest version with undefined NaN propagation semantics is
+ // used.
+ EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar minCoeff() const {
+ return minCoeff<PropagateFast>();
+ }
+ EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar maxCoeff() const {
+ return maxCoeff<PropagateFast>();
+ }
+
+
+
template<typename IndexType> EIGEN_DEVICE_FUNC
typename internal::traits<Derived>::Scalar minCoeff(IndexType* row, IndexType* col) const;
template<typename IndexType> EIGEN_DEVICE_FUNC
diff --git a/Eigen/src/Core/Redux.h b/Eigen/src/Core/Redux.h
index 4e5affc43..30598f415 100644
--- a/Eigen/src/Core/Redux.h
+++ b/Eigen/src/Core/Redux.h
@@ -419,17 +419,6 @@ DenseBase<Derived>::redux(const Func& func) const
}
/** \returns the minimum of all coefficients of \c *this.
- * \warning the matrix must be not empty, otherwise an assertion is triggered.
- * \warning the result is undefined if \c *this contains NaN.
- */
-template<typename Derived>
-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
-DenseBase<Derived>::minCoeff() const
-{
- return derived().redux(Eigen::internal::scalar_min_op<Scalar,Scalar>());
-}
-
-/** \returns the minimum of all coefficients of \c *this.
* In case \c *this contains NaN, NaNPropagation determines the behavior:
* NaNPropagation == PropagateFast : undefined
* NaNPropagation == PropagateNaN : result is NaN
@@ -444,17 +433,6 @@ DenseBase<Derived>::minCoeff() const
return derived().redux(Eigen::internal::scalar_min_op<Scalar,Scalar, NaNPropagation>());
}
-/** \returns the maximum of all coefficients of \c *this.
- * \warning the matrix must be not empty, otherwise an assertion is triggered.
- * \warning the result is undefined if \c *this contains NaN.
- */
-template<typename Derived>
-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar
-DenseBase<Derived>::maxCoeff() const
-{
- return derived().redux(Eigen::internal::scalar_max_op<Scalar,Scalar>());
-}
-
/** \returns the maximum of all coefficients of \c *this.
* In case \c *this contains NaN, NaNPropagation determines the behavior:
* NaNPropagation == PropagateFast : undefined