Stride.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) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>
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_STRIDE_H
00011 #define EIGEN_STRIDE_H
00012 
00013 namespace Eigen { 
00014 
00043 template<int _OuterStrideAtCompileTime, int _InnerStrideAtCompileTime>
00044 class Stride
00045 {
00046   public:
00047     typedef DenseIndex Index;
00048     enum {
00049       InnerStrideAtCompileTime = _InnerStrideAtCompileTime,
00050       OuterStrideAtCompileTime = _OuterStrideAtCompileTime
00051     };
00052 
00054     Stride()
00055       : m_outer(OuterStrideAtCompileTime), m_inner(InnerStrideAtCompileTime)
00056     {
00057       eigen_assert(InnerStrideAtCompileTime != Dynamic && OuterStrideAtCompileTime != Dynamic);
00058     }
00059 
00061     Stride(Index outerStride, Index innerStride)
00062       : m_outer(outerStride), m_inner(innerStride)
00063     {
00064       eigen_assert(innerStride>=0 && outerStride>=0);
00065     }
00066 
00068     Stride(const Stride& other)
00069       : m_outer(other.outer()), m_inner(other.inner())
00070     {}
00071 
00073     inline Index outer() const { return m_outer.value(); }
00075     inline Index inner() const { return m_inner.value(); }
00076 
00077   protected:
00078     internal::variable_if_dynamic<Index, OuterStrideAtCompileTime> m_outer;
00079     internal::variable_if_dynamic<Index, InnerStrideAtCompileTime> m_inner;
00080 };
00081 
00084 template<int Value = Dynamic>
00085 class InnerStride : public Stride<0, Value>
00086 {
00087     typedef Stride<0, Value> Base;
00088   public:
00089     typedef DenseIndex Index;
00090     InnerStride() : Base() {}
00091     InnerStride(Index v) : Base(0, v) {}
00092 };
00093 
00096 template<int Value = Dynamic>
00097 class OuterStride : public Stride<Value, 0>
00098 {
00099     typedef Stride<Value, 0> Base;
00100   public:
00101     typedef DenseIndex Index;
00102     OuterStride() : Base() {}
00103     OuterStride(Index v) : Base(v,0) {}
00104 };
00105 
00106 } // end namespace Eigen
00107 
00108 #endif // EIGEN_STRIDE_H


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:39:43