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,
25 ((Options&DontAlign)==0) && (
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_;
54 static const int Layout = Options_ & RowMajor ? RowMajor : ColMajor;
57 Flags = compute_tensor_flags<Scalar_, Options_>::ret | (is_const<Scalar_>::value ? 0 : LvalueBit)
59 template <
typename T>
struct MakePointer {
65 template<
typename Scalar_,
typename Dimensions,
int Options_,
typename IndexType_>
66 struct traits<TensorFixedSize<Scalar_, Dimensions, Options_, IndexType_> >
68 typedef Scalar_ Scalar;
69 typedef Dense StorageKind;
70 typedef IndexType_ Index;
71 static const int NumDimensions = array_size<Dimensions>::value;
72 static const int Layout = Options_ & RowMajor ? RowMajor : ColMajor;
75 Flags = compute_tensor_flags<Scalar_, Options_>::ret | (is_const<Scalar_>::value ? 0: LvalueBit)
77 template <
typename T>
struct MakePointer {
83 template<
typename PlainObjectType,
int Options_,
template <
class>
class MakePointer_>
84 struct traits<TensorMap<PlainObjectType, Options_, MakePointer_> >
85 :
public traits<PlainObjectType>
87 typedef traits<PlainObjectType> BaseTraits;
88 typedef typename BaseTraits::Scalar Scalar;
89 typedef typename BaseTraits::StorageKind StorageKind;
90 typedef typename BaseTraits::Index Index;
91 static const int NumDimensions = BaseTraits::NumDimensions;
92 static const int Layout = BaseTraits::Layout;
95 Flags = BaseTraits::Flags
97 template <
class T>
struct MakePointer {
99 typedef MakePointer_<T> MakePointerT;
100 typedef typename MakePointerT::Type Type;
104 template<
typename PlainObjectType>
105 struct traits<TensorRef<PlainObjectType> >
106 :
public traits<PlainObjectType>
108 typedef traits<PlainObjectType> BaseTraits;
109 typedef typename BaseTraits::Scalar Scalar;
110 typedef typename BaseTraits::StorageKind StorageKind;
111 typedef typename BaseTraits::Index Index;
112 static const int NumDimensions = BaseTraits::NumDimensions;
113 static const int Layout = BaseTraits::Layout;
115 Options = BaseTraits::Options,
116 Flags = BaseTraits::Flags
121 template<
typename _Scalar,
int NumIndices_,
int Options,
typename IndexType_>
122 struct eval<Tensor<_Scalar, NumIndices_, Options, IndexType_>,
Eigen::Dense>
124 typedef const Tensor<_Scalar, NumIndices_, Options, IndexType_>& type;
127 template<
typename _Scalar,
int NumIndices_,
int Options,
typename IndexType_>
128 struct eval<const Tensor<_Scalar, NumIndices_, Options, IndexType_>,
Eigen::Dense>
130 typedef const Tensor<_Scalar, NumIndices_, Options, IndexType_>& type;
133 template<
typename Scalar_,
typename Dimensions,
int Options,
typename IndexType_>
134 struct eval<TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>,
Eigen::Dense>
136 typedef const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>& type;
139 template<
typename Scalar_,
typename Dimensions,
int Options,
typename IndexType_>
140 struct eval<const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>,
Eigen::Dense>
142 typedef const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>& type;
145 template<
typename PlainObjectType,
int Options,
template <
class>
class MakePointer>
146 struct eval<TensorMap<PlainObjectType, Options, MakePointer>,
Eigen::Dense>
148 typedef const TensorMap<PlainObjectType, Options, MakePointer>& type;
151 template<
typename PlainObjectType,
int Options,
template <
class>
class MakePointer>
152 struct eval<const TensorMap<PlainObjectType, Options, MakePointer>,
Eigen::Dense>
154 typedef const TensorMap<PlainObjectType, Options, MakePointer>& type;
157 template<
typename PlainObjectType>
158 struct eval<TensorRef<PlainObjectType>,
Eigen::Dense>
160 typedef const TensorRef<PlainObjectType>& type;
163 template<
typename PlainObjectType>
164 struct eval<const TensorRef<PlainObjectType>,
Eigen::Dense>
166 typedef const TensorRef<PlainObjectType>& type;
170 template<
typename T,
int n=1,
typename PlainObject =
void>
struct nested
172 typedef typename ref_selector<T>::type type;
175 template <
typename Scalar_,
int NumIndices_,
int Options_,
typename IndexType_>
176 struct nested<Tensor<Scalar_, NumIndices_, Options_, IndexType_> >
178 typedef const Tensor<Scalar_, NumIndices_, Options_, IndexType_>& type;
181 template <
typename Scalar_,
int NumIndices_,
int Options_,
typename IndexType_>
182 struct nested<const Tensor<Scalar_, NumIndices_, Options_, IndexType_> >
184 typedef const Tensor<Scalar_, NumIndices_, Options_, IndexType_>& type;
187 template <
typename Scalar_,
typename Dimensions,
int Options,
typename IndexType_>
188 struct nested<TensorFixedSize<Scalar_, Dimensions, Options, IndexType_> >
190 typedef const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>& type;
193 template <
typename Scalar_,
typename Dimensions,
int Options,
typename IndexType_>
194 struct nested<const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_> >
196 typedef const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>& type;
200 template <
typename PlainObjectType,
int Options,
template <
class>
class MakePointer>
201 struct nested<TensorMap<PlainObjectType, Options, MakePointer> >
203 typedef const TensorMap<PlainObjectType, Options, MakePointer>& type;
206 template <
typename PlainObjectType,
int Options,
template <
class>
class MakePointer>
207 struct nested<const TensorMap<PlainObjectType, Options, MakePointer> >
209 typedef const TensorMap<PlainObjectType, Options, MakePointer>& type;
212 template <
typename PlainObjectType>
213 struct nested<TensorRef<PlainObjectType> >
215 typedef const TensorRef<PlainObjectType>& type;
218 template <
typename PlainObjectType>
219 struct nested<const TensorRef<PlainObjectType> >
221 typedef const TensorRef<PlainObjectType>& type;
272 #endif // EIGEN_CXX11_TENSOR_TENSOR_TRAITS_H Namespace containing all symbols from the Eigen library.
Definition: AdolcForward:45