Please, help us to better know about our user community by answering the following short survey: https://forms.gle/wpyrxWi18ox9Z5ae9
Eigen  3.4.0
 
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
47template<int _OuterStrideAtCompileTime, int _InnerStrideAtCompileTime>
48class Stride
49{
50 public:
52 enum {
53 InnerStrideAtCompileTime = _InnerStrideAtCompileTime,
54 OuterStrideAtCompileTime = _OuterStrideAtCompileTime
55 };
56
58 EIGEN_DEVICE_FUNC
60 : m_outer(OuterStrideAtCompileTime), m_inner(InnerStrideAtCompileTime)
61 {
62 // FIXME: for Eigen 4 we should use DynamicIndex instead of Dynamic.
63 // FIXME: for Eigen 4 we should also unify this API with fix<>
64 eigen_assert(InnerStrideAtCompileTime != Dynamic && OuterStrideAtCompileTime != Dynamic);
65 }
66
68 EIGEN_DEVICE_FUNC
69 Stride(Index outerStride, Index innerStride)
70 : m_outer(outerStride), m_inner(innerStride)
71 {
72 }
73
75 EIGEN_DEVICE_FUNC
76 Stride(const Stride& other)
77 : m_outer(other.outer()), m_inner(other.inner())
78 {}
79
81 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
82 inline Index outer() const { return m_outer.value(); }
84 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
85 inline Index inner() const { return m_inner.value(); }
86
87 protected:
88 internal::variable_if_dynamic<Index, OuterStrideAtCompileTime> m_outer;
89 internal::variable_if_dynamic<Index, InnerStrideAtCompileTime> m_inner;
90};
91
94template<int Value>
95class InnerStride : public Stride<0, Value>
96{
97 typedef Stride<0, Value> Base;
98 public:
99 EIGEN_DEVICE_FUNC InnerStride() : Base() {}
100 EIGEN_DEVICE_FUNC InnerStride(Index v) : Base(0, v) {} // FIXME making this explicit could break valid code
101};
102
105template<int Value>
106class OuterStride : public Stride<Value, 0>
107{
108 typedef Stride<Value, 0> Base;
109 public:
110 EIGEN_DEVICE_FUNC OuterStride() : Base() {}
111 EIGEN_DEVICE_FUNC OuterStride(Index v) : Base(v,0) {} // FIXME making this explicit could break valid code
112};
113
114} // end namespace Eigen
115
116#endif // EIGEN_STRIDE_H
Convenience specialization of Stride to specify only an inner stride See class Map for some examples.
Definition: Stride.h:96
Convenience specialization of Stride to specify only an outer stride See class Map for some examples.
Definition: Stride.h:107
Holds strides information for Map.
Definition: Stride.h:49
EIGEN_CONSTEXPR Index outer() const
Definition: Stride.h:82
Stride(Index outerStride, Index innerStride)
Definition: Stride.h:69
Eigen::Index Index
Definition: Stride.h:51
Stride(const Stride &other)
Definition: Stride.h:76
EIGEN_CONSTEXPR Index inner() const
Definition: Stride.h:85
Stride()
Definition: Stride.h:59
Namespace containing all symbols from the Eigen library.
Definition: Core:141
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
const int Dynamic
Definition: Constants.h:22