10#ifndef EIGEN_COREITERATORS_H
11#define EIGEN_COREITERATORS_H
14#include "./InternalHeaderCheck.h"
23template <
typename XprType,
typename EvaluatorKind>
24class inner_iterator_selector;
36template <
typename XprType>
39 typedef internal::inner_iterator_selector<XprType, typename internal::evaluator_traits<XprType>::Kind> IteratorType;
40 typedef internal::evaluator<XprType> EvaluatorType;
41 typedef typename internal::traits<XprType>::Scalar Scalar;
45 InnerIterator(
const XprType &xpr,
const Index &outerId) : 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++() {
56 EIGEN_STRONG_INLINE InnerIterator &operator+=(Index i) {
60 EIGEN_STRONG_INLINE InnerIterator operator+(Index i) {
61 InnerIterator result(*
this);
67 EIGEN_STRONG_INLINE Index index()
const {
return m_iter.index(); }
69 EIGEN_STRONG_INLINE Index row()
const {
return m_iter.row(); }
71 EIGEN_STRONG_INLINE Index col()
const {
return m_iter.col(); }
73 EIGEN_STRONG_INLINE
operator bool()
const {
return m_iter; }
84 InnerIterator(
const EigenBase<T> &, Index outer);
90template <
typename XprType>
91class inner_iterator_selector<XprType, IndexBased> {
93 typedef evaluator<XprType> EvaluatorType;
94 typedef typename traits<XprType>::Scalar Scalar;
98 EIGEN_STRONG_INLINE inner_iterator_selector(
const EvaluatorType &eval,
const Index &outerId,
const Index &innerSize)
99 : m_eval(eval), m_inner(0), m_outer(outerId), m_end(innerSize) {}
101 EIGEN_STRONG_INLINE Scalar value()
const {
102 return (IsRowMajor) ? m_eval.coeff(m_outer, m_inner) : m_eval.coeff(m_inner, m_outer);
105 EIGEN_STRONG_INLINE inner_iterator_selector &operator++() {
110 EIGEN_STRONG_INLINE Index index()
const {
return m_inner; }
111 inline Index row()
const {
return IsRowMajor ? m_outer : index(); }
112 inline Index col()
const {
return IsRowMajor ? index() : m_outer; }
114 EIGEN_STRONG_INLINE
operator bool()
const {
return m_inner < m_end && m_inner >= 0; }
117 const EvaluatorType &m_eval;
125template <
typename XprType>
126class inner_iterator_selector<XprType, IteratorBased> :
public evaluator<XprType>::InnerIterator {
128 typedef typename evaluator<XprType>::InnerIterator Base;
129 typedef evaluator<XprType> EvaluatorType;
132 EIGEN_STRONG_INLINE inner_iterator_selector(
const EvaluatorType &eval,
const Index &outerId,
134 : Base(eval, outerId) {}
const unsigned int RowMajorBit
Definition Constants.h:70
Namespace containing all symbols from the Eigen library.
Definition Core:137