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
51template<int _OuterStrideAtCompileTime, int _InnerStrideAtCompileTime>
52class Stride
53{
54 public:
56 enum {
57 InnerStrideAtCompileTime = _InnerStrideAtCompileTime,
58 OuterStrideAtCompileTime = _OuterStrideAtCompileTime
59 };
60
62 EIGEN_DEVICE_FUNC
64 : m_outer(OuterStrideAtCompileTime), m_inner(InnerStrideAtCompileTime)
65 {
66 // FIXME: for Eigen 4 we should use DynamicIndex instead of Dynamic.
67 // FIXME: for Eigen 4 we should also unify this API with fix<>
68 eigen_assert(InnerStrideAtCompileTime != Dynamic && OuterStrideAtCompileTime != Dynamic);
69 }
70
72 EIGEN_DEVICE_FUNC
73 Stride(Index outerStride, Index innerStride)
74 : m_outer(outerStride), m_inner(innerStride)
75 {
76 }
77
79 EIGEN_DEVICE_FUNC
80 Stride(const Stride& other)
81 : m_outer(other.outer()), m_inner(other.inner())
82 {}
83
85 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
86 inline Index outer() const { return m_outer.value(); }
88 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
89 inline Index inner() const { return m_inner.value(); }
90
91 protected:
94};
95
98template<int Value>
99class InnerStride : public Stride<0, Value>
100{
101 typedef Stride<0, Value> Base;
102 public:
103 EIGEN_DEVICE_FUNC InnerStride() : Base() {}
104 EIGEN_DEVICE_FUNC InnerStride(Index v) : Base(0, v) {} // FIXME making this explicit could break valid code
105};
106
109template<int Value>
110class OuterStride : public Stride<Value, 0>
111{
112 typedef Stride<Value, 0> Base;
113 public:
114 EIGEN_DEVICE_FUNC OuterStride() : Base() {}
115 EIGEN_DEVICE_FUNC OuterStride(Index v) : Base(v,0) {} // FIXME making this explicit could break valid code
116};
117
118} // end namespace Eigen
119
120#endif // EIGEN_STRIDE_H
Convenience specialization of Stride to specify only an inner stride See class Map for some examples.
Definition Stride.h:100
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
Convenience specialization of Stride to specify only an outer stride See class Map for some examples.
Definition Stride.h:111
Holds strides information for Map.
Definition Stride.h:53
EIGEN_DEVICE_FUNC Stride(const Stride &other)
Copy constructor.
Definition Stride.h:80
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index inner() const
Definition Stride.h:89
EIGEN_DEVICE_FUNC Stride()
Default constructor, for use when strides are fixed at compile time.
Definition Stride.h:63
Eigen::Index Index
Definition Stride.h:55
EIGEN_DEVICE_FUNC Stride(Index outerStride, Index innerStride)
Constructor allowing to pass the strides at runtime.
Definition Stride.h:73
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outer() const
Definition Stride.h:86
Definition XprHelper.h:130
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition Constants.h:22