CoreIterators.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 //
00006 // This Source Code Form is subject to the terms of the Mozilla
00007 // Public License v. 2.0. If a copy of the MPL was not distributed
00008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00009 
00010 #ifndef EIGEN_COREITERATORS_H
00011 #define EIGEN_COREITERATORS_H
00012 
00013 namespace Eigen { 
00014 
00015 /* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core
00016  */
00017 
00025 // generic version for dense matrix and expressions
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 } // end namespace Eigen
00060 
00061 #endif // EIGEN_COREITERATORS_H


win_eigen
Author(s): Daniel Stonier
autogenerated on Wed Sep 16 2015 07:10:29