$darkmode
Eigen-unsupported  5.0.1-dev
TensorDimensionList.h
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 // IWYU pragma: private
14 #include "./InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 
26 template <typename Index, std::size_t Rank>
27 struct DimensionList {
28  EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE const Index operator[](const Index i) const { return i; }
29 };
30 
31 namespace internal {
32 
33 template <typename Index, std::size_t Rank>
34 struct array_size<DimensionList<Index, Rank> > {
35  static const size_t value = Rank;
36 };
37 template <typename Index, std::size_t Rank>
38 struct array_size<const DimensionList<Index, Rank> > {
39  static const size_t value = Rank;
40 };
41 
42 template <DenseIndex n, typename Index, std::size_t Rank>
43 const Index array_get(DimensionList<Index, Rank>&) {
44  return n;
45 }
46 template <DenseIndex n, typename Index, std::size_t Rank>
47 const Index array_get(const DimensionList<Index, Rank>&) {
48  return n;
49 }
50 
51 template <typename Index, std::size_t Rank>
52 struct index_known_statically_impl<DimensionList<Index, Rank> > {
53  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex) { return true; }
54 };
55 template <typename Index, std::size_t Rank>
56 struct index_known_statically_impl<const DimensionList<Index, Rank> > {
57  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex) { return true; }
58 };
59 
60 template <typename Index, std::size_t Rank>
61 struct all_indices_known_statically_impl<DimensionList<Index, Rank> > {
62  EIGEN_DEVICE_FUNC static constexpr bool run() { return true; }
63 };
64 template <typename Index, std::size_t Rank>
65 struct all_indices_known_statically_impl<const DimensionList<Index, Rank> > {
66  EIGEN_DEVICE_FUNC static constexpr bool run() { return true; }
67 };
68 
69 template <typename Index, std::size_t Rank>
70 struct indices_statically_known_to_increase_impl<DimensionList<Index, Rank> > {
71  EIGEN_DEVICE_FUNC static constexpr bool run() { return true; }
72 };
73 template <typename Index, std::size_t Rank>
74 struct indices_statically_known_to_increase_impl<const DimensionList<Index, Rank> > {
75  EIGEN_DEVICE_FUNC static constexpr bool run() { return true; }
76 };
77 
78 template <typename Index, std::size_t Rank>
79 struct index_statically_eq_impl<DimensionList<Index, Rank> > {
80  static constexpr bool run(const DenseIndex i, const DenseIndex value) { return i == value; }
81 };
82 template <typename Index, std::size_t Rank>
83 struct index_statically_eq_impl<const DimensionList<Index, Rank> > {
84  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex i, const DenseIndex value) { return i == value; }
85 };
86 
87 template <typename Index, std::size_t Rank>
88 struct index_statically_ne_impl<DimensionList<Index, Rank> > {
89  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex i, const DenseIndex value) { return i != value; }
90 };
91 template <typename Index, std::size_t Rank>
92 struct index_statically_ne_impl<const DimensionList<Index, Rank> > {
93  static constexpr bool run(const DenseIndex i, const DenseIndex value) { return i != value; }
94 };
95 
96 template <typename Index, std::size_t Rank>
97 struct index_statically_gt_impl<DimensionList<Index, Rank> > {
98  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex i, const DenseIndex value) { return i > value; }
99 };
100 template <typename Index, std::size_t Rank>
101 struct index_statically_gt_impl<const DimensionList<Index, Rank> > {
102  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex i, const DenseIndex value) { return i > value; }
103 };
104 
105 template <typename Index, std::size_t Rank>
106 struct index_statically_lt_impl<DimensionList<Index, Rank> > {
107  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex i, const DenseIndex value) { return i < value; }
108 };
109 template <typename Index, std::size_t Rank>
110 struct index_statically_lt_impl<const DimensionList<Index, Rank> > {
111  EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex i, const DenseIndex value) { return i < value; }
112 };
113 
114 } // end namespace internal
115 } // end namespace Eigen
116 
117 #endif // EIGEN_CXX11_TENSOR_TENSOR_DIMENSION_LIST_H
Namespace containing all symbols from the Eigen library.
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index