diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2011-01-25 21:28:20 -0500 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2011-01-25 21:28:20 -0500 |
commit | c350f6f12c85ee5c52cda82326f580dfbc9eb69f (patch) | |
tree | 740688a98b8c56cf570b3b356d71d46c39cbd691 | |
parent | 39536d44da5e7c286e601b1ac35d535841ba6284 (diff) |
fix bug #161
-rw-r--r-- | Eigen/src/Core/DenseBase.h | 19 | ||||
-rw-r--r-- | Eigen/src/Core/Visitor.h | 65 |
2 files changed, 19 insertions, 65 deletions
diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index 9c3c6432b..b8fa9d1cd 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h @@ -415,17 +415,14 @@ template<typename Derived> class DenseBase typename internal::traits<Derived>::Scalar minCoeff() const; typename internal::traits<Derived>::Scalar maxCoeff() const; - typename internal::traits<Derived>::Scalar minCoeff(Index* row, Index* col) const; - typename internal::traits<Derived>::Scalar maxCoeff(Index* row, Index* col) const; - typename internal::traits<Derived>::Scalar minCoeff(Index* index) const; - typename internal::traits<Derived>::Scalar maxCoeff(Index* index) const; - - #ifdef EIGEN2_SUPPORT - typename internal::traits<Derived>::Scalar minCoeff(int* row, int* col) const; - typename internal::traits<Derived>::Scalar maxCoeff(int* row, int* col) const; - typename internal::traits<Derived>::Scalar minCoeff(int* index) const; - typename internal::traits<Derived>::Scalar maxCoeff(int* index) const; - #endif + template<typename IndexType> + typename internal::traits<Derived>::Scalar minCoeff(IndexType* row, IndexType* col) const; + template<typename IndexType> + typename internal::traits<Derived>::Scalar maxCoeff(IndexType* row, IndexType* col) const; + template<typename IndexType> + typename internal::traits<Derived>::Scalar minCoeff(IndexType* index) const; + template<typename IndexType> + typename internal::traits<Derived>::Scalar maxCoeff(IndexType* index) const; template<typename BinaryOp> typename internal::result_of<BinaryOp(typename internal::traits<Derived>::Scalar)>::type diff --git a/Eigen/src/Core/Visitor.h b/Eigen/src/Core/Visitor.h index 556c6fcd7..378ebcba1 100644 --- a/Eigen/src/Core/Visitor.h +++ b/Eigen/src/Core/Visitor.h @@ -183,8 +183,9 @@ struct functor_traits<max_coeff_visitor<Scalar> > { * \sa DenseBase::minCoeff(Index*), DenseBase::maxCoeff(Index*,Index*), DenseBase::visitor(), DenseBase::minCoeff() */ template<typename Derived> +template<typename IndexType> typename internal::traits<Derived>::Scalar -DenseBase<Derived>::minCoeff(Index* row, Index* col) const +DenseBase<Derived>::minCoeff(IndexType* row, IndexType* col) const { internal::min_coeff_visitor<Derived> minVisitor; this->visit(minVisitor); @@ -196,11 +197,12 @@ DenseBase<Derived>::minCoeff(Index* row, Index* col) const /** \returns the minimum of all coefficients of *this * and puts in *index its location. * - * \sa DenseBase::minCoeff(Index*,Index*), DenseBase::maxCoeff(Index*,Index*), DenseBase::visitor(), DenseBase::minCoeff() + * \sa DenseBase::minCoeff(IndexType*,IndexType*), DenseBase::maxCoeff(IndexType*,IndexType*), DenseBase::visitor(), DenseBase::minCoeff() */ template<typename Derived> +template<typename IndexType> typename internal::traits<Derived>::Scalar -DenseBase<Derived>::minCoeff(Index* index) const +DenseBase<Derived>::minCoeff(IndexType* index) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) internal::min_coeff_visitor<Derived> minVisitor; @@ -212,11 +214,12 @@ DenseBase<Derived>::minCoeff(Index* index) const /** \returns the maximum of all coefficients of *this * and puts in *row and *col its location. * - * \sa DenseBase::minCoeff(Index*,Index*), DenseBase::visitor(), DenseBase::maxCoeff() + * \sa DenseBase::minCoeff(IndexType*,IndexType*), DenseBase::visitor(), DenseBase::maxCoeff() */ template<typename Derived> +template<typename IndexType> typename internal::traits<Derived>::Scalar -DenseBase<Derived>::maxCoeff(Index* row, Index* col) const +DenseBase<Derived>::maxCoeff(IndexType* row, IndexType* col) const { internal::max_coeff_visitor<Derived> maxVisitor; this->visit(maxVisitor); @@ -228,11 +231,12 @@ DenseBase<Derived>::maxCoeff(Index* row, Index* col) const /** \returns the maximum of all coefficients of *this * and puts in *index its location. * - * \sa DenseBase::maxCoeff(Index*,Index*), DenseBase::minCoeff(Index*,Index*), DenseBase::visitor(), DenseBase::maxCoeff() + * \sa DenseBase::maxCoeff(IndexType*,IndexType*), DenseBase::minCoeff(IndexType*,IndexType*), DenseBase::visitor(), DenseBase::maxCoeff() */ template<typename Derived> +template<typename IndexType> typename internal::traits<Derived>::Scalar -DenseBase<Derived>::maxCoeff(Index* index) const +DenseBase<Derived>::maxCoeff(IndexType* index) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) internal::max_coeff_visitor<Derived> maxVisitor; @@ -241,51 +245,4 @@ DenseBase<Derived>::maxCoeff(Index* index) const return maxVisitor.res; } -#ifdef EIGEN2_SUPPORT - -template<typename Derived> -typename internal::traits<Derived>::Scalar -DenseBase<Derived>::minCoeff(int* row, int* col) const -{ - Index r, c; - Scalar result = this->minCoeff(&r, &c); - *row = int(r); - *col = int(c); - return result; -} - -template<typename Derived> -typename internal::traits<Derived>::Scalar -DenseBase<Derived>::minCoeff(int* index) const -{ - Index i; - Scalar result = this->minCoeff(&i); - *index = int(i); - return result; -} - -template<typename Derived> -typename internal::traits<Derived>::Scalar -DenseBase<Derived>::maxCoeff(int* row, int* col) const -{ - Index r, c; - Scalar result = this->maxCoeff(&r, &c); - *row = int(r); - *col = int(c); - return result; -} - -template<typename Derived> -typename internal::traits<Derived>::Scalar -DenseBase<Derived>::maxCoeff(int* index) const -{ - Index i; - Scalar result = this->maxCoeff(&i); - *index = int(i); - return result; -} - -#endif // EIGEN2_SUPPORT - - #endif // EIGEN_VISITOR_H |