Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef EIGEN_COREITERATORS_H
00026 #define EIGEN_COREITERATORS_H
00027
00028 namespace Eigen {
00029
00030
00031
00032
00040
00041 template<typename Derived> class DenseBase<Derived>::InnerIterator
00042 {
00043 protected:
00044 typedef typename Derived::Scalar Scalar;
00045 typedef typename Derived::Index Index;
00046
00047 enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit };
00048 public:
00049 EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer)
00050 : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize())
00051 {}
00052
00053 EIGEN_STRONG_INLINE Scalar value() const
00054 {
00055 return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner)
00056 : m_expression.coeff(m_inner, m_outer);
00057 }
00058
00059 EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; }
00060
00061 EIGEN_STRONG_INLINE Index index() const { return m_inner; }
00062 inline Index row() const { return IsRowMajor ? m_outer : index(); }
00063 inline Index col() const { return IsRowMajor ? index() : m_outer; }
00064
00065 EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; }
00066
00067 protected:
00068 const Derived& m_expression;
00069 Index m_inner;
00070 const Index m_outer;
00071 const Index m_end;
00072 };
00073
00074 }
00075
00076 #endif // EIGEN_COREITERATORS_H