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;
89 template <
typename U,
typename V>
struct Tuple {
95 typedef V second_type;
97 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
98 Tuple() : first(), second() {}
100 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
101 Tuple(
const U& f,
const V& s) : first(f), second(s) {}
103 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
104 Tuple& operator= (
const Tuple& rhs) {
105 if (&rhs ==
this)
return *
this;
111 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
112 void swap(Tuple& rhs) {
114 swap(first, rhs.first);
115 swap(second, rhs.second);
119 template <
typename U,
typename V>
120 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
121 bool operator==(
const Tuple<U, V>& x,
const Tuple<U, V>& y) {
122 return (x.first == y.first && x.second == y.second);
125 template <
typename U,
typename V>
126 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
127 bool operator!=(
const Tuple<U, V>& x,
const Tuple<U, V>& y) {
133 template <
typename Idx>
struct IndexPair {
134 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE IndexPair() : first(0), second(0) {}
135 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE IndexPair(Idx f, Idx s) : first(f), second(s) {}
137 EIGEN_DEVICE_FUNC
void set(IndexPair<Idx> val) {
147 #ifdef EIGEN_HAS_SFINAE 150 template<
typename IndexType, Index... Is>
151 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
152 array<Index,
sizeof...(Is)> customIndices2Array(IndexType& idx, numeric_list<Index, Is...>) {
153 return { idx[Is]... };
155 template<
typename IndexType>
156 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
157 array<Index, 0> customIndices2Array(IndexType&, numeric_list<Index>) {
158 return array<Index, 0>();
162 template<
typename Index, std::
size_t NumIndices,
typename IndexType>
163 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
164 array<Index, NumIndices> customIndices2Array(IndexType& idx) {
165 return customIndices2Array(idx,
typename gen_numeric_list<Index, NumIndices>::type{});
169 template <
typename B,
typename D>
173 typedef char (&yes)[1];
174 typedef char (&no)[2];
176 template <
typename BB,
typename DD>
179 operator BB*()
const;
184 static yes check(D*, T);
185 static no check(B*,
int);
187 static const bool value =
sizeof(check(Host<B,D>(),
int())) ==
sizeof(yes);
197 #endif // EIGEN_CXX11_TENSOR_TENSOR_META_H Namespace containing all symbols from the Eigen library.
Definition: AdolcForward:45