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) {
27 template <
size_t n>
struct max_n_1 {
28 static const size_t size = n;
30 template <>
struct max_n_1<0> {
31 static const size_t size = 1;
36 template <
typename Scalar,
typename Device>
38 typedef typename internal::packet_traits<Scalar>::type type;
39 static const int size = internal::unpacket_traits<type>::size;
43 #if defined(EIGEN_USE_GPU) && defined(__CUDACC__)
45 struct PacketType<float, GpuDevice> {
47 static const int size = 4;
50 struct PacketType<double, GpuDevice> {
52 static const int size = 2;
59 template <
typename U,
typename V>
struct Tuple {
65 typedef V second_type;
67 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
68 Tuple() : first(), second() {}
70 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
71 Tuple(
const U& f,
const V& s) : first(f), second(s) {}
73 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
74 Tuple& operator= (
const Tuple& rhs) {
75 if (&rhs ==
this)
return *
this;
81 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
82 void swap(Tuple& rhs) {
84 swap(first, rhs.first);
85 swap(second, rhs.second);
89 template <
typename U,
typename V>
90 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
91 bool operator==(
const Tuple<U, V>& x,
const Tuple<U, V>& y) {
92 return (x.first == y.first && x.second == y.second);
95 template <
typename U,
typename V>
96 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
97 bool operator!=(
const Tuple<U, V>& x,
const Tuple<U, V>& y) {
103 #ifdef EIGEN_HAS_SFINAE
106 template<
typename IndexType, Index... Is>
107 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
108 array<Index,
sizeof...(Is)> customIndices2Array(IndexType& idx, numeric_list<Index, Is...>) {
109 return { idx[Is]... };
113 template<
typename Index, std::
size_t NumIndices,
typename IndexType>
114 EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
115 array<Index, NumIndices> customIndices2Array(IndexType& idx) {
116 return customIndices2Array(idx,
typename gen_numeric_list<Index, NumIndices>::type{});
120 template <
typename B,
typename D>
124 typedef char (&yes)[1];
125 typedef char (&no)[2];
127 template <
typename BB,
typename DD>
130 operator BB*()
const;
135 static yes check(D*, T);
136 static no check(B*,
int);
138 static const bool value =
sizeof(check(Host<B,D>(),
int())) ==
sizeof(yes);
148 #endif // EIGEN_CXX11_TENSOR_TENSOR_META_H
Namespace containing all symbols from the Eigen library.
Definition: CXX11Meta.h:13