CoreIterators.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_COREITERATORS_H
11 #define EIGEN_COREITERATORS_H
12 
13 namespace Eigen {
14 
15 /* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core
16  */
17 
25 // generic version for dense matrix and expressions
26 template<typename Derived> class DenseBase<Derived>::InnerIterator
27 {
28  protected:
29  typedef typename Derived::Scalar Scalar;
30  typedef typename Derived::Index Index;
31 
32  enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit };
33  public:
34  EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer)
35  : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize())
36  {}
37 
38  EIGEN_STRONG_INLINE Scalar value() const
39  {
40  return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner)
41  : m_expression.coeff(m_inner, m_outer);
42  }
43 
44  EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; }
45 
46  EIGEN_STRONG_INLINE Index index() const { return m_inner; }
47  inline Index row() const { return IsRowMajor ? m_outer : index(); }
48  inline Index col() const { return IsRowMajor ? index() : m_outer; }
49 
50  EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; }
51 
52  protected:
53  const Derived& m_expression;
54  Index m_inner;
55  const Index m_outer;
56  const Index m_end;
57 };
58 
59 } // end namespace Eigen
60 
61 #endif // EIGEN_COREITERATORS_H
#define EIGEN_STRONG_INLINE
EIGEN_STRONG_INLINE Index index() const
Definition: CoreIterators.h:46
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: matrix.hpp:471
const unsigned int RowMajorBit
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:41
EIGEN_STRONG_INLINE InnerIterator(const Derived &expr, Index outer)
Definition: CoreIterators.h:34
Index innerSize() const
Definition: DenseBase.h:207
EIGEN_STRONG_INLINE Scalar value() const
Definition: CoreIterators.h:38
EIGEN_STRONG_INLINE InnerIterator & operator++()
Definition: CoreIterators.h:44


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:31