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 {
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>
143  return true;
144  }
145 };
146 template <typename Index, std::size_t Rank>
149  return true;
150  }
151 };
152 
153 template <typename Index, std::size_t Rank>
156  return true;
157  }
158 };
159 template <typename Index, std::size_t Rank>
162  return true;
163  }
164 };
165 
166 template <typename Index, std::size_t Rank>
169  return true;
170  }
171 };
172 template <typename Index, std::size_t Rank>
175  return true;
176  }
177 };
178 
179 template <typename Index, std::size_t Rank>
182  return false;
183  }
184 };
185 template <typename Index, std::size_t Rank>
188  return false;
189  }
190 };
191 
192 template <typename Index, std::size_t Rank>
195  return false;
196  }
197 };
198 template <typename Index, std::size_t Rank>
201  return false;
202  }
203 };
204 
205 template <typename Index, std::size_t Rank>
208  return false;
209  }
210 };
211 template <typename Index, std::size_t Rank>
214  return false;
215  }
216 };
217 
218 template <typename Index, std::size_t Rank>
221  return false;
222  }
223 };
224 template <typename Index, std::size_t Rank>
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
Eigen::internal::indices_statically_known_to_increase_impl< DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run()
Definition: TensorDimensionList.h:168
Eigen::internal::all_indices_known_statically_impl< DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run()
Definition: TensorDimensionList.h:155
Eigen::internal::array_size::value
@ value
Definition: Meta.h:446
EIGEN_DEVICE_FUNC
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Eigen::internal::index_statically_eq_impl< const DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
Definition: TensorDimensionList.h:187
Eigen::internal::index_statically_gt_impl< const DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
Definition: TensorDimensionList.h:213
Eigen::internal::index_statically_ne_impl
Definition: TensorIndexList.h:645
Eigen::internal::index_statically_lt_impl
Definition: TensorIndexList.h:659
Eigen::internal::index_statically_eq_impl< DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
Definition: TensorDimensionList.h:181
Eigen::internal::all_indices_known_statically_impl::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run()
Definition: TensorIndexList.h:625
Eigen::internal::index_statically_gt_impl< DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
Definition: TensorDimensionList.h:207
Eigen::internal::index_statically_ne_impl< DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
Definition: TensorDimensionList.h:194
Eigen::internal::index_known_statically_impl< DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex)
Definition: TensorDimensionList.h:142
Eigen::internal::all_indices_known_statically_impl
Definition: TensorIndexList.h:624
Eigen::internal::index_known_statically_impl< const DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex)
Definition: TensorDimensionList.h:148
Eigen::internal::indices_statically_known_to_increase_impl
Definition: TensorIndexList.h:631
Eigen::internal::array_get
const Index array_get(DimensionList< Index, Rank > &)
Definition: TensorDimensionList.h:39
Eigen::internal::index_statically_eq_impl::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(Index, Index)
Definition: TensorIndexList.h:639
n
int n
Definition: BiCGSTAB_simple.cpp:1
Eigen::DimensionList
Definition: TensorDimensionList.h:25
Eigen::internal::index_statically_lt_impl::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(Index, Index)
Definition: TensorIndexList.h:660
Eigen::internal::all_indices_known_statically_impl< const DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run()
Definition: TensorDimensionList.h:161
Eigen::internal::index_statically_gt_impl
Definition: TensorIndexList.h:652
EIGEN_ALWAYS_INLINE
#define EIGEN_ALWAYS_INLINE
Definition: Macros.h:932
Eigen::internal::array_size
Definition: Meta.h:445
Eigen::internal::index_statically_ne_impl::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(Index, Index)
Definition: TensorIndexList.h:646
Eigen::DimensionList::operator[]
EIGEN_DEVICE_FUNC const EIGEN_ALWAYS_INLINE Index operator[](const Index i) const
Definition: TensorDimensionList.h:27
Eigen::internal::index_statically_gt_impl::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(Index, Index)
Definition: TensorIndexList.h:653
Eigen::internal::index_statically_lt_impl< DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
Definition: TensorDimensionList.h:220
Eigen::DenseIndex
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
Definition: Meta.h:66
Eigen::internal::index_statically_eq_impl
Definition: TensorIndexList.h:638
Eigen::internal::index_known_statically_impl::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const Index)
Definition: TensorIndexList.h:618
Eigen::internal::index_statically_lt_impl< const DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
Definition: TensorDimensionList.h:226
Eigen::internal::indices_statically_known_to_increase_impl::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run()
Definition: TensorIndexList.h:632
Eigen::internal::index_statically_ne_impl< const DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex)
Definition: TensorDimensionList.h:200
internal
Definition: BandTriangularSolver.h:13
test_callbacks.value
value
Definition: test_callbacks.py:160
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Eigen::internal::index_known_statically_impl
Definition: TensorIndexList.h:617
Eigen::Index
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Eigen::internal::indices_statically_known_to_increase_impl< const DimensionList< Index, Rank > >::run
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run()
Definition: TensorDimensionList.h:174


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:37:32