10#ifndef EIGEN_COREITERATORS_H
11#define EIGEN_COREITERATORS_H
20template<
typename XprType,
typename EvaluatorKind>
32template<
typename XprType>
46 EIGEN_STRONG_INLINE Scalar
value()
const {
return m_iter.value(); }
51 EIGEN_STRONG_INLINE
InnerIterator& operator+=(
Index i) { m_iter.operator+=(i);
return *
this; }
52 EIGEN_STRONG_INLINE InnerIterator operator+(
Index i)
53 { InnerIterator result(*
this); result+=i;
return result; }
57 EIGEN_STRONG_INLINE
Index index()
const {
return m_iter.index(); }
59 EIGEN_STRONG_INLINE
Index row()
const {
return m_iter.row(); }
61 EIGEN_STRONG_INLINE
Index col()
const {
return m_iter.col(); }
63 EIGEN_STRONG_INLINE
operator bool()
const {
return m_iter; }
78template<
typename XprType>
79class inner_iterator_selector<XprType, IndexBased>
82 typedef evaluator<XprType> EvaluatorType;
83 typedef typename traits<XprType>::Scalar Scalar;
87 EIGEN_STRONG_INLINE inner_iterator_selector(
const EvaluatorType &eval,
const Index &outerId,
const Index &innerSize)
88 : m_eval(eval), m_inner(0), m_outer(outerId), m_end(innerSize)
91 EIGEN_STRONG_INLINE Scalar value()
const
93 return (IsRowMajor) ? m_eval.coeff(m_outer, m_inner)
94 : m_eval.coeff(m_inner, m_outer);
97 EIGEN_STRONG_INLINE inner_iterator_selector& operator++() { m_inner++;
return *
this; }
99 EIGEN_STRONG_INLINE
Index index()
const {
return m_inner; }
100 inline Index row()
const {
return IsRowMajor ? m_outer : index(); }
101 inline Index col()
const {
return IsRowMajor ? index() : m_outer; }
103 EIGEN_STRONG_INLINE
operator bool()
const {
return m_inner < m_end && m_inner>=0; }
106 const EvaluatorType& m_eval;
114template<
typename XprType>
115class inner_iterator_selector<XprType, IteratorBased>
116 :
public evaluator<XprType>::InnerIterator
119 typedef typename evaluator<XprType>::InnerIterator Base;
120 typedef evaluator<XprType> EvaluatorType;
123 EIGEN_STRONG_INLINE inner_iterator_selector(
const EvaluatorType &eval,
const Index &outerId,
const Index &)
124 : Base(eval, outerId)
An InnerIterator allows to loop over the element of any matrix expression.
Definition CoreIterators.h:34
EIGEN_STRONG_INLINE Index col() const
Definition CoreIterators.h:61
EIGEN_STRONG_INLINE Index row() const
Definition CoreIterators.h:59
EIGEN_STRONG_INLINE Scalar value() const
Definition CoreIterators.h:46
InnerIterator(const XprType &xpr, const Index &outerId)
Construct an iterator over the outerId -th row or column of xpr.
Definition CoreIterators.h:41
EIGEN_STRONG_INLINE Index index() const
Definition CoreIterators.h:57
EIGEN_STRONG_INLINE InnerIterator & operator++()
Increment the iterator *this to the next non-zero coefficient.
Definition CoreIterators.h:50
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
Definition CoreIterators.h:21
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
Definition CoreEvaluators.h:91
Definition ForwardDeclarations.h:17