00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef EIGEN_COREITERATORS_H
00011 #define EIGEN_COREITERATORS_H
00012
00013 namespace Eigen {
00014
00015
00016
00017
00025
00026 template<typename Derived> class DenseBase<Derived>::InnerIterator
00027 {
00028 protected:
00029 typedef typename Derived::Scalar Scalar;
00030 typedef typename Derived::Index Index;
00031
00032 enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit };
00033 public:
00034 EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer)
00035 : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize())
00036 {}
00037
00038 EIGEN_STRONG_INLINE Scalar value() const
00039 {
00040 return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner)
00041 : m_expression.coeff(m_inner, m_outer);
00042 }
00043
00044 EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; }
00045
00046 EIGEN_STRONG_INLINE Index index() const { return m_inner; }
00047 inline Index row() const { return IsRowMajor ? m_outer : index(); }
00048 inline Index col() const { return IsRowMajor ? index() : m_outer; }
00049
00050 EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; }
00051
00052 protected:
00053 const Derived& m_expression;
00054 Index m_inner;
00055 const Index m_outer;
00056 const Index m_end;
00057 };
00058
00059 }
00060
00061 #endif // EIGEN_COREITERATORS_H