diff options
author | Gael Guennebaud <g.gael@free.fr> | 2018-10-05 23:11:21 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2018-10-05 23:11:21 +0200 |
commit | d92f004ab76cdf961b9279e228d9eb7349a4d8db (patch) | |
tree | 0e49c01b0491ea8e69886d001966ab9bbea3ed01 /Eigen/src | |
parent | 91613bf2c2132fc4b45182146f9367398b6167f0 (diff) |
Simplify API by removing allCols/allRows and reusing rowwise/colwise to define iterators over rows/columns
Diffstat (limited to 'Eigen/src')
-rw-r--r-- | Eigen/src/Core/DenseBase.h | 4 | ||||
-rw-r--r-- | Eigen/src/Core/StlIterators.h | 35 | ||||
-rw-r--r-- | Eigen/src/Core/VectorwiseOp.h | 26 | ||||
-rw-r--r-- | Eigen/src/Core/util/ForwardDeclarations.h | 2 |
4 files changed, 27 insertions, 40 deletions
diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index b00f418c9..641ace608 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h @@ -597,10 +597,6 @@ template<typename Derived> class DenseBase inline iterator end(); inline const_iterator end() const; inline const_iterator cend() const; - inline SubVectorsProxy<Derived,Vertical> allCols(); - inline SubVectorsProxy<const Derived,Vertical> allCols() const; - inline SubVectorsProxy<Derived,Horizontal> allRows(); - inline SubVectorsProxy<const Derived,Horizontal> allRows() const; #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase #define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL diff --git a/Eigen/src/Core/StlIterators.h b/Eigen/src/Core/StlIterators.h index 8713964bd..24eef1269 100644 --- a/Eigen/src/Core/StlIterators.h +++ b/Eigen/src/Core/StlIterators.h @@ -228,39 +228,4 @@ inline typename DenseBase<Derived>::const_iterator DenseBase<Derived>::cend() co return const_iterator(derived(), size()); } -template<typename XprType, DirectionType Direction> -class SubVectorsProxy -{ -public: - typedef internal::subvector_stl_iterator<XprType, Direction> iterator; - typedef internal::subvector_stl_iterator<const XprType, Direction> const_iterator; - - SubVectorsProxy(XprType& xpr) : m_xpr(xpr) {} - - iterator begin() const { return iterator (m_xpr, 0); } - const_iterator cbegin() const { return const_iterator(m_xpr, 0); } - - iterator end() const { return iterator (m_xpr, m_xpr.template subVectors<Direction>()); } - const_iterator cend() const { return const_iterator(m_xpr, m_xpr.template subVectors<Direction>()); } - -protected: - XprType& m_xpr; -}; - -template<typename Derived> -SubVectorsProxy<Derived,Vertical> DenseBase<Derived>::allCols() -{ return SubVectorsProxy<Derived,Vertical>(derived()); } - -template<typename Derived> -SubVectorsProxy<const Derived,Vertical> DenseBase<Derived>::allCols() const -{ return SubVectorsProxy<const Derived,Vertical>(derived()); } - -template<typename Derived> -SubVectorsProxy<Derived,Horizontal> DenseBase<Derived>::allRows() -{ return SubVectorsProxy<Derived,Horizontal>(derived()); } - -template<typename Derived> -SubVectorsProxy<const Derived,Horizontal> DenseBase<Derived>::allRows() const -{ return SubVectorsProxy<const Derived,Horizontal>(derived()); } - } // namespace Eigen diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index e44cbd468..096cec27d 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -241,6 +241,32 @@ template<typename ExpressionType, int Direction> class VectorwiseOp EIGEN_DEVICE_FUNC inline const ExpressionType& _expression() const { return m_matrix; } + #ifdef EIGEN_PARSED_BY_DOXYGEN + /** STL-like \link https://en.cppreference.com/w/cpp/named_req/RandomAccessIterator RandomAccessIterator \endlink + * iterator type over the columns of rows as returned by the begin() and end() methods. + */ + random_access_iterator_type iterator; + /** This is the const version of iterator (aka read-only) */ + random_access_iterator_type const_iterator; + #else + typedef internal::subvector_stl_iterator<ExpressionType, DirectionType(Direction)> iterator; + typedef internal::subvector_stl_iterator<const ExpressionType, DirectionType(Direction)> const_iterator; + #endif + + /** returns an iterator to the first row (rowwise) or column (colwise) of the nested expression. + * \sa end(), cbegin() + */ + iterator begin() const { return iterator (m_matrix, 0); } + /** const version of begin() */ + const_iterator cbegin() const { return const_iterator(m_matrix, 0); } + + /** returns an iterator to the row (resp. column) following the last row (resp. column) of the nested expression + * \sa begin(), cend() + */ + iterator end() const { return iterator (m_matrix, m_matrix.template subVectors<DirectionType(Direction)>()); } + /** const version of end() */ + const_iterator cend() const { return const_iterator(m_matrix, m_matrix.template subVectors<DirectionType(Direction)>()); } + /** \returns a row or column vector expression of \c *this reduxed by \a func * * The template parameter \a BinaryOp is the type of the functor diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h index a9332e940..3ab3a5f50 100644 --- a/Eigen/src/Core/util/ForwardDeclarations.h +++ b/Eigen/src/Core/util/ForwardDeclarations.h @@ -133,11 +133,11 @@ template<typename ExpressionType> class ArrayWrapper; template<typename ExpressionType> class MatrixWrapper; template<typename Derived> class SolverBase; template<typename XprType> class InnerIterator; -template<typename XprType, DirectionType Direction> class SubVectorsProxy; namespace internal { template<typename XprType> class generic_randaccess_stl_iterator; template<typename XprType> class pointer_based_stl_iterator; +template<typename XprType, DirectionType Direction> class subvector_stl_iterator; template<typename DecompositionType> struct kernel_retval_base; template<typename DecompositionType> struct kernel_retval; template<typename DecompositionType> struct image_retval_base; |