TensorDimensionList.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2015 Benoit Steiner <benoit.steiner.goog@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_CXX11_TENSOR_TENSOR_DIMENSION_LIST_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_DIMENSION_LIST_H
12 
13 namespace Eigen {
14 
25 template <typename Index, std::size_t Rank> struct DimensionList {
26  EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
27  const Index operator[] (const Index i) const { return i; }
28 };
29 
30 namespace internal {
31 
32 template<typename Index, std::size_t Rank> struct array_size<DimensionList<Index, Rank> > {
33  static const size_t value = Rank;
34 };
35 template<typename Index, std::size_t Rank> struct array_size<const DimensionList<Index, Rank> > {
36  static const size_t value = Rank;
37 };
38 
39 template<DenseIndex n, typename Index, std::size_t Rank> const Index array_get(DimensionList<Index, Rank>&) {
40  return n;
41 }
42 template<DenseIndex n, typename Index, std::size_t Rank> const Index array_get(const DimensionList<Index, Rank>&) {
43  return n;
44 }
45 
46 
47 #if EIGEN_HAS_CONSTEXPR
48 template <typename Index, std::size_t Rank>
49 struct index_known_statically_impl<DimensionList<Index, Rank> > {
50  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex) {
51  return true;
52  }
53 };
54 template <typename Index, std::size_t Rank>
55 struct index_known_statically_impl<const DimensionList<Index, Rank> > {
56  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex) {
57  return true;
58  }
59 };
60 
61 template <typename Index, std::size_t Rank>
62 struct all_indices_known_statically_impl<DimensionList<Index, Rank> > {
63  EIGEN_DEVICE_FUNC static constexpr bool run() {
64  return true;
65  }
66 };
67 template <typename Index, std::size_t Rank>
68 struct all_indices_known_statically_impl<const DimensionList<Index, Rank> > {
69  EIGEN_DEVICE_FUNC static constexpr bool run() {
70  return true;
71  }
72 };
73 
74 template <typename Index, std::size_t Rank>
75 struct indices_statically_known_to_increase_impl<DimensionList<Index, Rank> > {
76  EIGEN_DEVICE_FUNC static constexpr bool run() {
77  return true;
78  }
79 };
80 template <typename Index, std::size_t Rank>
81 struct indices_statically_known_to_increase_impl<const DimensionList<Index, Rank> > {
82  EIGEN_DEVICE_FUNC static constexpr bool run() {
83  return true;
84  }
85 };
86 
87 template <typename Index, std::size_t Rank>
88 struct index_statically_eq_impl<DimensionList<Index, Rank> > {
89  static constexpr bool run(const DenseIndex i, const DenseIndex value) {
90  return i == value;
91  }
92 };
93 template <typename Index, std::size_t Rank>
94 struct index_statically_eq_impl<const DimensionList<Index, Rank> > {
95  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex i, const DenseIndex value) {
96  return i == value;
97  }
98 };
99 
100 template <typename Index, std::size_t Rank>
101 struct index_statically_ne_impl<DimensionList<Index, Rank> > {
102  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex i, const DenseIndex value) {
103  return i != value;
104  }
105 };
106 template <typename Index, std::size_t Rank>
107 struct index_statically_ne_impl<const DimensionList<Index, Rank> > {
108  static constexpr bool run(const DenseIndex i, const DenseIndex value) {
109  return i != value;
110  }
111 };
112 
113 template <typename Index, std::size_t Rank>
114 struct index_statically_gt_impl<DimensionList<Index, Rank> > {
115  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex i, const DenseIndex value) {
116  return i > value;
117  }
118 };
119 template <typename Index, std::size_t Rank>
120 struct index_statically_gt_impl<const DimensionList<Index, Rank> > {
121  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex i, const DenseIndex value) {
122  return i > value;
123  }
124 };
125 
126 template <typename Index, std::size_t Rank>
127 struct index_statically_lt_impl<DimensionList<Index, Rank> > {
128  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex i, const DenseIndex value) {
129  return i < value;
130  }
131 };
132 template <typename Index, std::size_t Rank>
133 struct index_statically_lt_impl<const DimensionList<Index, Rank> > {
134  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex i, const DenseIndex value) {
135  return i < value;
136  }
137 };
138 
139 #else
140 template <typename Index, std::size_t Rank>
141 struct index_known_statically_impl<DimensionList<Index, Rank> > {
142  EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE bool run(const DenseIndex) {
143  return true;
144  }
145 };
146 template <typename Index, std::size_t Rank>
147 struct index_known_statically_impl<const DimensionList<Index, Rank> > {
148  EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE bool run(const DenseIndex) {
149  return true;
150  }
151 };
152 
153 template <typename Index, std::size_t Rank>
154 struct all_indices_known_statically_impl<DimensionList<Index, Rank> > {
155  EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE bool run() {
156  return true;
157  }
158 };
159 template <typename Index, std::size_t Rank>
160 struct all_indices_known_statically_impl<const DimensionList<Index, Rank> > {
161  EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE bool run() {
162  return true;
163  }
164 };
165 
166 template <typename Index, std::size_t Rank>
167 struct indices_statically_known_to_increase_impl<DimensionList<Index, Rank> > {
168  static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run() {
169  return true;
170  }
171 };
172 template <typename Index, std::size_t Rank>
173 struct indices_statically_known_to_increase_impl<const DimensionList<Index, Rank> > {
174  static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run() {
175  return true;
176  }
177 };
178 
179 template <typename Index, std::size_t Rank>
180 struct index_statically_eq_impl<DimensionList<Index, Rank> > {
181  static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
182  return false;
183  }
184 };
185 template <typename Index, std::size_t Rank>
186 struct index_statically_eq_impl<const DimensionList<Index, Rank> > {
187  static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
188  return false;
189  }
190 };
191 
192 template <typename Index, std::size_t Rank>
193 struct index_statically_ne_impl<DimensionList<Index, Rank> > {
194  static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex){
195  return false;
196  }
197 };
198 template <typename Index, std::size_t Rank>
199 struct index_statically_ne_impl<const DimensionList<Index, Rank> > {
200  static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
201  return false;
202  }
203 };
204 
205 template <typename Index, std::size_t Rank>
206 struct index_statically_gt_impl<DimensionList<Index, Rank> > {
207  static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
208  return false;
209  }
210 };
211 template <typename Index, std::size_t Rank>
212 struct index_statically_gt_impl<const DimensionList<Index, Rank> > {
213  static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
214  return false;
215  }
216 };
217 
218 template <typename Index, std::size_t Rank>
219 struct index_statically_lt_impl<DimensionList<Index, Rank> > {
220  static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
221  return false;
222  }
223 };
224 template <typename Index, std::size_t Rank>
225 struct index_statically_lt_impl<const DimensionList<Index, Rank> > {
226  static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
227  return false;
228  }
229 };
230 #endif
231 
232 } // end namespace internal
233 } // end namespace Eigen
234 
235 
236 #endif // EIGEN_CXX11_TENSOR_TENSOR_DIMENSION_LIST_H
#define EIGEN_ALWAYS_INLINE
Definition: Macros.h:507
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex)
Definition: LDLT.h:16
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
const Index array_get(const DimensionList< Index, Rank > &)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE const Index operator[](const Index i) const
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
Definition: Meta.h:25
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
void run(Expr &expr, Dev &dev)
Definition: TensorSyclRun.h:33
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex)


hebiros
Author(s): Xavier Artache , Matthew Tesch
autogenerated on Thu Sep 3 2020 04:09:16