10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_MAP_H 11 #define EIGEN_CXX11_TENSOR_TENSOR_MAP_H 23 template<
typename PlainObjectType,
int Options_,
template <
class>
class MakePointer_>
class TensorMap :
public TensorBase<TensorMap<PlainObjectType, Options_, MakePointer_> >
33 typedef typename PlainObjectType::Base
Base;
51 static const Index
NumIndices = PlainObjectType::NumIndices;
67 #if EIGEN_HAS_VARIADIC_TEMPLATES 68 template<
typename... IndexTypes> EIGEN_DEVICE_FUNC
92 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) {
101 template <
typename Dimensions>
127 if (PlainObjectType::Options&
RowMajor) {
128 const Index index =
m_dimensions.IndexOfRowMajor(indices);
131 const Index index =
m_dimensions.IndexOfColMajor(indices);
150 #if EIGEN_HAS_VARIADIC_TEMPLATES 151 template<
typename... IndexTypes> EIGEN_DEVICE_FUNC
154 EIGEN_STATIC_ASSERT(
sizeof...(otherIndices) + 2 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE)
155 if (PlainObjectType::Options&
RowMajor) {
167 if (PlainObjectType::Options&
RowMajor) {
178 if (PlainObjectType::Options&
RowMajor) {
189 if (PlainObjectType::Options&
RowMajor) {
200 if (PlainObjectType::Options&
RowMajor) {
214 if (PlainObjectType::Options&
RowMajor) {
215 const Index index =
m_dimensions.IndexOfRowMajor(indices);
218 const Index index =
m_dimensions.IndexOfColMajor(indices);
237 #if EIGEN_HAS_VARIADIC_TEMPLATES 238 template<
typename... IndexTypes> EIGEN_DEVICE_FUNC
241 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.");
242 const std::size_t NumDims =
sizeof...(otherIndices) + 2;
243 if (PlainObjectType::Options&
RowMajor) {
255 if (PlainObjectType::Options&
RowMajor) {
266 if (PlainObjectType::Options&
RowMajor) {
277 if (PlainObjectType::Options&
RowMajor) {
288 if (PlainObjectType::Options&
RowMajor) {
301 Assign assign(*
this, other);
306 template<
typename OtherDerived>
311 Assign assign(*
this, other);
323 #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
Namespace containing all symbols from the Eigen library.
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