10 #ifndef EIGEN_COREITERATORS_H 11 #define EIGEN_COREITERATORS_H 20 template<
typename XprType,
typename EvaluatorKind>
21 class inner_iterator_selector;
32 template<
typename XprType>
36 typedef internal::inner_iterator_selector<XprType, typename internal::evaluator_traits<XprType>::Kind> IteratorType;
37 typedef internal::evaluator<XprType> EvaluatorType;
38 typedef typename internal::traits<XprType>::Scalar Scalar;
41 InnerIterator(
const XprType &xpr,
const Index &outerId)
42 : m_eval(xpr), m_iter(m_eval, outerId, xpr.innerSize())
46 EIGEN_STRONG_INLINE Scalar value()
const {
return m_iter.value(); }
50 EIGEN_STRONG_INLINE InnerIterator& operator++() { m_iter.operator++();
return *
this; }
52 EIGEN_STRONG_INLINE
Index index()
const {
return m_iter.index(); }
54 EIGEN_STRONG_INLINE
Index row()
const {
return m_iter.row(); }
56 EIGEN_STRONG_INLINE
Index col()
const {
return m_iter.col(); }
58 EIGEN_STRONG_INLINE
operator bool()
const {
return m_iter; }
67 template<
typename T> InnerIterator(
const EigenBase<T>&,
Index outer);
73 template<
typename XprType>
74 class inner_iterator_selector<XprType, IndexBased>
77 typedef evaluator<XprType> EvaluatorType;
78 typedef typename traits<XprType>::Scalar Scalar;
82 EIGEN_STRONG_INLINE inner_iterator_selector(
const EvaluatorType &eval,
const Index &outerId,
const Index &innerSize)
83 : m_eval(eval), m_inner(0), m_outer(outerId), m_end(innerSize)
86 EIGEN_STRONG_INLINE Scalar value()
const 88 return (IsRowMajor) ? m_eval.coeff(m_outer, m_inner)
89 : m_eval.coeff(m_inner, m_outer);
92 EIGEN_STRONG_INLINE inner_iterator_selector& operator++() { m_inner++;
return *
this; }
94 EIGEN_STRONG_INLINE
Index index()
const {
return m_inner; }
95 inline Index row()
const {
return IsRowMajor ? m_outer : index(); }
96 inline Index col()
const {
return IsRowMajor ? index() : m_outer; }
98 EIGEN_STRONG_INLINE
operator bool()
const {
return m_inner < m_end && m_inner>=0; }
101 const EvaluatorType& m_eval;
109 template<
typename XprType>
110 class inner_iterator_selector<XprType, IteratorBased>
111 :
public evaluator<XprType>::InnerIterator
114 typedef typename evaluator<XprType>::InnerIterator Base;
115 typedef evaluator<XprType> EvaluatorType;
118 EIGEN_STRONG_INLINE inner_iterator_selector(
const EvaluatorType &eval,
const Index &outerId,
const Index &)
119 : Base(eval, outerId)
127 #endif // EIGEN_COREITERATORS_H Namespace containing all symbols from the Eigen library.
Definition: Core:287
const unsigned int RowMajorBit
Definition: Constants.h:61
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Definition: Eigen_Colamd.h:50