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 && aligned_bit ? PacketAccessBit : 0
43 enum { ret = packet_access_bit | aligned_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),
62 template<
typename Scalar_,
typename Dimensions,
int Options_,
typename IndexType_>
63 struct traits<TensorFixedSize<Scalar_, Dimensions, Options_, IndexType_> >
65 typedef Scalar_ Scalar;
66 typedef Dense StorageKind;
67 typedef IndexType_ Index;
68 static const int NumDimensions = array_size<Dimensions>::value;
69 static const int Layout = Options_ & RowMajor ? RowMajor : ColMajor;
72 Flags = compute_tensor_flags<Scalar_, Options_>::ret | (is_const<Scalar_>::value ? 0: LvalueBit),
77 template<
typename PlainObjectType,
int Options_>
78 struct traits<TensorMap<PlainObjectType, Options_> >
79 :
public traits<PlainObjectType>
81 typedef traits<PlainObjectType> BaseTraits;
82 typedef typename BaseTraits::Scalar Scalar;
83 typedef typename BaseTraits::StorageKind StorageKind;
84 typedef typename BaseTraits::Index Index;
85 static const int NumDimensions = BaseTraits::NumDimensions;
86 static const int Layout = BaseTraits::Layout;
89 Flags = (BaseTraits::Flags & ~AlignedBit) | (Options&Aligned ? AlignedBit : 0),
93 template<
typename PlainObjectType>
94 struct traits<TensorRef<PlainObjectType> >
95 :
public traits<PlainObjectType>
97 typedef traits<PlainObjectType> BaseTraits;
98 typedef typename BaseTraits::Scalar Scalar;
99 typedef typename BaseTraits::StorageKind StorageKind;
100 typedef typename BaseTraits::Index Index;
101 static const int NumDimensions = BaseTraits::NumDimensions;
102 static const int Layout = BaseTraits::Layout;
104 Options = BaseTraits::Options,
105 Flags = (BaseTraits::Flags & ~AlignedBit) | (Options&Aligned ? AlignedBit : 0),
110 template<
typename _Scalar,
int NumIndices_,
int Options,
typename IndexType_>
111 struct eval<Tensor<_Scalar, NumIndices_, Options, IndexType_>,
Eigen::Dense>
113 typedef const Tensor<_Scalar, NumIndices_, Options, IndexType_>& type;
116 template<
typename _Scalar,
int NumIndices_,
int Options,
typename IndexType_>
117 struct eval<const Tensor<_Scalar, NumIndices_, Options, IndexType_>,
Eigen::Dense>
119 typedef const Tensor<_Scalar, NumIndices_, Options, IndexType_>& type;
122 template<
typename Scalar_,
typename Dimensions,
int Options,
typename IndexType_>
123 struct eval<TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>,
Eigen::Dense>
125 typedef const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>& type;
128 template<
typename Scalar_,
typename Dimensions,
int Options,
typename IndexType_>
129 struct eval<const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>,
Eigen::Dense>
131 typedef const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>& type;
134 template<
typename PlainObjectType,
int Options>
135 struct eval<TensorMap<PlainObjectType, Options>,
Eigen::Dense>
137 typedef const TensorMap<PlainObjectType, Options>& type;
140 template<
typename PlainObjectType,
int Options>
141 struct eval<const TensorMap<PlainObjectType, Options>,
Eigen::Dense>
143 typedef const TensorMap<PlainObjectType, Options>& type;
146 template<
typename PlainObjectType>
147 struct eval<TensorRef<PlainObjectType>,
Eigen::Dense>
149 typedef const TensorRef<PlainObjectType>& type;
152 template<
typename PlainObjectType>
153 struct eval<const TensorRef<PlainObjectType>,
Eigen::Dense>
155 typedef const TensorRef<PlainObjectType>& type;
159 template<
typename T,
int n=1,
typename PlainObject =
void>
struct nested
161 typedef typename ref_selector<T>::type type;
164 template <
typename Scalar_,
int NumIndices_,
int Options_,
typename IndexType_>
165 struct nested<Tensor<Scalar_, NumIndices_, Options_, IndexType_> >
167 typedef const Tensor<Scalar_, NumIndices_, Options_, IndexType_>& type;
170 template <
typename Scalar_,
int NumIndices_,
int Options_,
typename IndexType_>
171 struct nested<const Tensor<Scalar_, NumIndices_, Options_, IndexType_> >
173 typedef const Tensor<Scalar_, NumIndices_, Options_, IndexType_>& type;
176 template <
typename Scalar_,
typename Dimensions,
int Options,
typename IndexType_>
177 struct nested<TensorFixedSize<Scalar_, Dimensions, Options, IndexType_> >
179 typedef const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>& type;
182 template <
typename Scalar_,
typename Dimensions,
int Options,
typename IndexType_>
183 struct nested<const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_> >
185 typedef const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>& type;
189 template <
typename PlainObjectType,
int Options>
190 struct nested<TensorMap<PlainObjectType, Options> >
192 typedef const TensorMap<PlainObjectType, Options>& type;
195 template <
typename PlainObjectType,
int Options>
196 struct nested<const TensorMap<PlainObjectType, Options> >
198 typedef const TensorMap<PlainObjectType, Options>& type;
201 template <
typename PlainObjectType>
202 struct nested<TensorRef<PlainObjectType> >
204 typedef const TensorRef<PlainObjectType>& type;
207 template <
typename PlainObjectType>
208 struct nested<const TensorRef<PlainObjectType> >
210 typedef const TensorRef<PlainObjectType>& type;
261 #endif // EIGEN_CXX11_TENSOR_TENSOR_TRAITS_H Namespace containing all symbols from the Eigen library.
Definition: CXX11Meta.h:13