Eigen  3.4.90 (git rev 5a9f66fb35d03a4da9ef8976e67a61b30aa16dcf)
 
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 <[email protected]>
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
13// IWYU pragma: private
14#include "./InternalHeaderCheck.h"
15
16namespace Eigen {
17
54template <int OuterStrideAtCompileTime_, int InnerStrideAtCompileTime_>
55class Stride {
56 public:
58 enum { InnerStrideAtCompileTime = InnerStrideAtCompileTime_, OuterStrideAtCompileTime = OuterStrideAtCompileTime_ };
59
61 EIGEN_DEVICE_FUNC Stride() : m_outer(OuterStrideAtCompileTime), m_inner(InnerStrideAtCompileTime) {
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 Stride(Index outerStride, Index innerStride) : m_outer(outerStride), m_inner(innerStride) {}
69
71 EIGEN_DEVICE_FUNC Stride(const Stride& other) : m_outer(other.outer()), m_inner(other.inner()) {}
72
74 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outer() const { return m_outer.value(); }
76 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index inner() const { return m_inner.value(); }
77
78 protected:
79 internal::variable_if_dynamic<Index, OuterStrideAtCompileTime> m_outer;
80 internal::variable_if_dynamic<Index, InnerStrideAtCompileTime> m_inner;
81};
82
85template <int Value>
86class InnerStride : public Stride<0, Value> {
87 typedef Stride<0, Value> Base;
88
89 public:
90 EIGEN_DEVICE_FUNC InnerStride() : Base() {}
91 EIGEN_DEVICE_FUNC InnerStride(Index v) : Base(0, v) {} // FIXME making this explicit could break valid code
92};
93
96template <int Value>
97class OuterStride : public Stride<Value, 0> {
98 typedef Stride<Value, 0> Base;
99
100 public:
101 EIGEN_DEVICE_FUNC OuterStride() : Base() {}
102 EIGEN_DEVICE_FUNC OuterStride(Index v) : Base(v, 0) {} // FIXME making this explicit could break valid code
103};
104
105} // end namespace Eigen
106
107#endif // EIGEN_STRIDE_H
Convenience specialization of Stride to specify only an inner stride See class Map for some examples.
Definition Stride.h:86
Convenience specialization of Stride to specify only an outer stride See class Map for some examples.
Definition Stride.h:97
Holds strides information for Map.
Definition Stride.h:55
EIGEN_CONSTEXPR Index inner() const
Definition Stride.h:76
Stride(const Stride &other)
Definition Stride.h:71
EIGEN_CONSTEXPR Index outer() const
Definition Stride.h:74
Stride()
Definition Stride.h:61
Eigen::Index Index
Definition Stride.h:57
Stride(Index outerStride, Index innerStride)
Definition Stride.h:68
Namespace containing all symbols from the Eigen library.
Definition Core:137
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:83
const int Dynamic
Definition Constants.h:25