10 #ifndef EIGEN_COREITERATORS_H
11 #define EIGEN_COREITERATORS_H
22 template<
typename XprType,
typename EvaluatorKind>
23 class inner_iterator_selector;
34 template<
typename XprType>
38 typedef internal::inner_iterator_selector<XprType, typename internal::evaluator_traits<XprType>::Kind> IteratorType;
39 typedef internal::evaluator<XprType> EvaluatorType;
40 typedef typename internal::traits<XprType>::Scalar Scalar;
43 InnerIterator(
const XprType &xpr,
const Index &outerId)
44 : m_eval(xpr), m_iter(m_eval, outerId, xpr.innerSize())
48 EIGEN_STRONG_INLINE Scalar value()
const {
return m_iter.value(); }
52 EIGEN_STRONG_INLINE InnerIterator&
operator++() { m_iter.operator++();
return *
this; }
53 EIGEN_STRONG_INLINE InnerIterator&
operator+=(
Index i) { m_iter.operator+=(
i);
return *
this; }
55 { InnerIterator result(*
this); result+=
i;
return result; }
59 EIGEN_STRONG_INLINE
Index index()
const {
return m_iter.index(); }
61 EIGEN_STRONG_INLINE
Index row()
const {
return m_iter.row(); }
63 EIGEN_STRONG_INLINE
Index col()
const {
return m_iter.col(); }
65 EIGEN_STRONG_INLINE
operator bool()
const {
return m_iter; }
74 template<
typename T> InnerIterator(
const EigenBase<T>&,
Index outer);
80 template<
typename XprType>
81 class inner_iterator_selector<XprType, IndexBased>
84 typedef evaluator<XprType> EvaluatorType;
85 typedef typename traits<XprType>::Scalar Scalar;
89 EIGEN_STRONG_INLINE inner_iterator_selector(
const EvaluatorType &eval,
const Index &outerId,
const Index &innerSize)
90 : m_eval(eval), m_inner(0), m_outer(outerId), m_end(innerSize)
93 EIGEN_STRONG_INLINE Scalar value()
const
95 return (IsRowMajor) ? m_eval.coeff(m_outer, m_inner)
96 : m_eval.coeff(m_inner, m_outer);
99 EIGEN_STRONG_INLINE inner_iterator_selector&
operator++() { m_inner++;
return *
this; }
101 EIGEN_STRONG_INLINE
Index index()
const {
return m_inner; }
102 inline Index row()
const {
return IsRowMajor ? m_outer : index(); }
103 inline Index col()
const {
return IsRowMajor ? index() : m_outer; }
105 EIGEN_STRONG_INLINE
operator bool()
const {
return m_inner < m_end && m_inner>=0; }
108 const EvaluatorType& m_eval;
116 template<
typename XprType>
117 class inner_iterator_selector<XprType, IteratorBased>
118 :
public evaluator<XprType>::InnerIterator
121 typedef typename evaluator<XprType>::InnerIterator Base;
122 typedef evaluator<XprType> EvaluatorType;
125 EIGEN_STRONG_INLINE inner_iterator_selector(
const EvaluatorType &eval,
const Index &outerId,
const Index &)
126 : Base(eval, outerId)
RowXpr row(Index i)
This is the const version of row(). */.
ColXpr col(Index i)
This is the const version of col().
const unsigned int RowMajorBit
bfloat16 operator++(bfloat16 &a)
bfloat16 & operator+=(bfloat16 &a, const bfloat16 &b)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
const CwiseBinaryOp< internal::scalar_sum_op< typename DenseDerived::Scalar, typename SparseDerived::Scalar >, const DenseDerived, const SparseDerived > operator+(const MatrixBase< DenseDerived > &a, const SparseMatrixBase< SparseDerived > &b)