Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
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 }
00107
00108 #endif // EIGEN_STRIDE_H