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_STRIDE_H
00026 #define EIGEN_STRIDE_H
00027
00056 template<int _OuterStrideAtCompileTime, int _InnerStrideAtCompileTime>
00057 class Stride
00058 {
00059 public:
00060 typedef DenseIndex Index;
00061 enum {
00062 InnerStrideAtCompileTime = _InnerStrideAtCompileTime,
00063 OuterStrideAtCompileTime = _OuterStrideAtCompileTime
00064 };
00065
00067 Stride()
00068 : m_outer(OuterStrideAtCompileTime), m_inner(InnerStrideAtCompileTime)
00069 {
00070 eigen_assert(InnerStrideAtCompileTime != Dynamic && OuterStrideAtCompileTime != Dynamic);
00071 }
00072
00074 Stride(Index outerStride, Index innerStride)
00075 : m_outer(outerStride), m_inner(innerStride)
00076 {
00077 eigen_assert(innerStride>=0 && outerStride>=0);
00078 }
00079
00081 Stride(const Stride& other)
00082 : m_outer(other.outer()), m_inner(other.inner())
00083 {}
00084
00086 inline Index outer() const { return m_outer.value(); }
00088 inline Index inner() const { return m_inner.value(); }
00089
00090 protected:
00091 internal::variable_if_dynamic<Index, OuterStrideAtCompileTime> m_outer;
00092 internal::variable_if_dynamic<Index, InnerStrideAtCompileTime> m_inner;
00093 };
00094
00097 template<int Value = Dynamic>
00098 class InnerStride : public Stride<0, Value>
00099 {
00100 typedef Stride<0, Value> Base;
00101 public:
00102 typedef DenseIndex Index;
00103 InnerStride() : Base() {}
00104 InnerStride(Index v) : Base(0, v) {}
00105 };
00106
00109 template<int Value = Dynamic>
00110 class OuterStride : public Stride<Value, 0>
00111 {
00112 typedef Stride<Value, 0> Base;
00113 public:
00114 typedef DenseIndex Index;
00115 OuterStride() : Base() {}
00116 OuterStride(Index v) : Base(v,0) {}
00117 };
00118
00119 #endif // EIGEN_STRIDE_H