10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_TRAITS_H 11 #define EIGEN_CXX11_TENSOR_TENSOR_TRAITS_H 17 template<
typename Scalar,
int Options>
18 class compute_tensor_flags
21 is_dynamic_size_storage = 1,
26 #if EIGEN_MAX_STATIC_ALIGN_BYTES>0 27 (!is_dynamic_size_storage)
32 #
if EIGEN_MAX_ALIGN_BYTES>0
33 is_dynamic_size_storage
39 packet_access_bit = packet_traits<Scalar>::Vectorizable && is_aligned ?
PacketAccessBit : 0
43 enum { ret = packet_access_bit };
47 template<
typename Scalar_,
int NumIndices_,
int Options_,
typename IndexType_>
48 struct traits<Tensor<Scalar_, NumIndices_, Options_, IndexType_> >
50 typedef Scalar_ Scalar;
51 typedef Dense StorageKind;
52 typedef IndexType_
Index;
53 static const int NumDimensions = NumIndices_;
57 Flags = compute_tensor_flags<Scalar_, Options_>::ret | (is_const<Scalar_>::value ? 0 :
LvalueBit)
59 template <
typename T>
struct MakePointer {
62 typedef typename MakePointer<Scalar>::Type PointerType;
66 template<
typename Scalar_,
typename Dimensions,
int Options_,
typename IndexType_>
67 struct traits<TensorFixedSize<Scalar_, Dimensions, Options_, IndexType_> >
69 typedef Scalar_ Scalar;
70 typedef Dense StorageKind;
71 typedef IndexType_
Index;
72 static const int NumDimensions = array_size<Dimensions>::value;
76 Flags = compute_tensor_flags<Scalar_, Options_>::ret | (is_const<Scalar_>::value ? 0:
LvalueBit)
78 template <
typename T>
struct MakePointer {
81 typedef typename MakePointer<Scalar>::Type PointerType;
85 template<
typename PlainObjectType,
int Options_,
template <
class>
class MakePointer_>
86 struct traits<TensorMap<PlainObjectType, Options_, MakePointer_> >
87 :
public traits<PlainObjectType>
89 typedef traits<PlainObjectType> BaseTraits;
90 typedef typename BaseTraits::Scalar Scalar;
91 typedef typename BaseTraits::StorageKind StorageKind;
92 typedef typename BaseTraits::Index
Index;
93 static const int NumDimensions = BaseTraits::NumDimensions;
94 static const int Layout = BaseTraits::Layout;
97 Flags = BaseTraits::Flags
99 template <
class T>
struct MakePointer {
101 typedef MakePointer_<T> MakePointerT;
102 typedef typename MakePointerT::Type Type;
104 typedef typename MakePointer<Scalar>::Type PointerType;
107 template<
typename PlainObjectType>
108 struct traits<TensorRef<PlainObjectType> >
109 :
public traits<PlainObjectType>
111 typedef traits<PlainObjectType> BaseTraits;
112 typedef typename BaseTraits::Scalar Scalar;
113 typedef typename BaseTraits::StorageKind StorageKind;
114 typedef typename BaseTraits::Index
Index;
115 static const int NumDimensions = BaseTraits::NumDimensions;
116 static const int Layout = BaseTraits::Layout;
118 Options = BaseTraits::Options,
119 Flags = BaseTraits::Flags
121 typedef typename BaseTraits::PointerType PointerType;
125 template<
typename _Scalar,
int NumIndices_,
int Options,
typename IndexType_>
126 struct eval<Tensor<_Scalar, NumIndices_, Options, IndexType_>,
Eigen::Dense>
128 typedef const Tensor<_Scalar, NumIndices_, Options, IndexType_>EIGEN_DEVICE_REF type;
131 template<
typename _Scalar,
int NumIndices_,
int Options,
typename IndexType_>
132 struct eval<const Tensor<_Scalar, NumIndices_, Options, IndexType_>,
Eigen::Dense>
134 typedef const Tensor<_Scalar, NumIndices_, Options, IndexType_>EIGEN_DEVICE_REF type;
137 template<
typename Scalar_,
typename Dimensions,
int Options,
typename IndexType_>
138 struct eval<TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>,
Eigen::Dense>
140 typedef const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>EIGEN_DEVICE_REF type;
143 template<
typename Scalar_,
typename Dimensions,
int Options,
typename IndexType_>
144 struct eval<const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>,
Eigen::Dense>
146 typedef const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>EIGEN_DEVICE_REF type;
149 template<
typename PlainObjectType,
int Options,
template <
class>
class MakePointer>
150 struct eval<TensorMap<PlainObjectType, Options, MakePointer>,
Eigen::Dense>
152 typedef const TensorMap<PlainObjectType, Options, MakePointer>EIGEN_DEVICE_REF type;
155 template<
typename PlainObjectType,
int Options,
template <
class>
class MakePointer>
156 struct eval<const TensorMap<PlainObjectType, Options, MakePointer>,
Eigen::Dense>
158 typedef const TensorMap<PlainObjectType, Options, MakePointer>EIGEN_DEVICE_REF type;
161 template<
typename PlainObjectType>
162 struct eval<TensorRef<PlainObjectType>,
Eigen::Dense>
164 typedef const TensorRef<PlainObjectType>EIGEN_DEVICE_REF type;
167 template<
typename PlainObjectType>
168 struct eval<const TensorRef<PlainObjectType>,
Eigen::Dense>
170 typedef const TensorRef<PlainObjectType>EIGEN_DEVICE_REF type;
174 template<
typename T,
int n=1,
typename PlainObject =
void>
struct nested
176 typedef typename ref_selector<T>::type type;
179 template <
typename Scalar_,
int NumIndices_,
int Options_,
typename IndexType_>
180 struct nested<Tensor<Scalar_, NumIndices_, Options_, IndexType_> >
182 typedef const Tensor<Scalar_, NumIndices_, Options_, IndexType_>EIGEN_DEVICE_REF type;
185 template <
typename Scalar_,
int NumIndices_,
int Options_,
typename IndexType_>
186 struct nested<const Tensor<Scalar_, NumIndices_, Options_, IndexType_> >
188 typedef const Tensor<Scalar_, NumIndices_, Options_, IndexType_>EIGEN_DEVICE_REF type;
191 template <
typename Scalar_,
typename Dimensions,
int Options,
typename IndexType_>
192 struct nested<TensorFixedSize<Scalar_, Dimensions, Options, IndexType_> >
194 typedef const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>EIGEN_DEVICE_REF type;
197 template <
typename Scalar_,
typename Dimensions,
int Options,
typename IndexType_>
198 struct nested<const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_> >
200 typedef const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>EIGEN_DEVICE_REF type;
204 template <
typename PlainObjectType>
205 struct nested<TensorRef<PlainObjectType> >
207 typedef const TensorRef<PlainObjectType>EIGEN_DEVICE_REF type;
210 template <
typename PlainObjectType>
211 struct nested<const TensorRef<PlainObjectType> >
213 typedef const TensorRef<PlainObjectType>EIGEN_DEVICE_REF type;
264 #endif // EIGEN_CXX11_TENSOR_TENSOR_TRAITS_H
const unsigned int LvalueBit
Namespace containing all symbols from the Eigen library.
const unsigned int PacketAccessBit
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index