10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_META_H 11 #define EIGEN_CXX11_TENSOR_TENSOR_META_H 15 template<
bool cond>
struct Cond {};
17 template<
typename T1,
typename T2> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
18 const T1& choose(Cond<true>,
const T1& first,
const T2&) {
22 template<
typename T1,
typename T2> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
23 const T2& choose(Cond<false>,
const T1&,
const T2& second) {
28 template <
typename T,
typename X,
typename Y>
29 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
30 T divup(
const X x,
const Y y) {
31 return static_cast<T
>((x + y - 1) / y);
35 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
36 T divup(
const T x,
const T y) {
37 return static_cast<T
>((x + y - 1) / y);
40 template <
size_t n>
struct max_n_1 {
41 static const size_t size = n;
43 template <>
struct max_n_1<0> {
44 static const size_t size = 1;
49 template <
typename Scalar,
typename Device>
50 struct PacketType : internal::packet_traits<Scalar> {
51 typedef typename internal::packet_traits<Scalar>::type type;
55 #if defined(EIGEN_USE_GPU) && defined(__CUDACC__) && defined(EIGEN_HAS_CUDA_FP16) 57 struct PacketType<half, GpuDevice> {
59 static const int size = 2;
86 #if defined(EIGEN_USE_SYCL) 88 struct PacketType<T, SyclDevice> {
90 static const int size = 1;
110 template <
typename U,
typename V>
struct Tuple {
115 typedef U first_type;
116 typedef V second_type;
118 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
119 Tuple() : first(), second() {}
121 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
122 Tuple(
const U& f,
const V& s) : first(f), second(s) {}
124 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
125 Tuple& operator= (
const Tuple& rhs) {
126 if (&rhs ==
this)
return *
this;
132 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
133 void swap(Tuple& rhs) {
135 swap(first, rhs.first);
136 swap(second, rhs.second);
140 template <
typename U,
typename V>
141 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
142 bool operator==(
const Tuple<U, V>& x,
const Tuple<U, V>& y) {
143 return (x.first == y.first && x.second == y.second);
146 template <
typename U,
typename V>
147 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
148 bool operator!=(
const Tuple<U, V>& x,
const Tuple<U, V>& y) {
154 template <
typename Idx>
struct IndexPair {
155 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE IndexPair() : first(0), second(0) {}
156 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE IndexPair(Idx f, Idx s) : first(f), second(s) {}
158 EIGEN_DEVICE_FUNC
void set(IndexPair<Idx> val) {
168 #ifdef EIGEN_HAS_SFINAE 171 template<
typename IndexType, Index... Is>
172 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
173 array<Index,
sizeof...(Is)> customIndices2Array(IndexType& idx, numeric_list<Index, Is...>) {
174 return { idx[Is]... };
176 template<
typename IndexType>
177 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
178 array<Index, 0> customIndices2Array(IndexType&, numeric_list<Index>) {
179 return array<Index, 0>();
183 template<
typename Index, std::
size_t NumIndices,
typename IndexType>
184 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
185 array<Index, NumIndices> customIndices2Array(IndexType& idx) {
186 return customIndices2Array(idx,
typename gen_numeric_list<Index, NumIndices>::type{});
190 template <
typename B,
typename D>
194 typedef char (&yes)[1];
195 typedef char (&no)[2];
197 template <
typename BB,
typename DD>
200 operator BB*()
const;
205 static yes check(D*, T);
206 static no check(B*,
int);
208 static const bool value =
sizeof(check(Host<B,D>(),
int())) ==
sizeof(yes);
218 #endif // EIGEN_CXX11_TENSOR_TENSOR_META_H Namespace containing all symbols from the Eigen library.
Definition: AdolcForward:45