Medial Code Documentation
Loading...
Searching...
No Matches
Stride.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>
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_STRIDE_H
11#define EIGEN_STRIDE_H
12
13namespace Eigen {
14
43template<int _OuterStrideAtCompileTime, int _InnerStrideAtCompileTime>
44class Stride
45{
46 public:
47 typedef Eigen::Index Index;
48 enum {
49 InnerStrideAtCompileTime = _InnerStrideAtCompileTime,
50 OuterStrideAtCompileTime = _OuterStrideAtCompileTime
51 };
52
56 : m_outer(OuterStrideAtCompileTime), m_inner(InnerStrideAtCompileTime)
57 {
58 eigen_assert(InnerStrideAtCompileTime != Dynamic && OuterStrideAtCompileTime != Dynamic);
59 }
60
63 Stride(Index outerStride, Index innerStride)
64 : m_outer(outerStride), m_inner(innerStride)
65 {
66 eigen_assert(innerStride>=0 && outerStride>=0);
67 }
68
71 Stride(const Stride& other)
72 : m_outer(other.outer()), m_inner(other.inner())
73 {}
74
77 inline Index outer() const { return m_outer.value(); }
80 inline Index inner() const { return m_inner.value(); }
81
82 protected:
85};
86
89template<int Value>
90class InnerStride : public Stride<0, Value>
91{
92 typedef Stride<0, Value> Base;
93 public:
95 EIGEN_DEVICE_FUNC InnerStride(Index v) : Base(0, v) {} // FIXME making this explicit could break valid code
96};
97
100template<int Value>
101class OuterStride : public Stride<Value, 0>
102{
103 typedef Stride<Value, 0> Base;
104 public:
106 EIGEN_DEVICE_FUNC OuterStride(Index v) : Base(v,0) {} // FIXME making this explicit could break valid code
107};
108
109} // end namespace Eigen
110
111#endif // EIGEN_STRIDE_H
Convenience specialization of Stride to specify only an inner stride See class Map for some examples.
Definition Stride.h:91
Convenience specialization of Stride to specify only an outer stride See class Map for some examples.
Definition Stride.h:102
Pseudo expression representing a solving operation.
Definition Solve.h:63
Holds strides information for Map.
Definition Stride.h:45
EIGEN_DEVICE_FUNC Stride(const Stride &other)
Copy constructor.
Definition Stride.h:71
EIGEN_DEVICE_FUNC Index inner() const
Definition Stride.h:80
EIGEN_DEVICE_FUNC Index outer() const
Definition Stride.h:77
EIGEN_DEVICE_FUNC Stride()
Default constructor, for use when strides are fixed at compile time.
Definition Stride.h:55
Eigen::Index Index
Definition Stride.h:47
EIGEN_DEVICE_FUNC Stride(Index outerStride, Index innerStride)
Constructor allowing to pass the strides at runtime.
Definition Stride.h:63
Definition XprHelper.h:67