10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_MAP_H 11 #define EIGEN_CXX11_TENSOR_TENSOR_MAP_H 21 template<
typename PlainObjectType,
int Options_,
template <
class>
class MakePointer_>
class TensorMap :
public TensorBase<TensorMap<PlainObjectType, Options_, MakePointer_> >
31 typedef typename PlainObjectType::Base
Base;
49 static const Index
NumIndices = PlainObjectType::NumIndices;
65 #if EIGEN_HAS_VARIADIC_TEMPLATES 66 template<
typename... IndexTypes> EIGEN_DEVICE_FUNC
90 EIGEN_STRONG_INLINE TensorMap(PointerArgType dataPtr, Index dim1, Index dim2, Index dim3, Index dim4, Index dim5) :
m_data(dataPtr),
m_dimensions(dim1, dim2, dim3, dim4, dim5) {
99 template <
typename Dimensions>
125 if (PlainObjectType::Options&
RowMajor) {
126 const Index index =
m_dimensions.IndexOfRowMajor(indices);
129 const Index index =
m_dimensions.IndexOfColMajor(indices);
148 #if EIGEN_HAS_VARIADIC_TEMPLATES 149 template<
typename... IndexTypes> EIGEN_DEVICE_FUNC
152 EIGEN_STATIC_ASSERT(
sizeof...(otherIndices) + 2 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE)
153 if (PlainObjectType::Options&
RowMajor) {
165 if (PlainObjectType::Options&
RowMajor) {
176 if (PlainObjectType::Options&
RowMajor) {
187 if (PlainObjectType::Options&
RowMajor) {
198 if (PlainObjectType::Options&
RowMajor) {
212 if (PlainObjectType::Options&
RowMajor) {
213 const Index index =
m_dimensions.IndexOfRowMajor(indices);
216 const Index index =
m_dimensions.IndexOfColMajor(indices);
235 #if EIGEN_HAS_VARIADIC_TEMPLATES 236 template<
typename... IndexTypes> EIGEN_DEVICE_FUNC
239 static_assert(
sizeof...(otherIndices) + 2 == NumIndices || NumIndices ==
Dynamic,
"Number of indices used to access a tensor coefficient must be equal to the rank of the tensor.");
240 const std::size_t NumDims =
sizeof...(otherIndices) + 2;
241 if (PlainObjectType::Options&
RowMajor) {
253 if (PlainObjectType::Options&
RowMajor) {
264 if (PlainObjectType::Options&
RowMajor) {
275 if (PlainObjectType::Options&
RowMajor) {
286 if (PlainObjectType::Options&
RowMajor) {
299 Assign assign(*
this, other);
304 template<
typename OtherDerived>
309 Assign assign(*
this, other);
321 #endif // EIGEN_CXX11_TENSOR_TENSOR_MAP_H Base::CoeffReturnType CoeffReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()(Index index)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index size() const
#define EIGEN_STRONG_INLINE
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & operator()(Index i0, Index i1, Index i2, Index i3) const
PlainObjectType::Dimensions Dimensions
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & operator()() const
internal::traits< PlainObjectType >::Index Index
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Self & operator=(const Self &other)
TensorMap< PlainObjectType, Options_, MakePointer_ > Self
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
PointerType PointerArgType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(PlainObjectType &tensor)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()(Index i0, Index i1)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()(Index i0, Index i1, Index i2, Index i3, Index i4)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index dimension(Index n) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(PointerArgType dataPtr, Index firstDimension)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(PointerArgType dataPtr, Index dim1, Index dim2)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & operator()(Index index) const
internal::traits< PlainObjectType >::StorageKind StorageKind
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()(Index i0, Index i1, Index i2, Index i3)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(PointerArgType dataPtr, Index dim1, Index dim2, Index dim3, Index dim4)
MakePointer_< Scalar >::Type m_data
MakePointer_< Scalar >::Type PointerType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const PointerType data() const
A tensor expression mapping an existing array of data.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Self & operator=(const OtherDerived &other)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()(const array< Index, NumIndices > &indices)
static EIGEN_DEVICE_FUNC void run(const Expression &expr, const Device &device=Device())
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(PointerArgType dataPtr, Index dim1, Index dim2, Index dim3)
NumTraits< Scalar >::Real RealScalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(PointerArgType dataPtr)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & operator()(Index i0, Index i1) const
Eigen::internal::nested< Self >::type Nested
PlainObjectType::Base Base
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PointerType data()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(PointerArgType dataPtr, Index dim1, Index dim2, Index dim3, Index dim4, Index dim5)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(PointerArgType dataPtr, const Dimensions &dimensions)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()(Index i0, Index i1, Index i2)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & operator()(Index i0, Index i1, Index i2) const
static const Index NumIndices
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(PointerArgType dataPtr, const array< Index, NumIndices > &dimensions)
#define eigen_internal_assert(x)
internal::traits< PlainObjectType >::Scalar Scalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & operator()(const array< Index, NumIndices > &indices) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & operator()(Index i0, Index i1, Index i2, Index i3, Index i4) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rank() const