Eigen-unsupported  5.0.1-dev+284dcc12
 
Loading...
Searching...
No Matches
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
16namespace Eigen {
17
26template <typename Index, std::size_t Rank>
27struct DimensionList {
28 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE const Index operator[](const Index i) const { return i; }
29};
30
31namespace internal {
32
33template <typename Index, std::size_t Rank>
34struct array_size<DimensionList<Index, Rank> > {
35 static const size_t value = Rank;
36};
37template <typename Index, std::size_t Rank>
38struct array_size<const DimensionList<Index, Rank> > {
39 static const size_t value = Rank;
40};
41
42template <DenseIndex n, typename Index, std::size_t Rank>
43const Index array_get(DimensionList<Index, Rank>&) {
44 return n;
45}
46template <DenseIndex n, typename Index, std::size_t Rank>
47const Index array_get(const DimensionList<Index, Rank>&) {
48 return n;
49}
50
51template <typename Index, std::size_t Rank>
52struct index_known_statically_impl<DimensionList<Index, Rank> > {
53 EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex) { return true; }
54};
55template <typename Index, std::size_t Rank>
56struct index_known_statically_impl<const DimensionList<Index, Rank> > {
57 EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex) { return true; }
58};
59
60template <typename Index, std::size_t Rank>
61struct all_indices_known_statically_impl<DimensionList<Index, Rank> > {
62 EIGEN_DEVICE_FUNC static constexpr bool run() { return true; }
63};
64template <typename Index, std::size_t Rank>
65struct all_indices_known_statically_impl<const DimensionList<Index, Rank> > {
66 EIGEN_DEVICE_FUNC static constexpr bool run() { return true; }
67};
68
69template <typename Index, std::size_t Rank>
70struct indices_statically_known_to_increase_impl<DimensionList<Index, Rank> > {
71 EIGEN_DEVICE_FUNC static constexpr bool run() { return true; }
72};
73template <typename Index, std::size_t Rank>
74struct indices_statically_known_to_increase_impl<const DimensionList<Index, Rank> > {
75 EIGEN_DEVICE_FUNC static constexpr bool run() { return true; }
76};
77
78template <typename Index, std::size_t Rank>
79struct index_statically_eq_impl<DimensionList<Index, Rank> > {
80 static constexpr bool run(const DenseIndex i, const DenseIndex value) { return i == value; }
81};
82template <typename Index, std::size_t Rank>
83struct 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
87template <typename Index, std::size_t Rank>
88struct 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};
91template <typename Index, std::size_t Rank>
92struct index_statically_ne_impl<const DimensionList<Index, Rank> > {
93 static constexpr bool run(const DenseIndex i, const DenseIndex value) { return i != value; }
94};
95
96template <typename Index, std::size_t Rank>
97struct 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};
100template <typename Index, std::size_t Rank>
101struct 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
105template <typename Index, std::size_t Rank>
106struct 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};
109template <typename Index, std::size_t Rank>
110struct 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