From d7f3cfb56e7852534a08db23075482dcb11ba47b Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 9 Apr 2013 11:27:54 +0200 Subject: [PATCH] bug #564: document the fact that minCoeff/maxCoeff members have undefined behavior if the matrix contains NaN. --- Eigen/src/Core/Redux.h | 6 ++++-- Eigen/src/Core/VectorwiseOp.h | 4 ++++ Eigen/src/Core/Visitor.h | 16 ++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Eigen/src/Core/Redux.h b/Eigen/src/Core/Redux.h index b7ce7c658..50548fa9a 100644 --- a/Eigen/src/Core/Redux.h +++ b/Eigen/src/Core/Redux.h @@ -330,7 +330,8 @@ DenseBase::redux(const Func& func) const ::run(derived(), func); } -/** \returns the minimum of all coefficients of *this +/** \returns the minimum of all coefficients of \c *this. + * \warning the result is undefined if \c *this contains NaN. */ template EIGEN_STRONG_INLINE typename internal::traits::Scalar @@ -339,7 +340,8 @@ DenseBase::minCoeff() const return this->redux(Eigen::internal::scalar_min_op()); } -/** \returns the maximum of all coefficients of *this +/** \returns the maximum of all coefficients of \c *this. + * \warning the result is undefined if \c *this contains NaN. */ template EIGEN_STRONG_INLINE typename internal::traits::Scalar diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index 4549641dd..511564875 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -277,6 +277,8 @@ template class VectorwiseOp /** \returns a row (or column) vector expression of the smallest coefficient * of each column (or row) of the referenced expression. + * + * \warning the result is undefined if \c *this contains NaN. * * Example: \include PartialRedux_minCoeff.cpp * Output: \verbinclude PartialRedux_minCoeff.out @@ -287,6 +289,8 @@ template class VectorwiseOp /** \returns a row (or column) vector expression of the largest coefficient * of each column (or row) of the referenced expression. + * + * \warning the result is undefined if \c *this contains NaN. * * Example: \include PartialRedux_maxCoeff.cpp * Output: \verbinclude PartialRedux_maxCoeff.out diff --git a/Eigen/src/Core/Visitor.h b/Eigen/src/Core/Visitor.h index abf8d8e8c..64867b7a2 100644 --- a/Eigen/src/Core/Visitor.h +++ b/Eigen/src/Core/Visitor.h @@ -164,8 +164,8 @@ struct functor_traits > { } // end namespace internal -/** \returns the minimum of all coefficients of *this - * and puts in *row and *col its location. +/** \returns the minimum of all coefficients of *this and puts in *row and *col its location. + * \warning the result is undefined if \c *this contains NaN. * * \sa DenseBase::minCoeff(Index*), DenseBase::maxCoeff(Index*,Index*), DenseBase::visitor(), DenseBase::minCoeff() */ @@ -181,8 +181,8 @@ DenseBase::minCoeff(IndexType* rowId, IndexType* colId) const return minVisitor.res; } -/** \returns the minimum of all coefficients of *this - * and puts in *index its location. +/** \returns the minimum of all coefficients of *this and puts in *index its location. + * \warning the result is undefined if \c *this contains NaN. * * \sa DenseBase::minCoeff(IndexType*,IndexType*), DenseBase::maxCoeff(IndexType*,IndexType*), DenseBase::visitor(), DenseBase::minCoeff() */ @@ -198,8 +198,8 @@ DenseBase::minCoeff(IndexType* index) const return minVisitor.res; } -/** \returns the maximum of all coefficients of *this - * and puts in *row and *col its location. +/** \returns the maximum of all coefficients of *this and puts in *row and *col its location. + * \warning the result is undefined if \c *this contains NaN. * * \sa DenseBase::minCoeff(IndexType*,IndexType*), DenseBase::visitor(), DenseBase::maxCoeff() */ @@ -215,8 +215,8 @@ DenseBase::maxCoeff(IndexType* rowPtr, IndexType* colPtr) const return maxVisitor.res; } -/** \returns the maximum of all coefficients of *this - * and puts in *index its location. +/** \returns the maximum of all coefficients of *this and puts in *index its location. + * \warning the result is undefined if \c *this contains NaN. * * \sa DenseBase::maxCoeff(IndexType*,IndexType*), DenseBase::minCoeff(IndexType*,IndexType*), DenseBase::visitor(), DenseBase::maxCoeff() */