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_> >
69 static const Index
NumIndices = PlainObjectType::NumIndices;
85 #if EIGEN_HAS_VARIADIC_TEMPLATES 110 EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr, Index dim1, Index dim2, Index dim3, Index dim4, Index dim5) :
m_data(dataPtr),
m_dimensions(dim1, dim2, dim3, dim4, dim5) {
119 template <
typename Dimensions>
145 if (PlainObjectType::Options&
RowMajor) {
146 const Index index =
m_dimensions.IndexOfRowMajor(indices);
149 const Index index =
m_dimensions.IndexOfColMajor(indices);
168 #if EIGEN_HAS_VARIADIC_TEMPLATES 172 EIGEN_STATIC_ASSERT(
sizeof...(otherIndices) + 2 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE)
174 if (PlainObjectType::Options&
RowMajor) {
186 if (PlainObjectType::Options&
RowMajor) {
197 if (PlainObjectType::Options&
RowMajor) {
208 if (PlainObjectType::Options&
RowMajor) {
219 if (PlainObjectType::Options&
RowMajor) {
233 if (PlainObjectType::Options&
RowMajor) {
234 const Index index =
m_dimensions.IndexOfRowMajor(indices);
237 const Index index =
m_dimensions.IndexOfColMajor(indices);
256 #if EIGEN_HAS_VARIADIC_TEMPLATES 260 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.");
262 const std::size_t NumDims =
sizeof...(otherIndices) + 2;
263 if (PlainObjectType::Options&
RowMajor) {
275 if (PlainObjectType::Options&
RowMajor) {
286 if (PlainObjectType::Options&
RowMajor) {
297 if (PlainObjectType::Options&
RowMajor) {
308 if (PlainObjectType::Options&
RowMajor) {
327 #endif // EIGEN_CXX11_TENSOR_TENSOR_MAP_H PlainObjectType::Base::CoeffReturnType CoeffReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index dimension(Index n) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr)
#define EIGEN_STRONG_INLINE
static const Eigen::internal::all_t all
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()(Index i0, Index i1, Index i2, Index i3, Index i4)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr, Index dim1, Index dim2, Index dim3)
PlainObjectType::Dimensions Dimensions
internal::traits< PlainObjectType >::Index Index
TensorMap< PlainObjectType, Options_, MakePointer_ > Self
Namespace containing all symbols from the Eigen library.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()(Index index) const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()(Index i0, Index i1) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()(const array< Index, NumIndices > &indices)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(PlainObjectType &tensor)
MakePointer_< Scalar >::ConstType PointerConstType
internal::traits< PlainObjectType >::StorageKind StorageKind
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StoragePointerType data()
MakePointer_< Scalar >::Type PointerType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()(Index i0, Index i1, Index i2) const
A tensor expression mapping an existing array of data.
StoragePointerType m_data
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()(Index i0, Index i1)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr, Index dim1, Index dim2)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr, Index dim1, Index dim2, Index dim3, Index dim4)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()(Index i0, Index i1, Index i2, Index i3)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StoragePointerType data() const
NumTraits< Scalar >::Real RealScalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr, const Dimensions &dimensions)
#define EIGEN_DEVICE_FUNC
TensorBase< TensorMap< PlainObjectType, Options_, MakePointer_ > > Base
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()(Index i0, Index i1, Index i2, Index i3, Index i4) const
internal::conditional< bool(internal::is_lvalue< PlainObjectType >::value), Scalar &, const Scalar &>::type StorageRefType
Eigen::internal::nested< Self >::type Nested
#define EIGEN_TENSOR_INHERIT_ASSIGNMENT_OPERATORS(Derived)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()(const array< Index, NumIndices > &indices) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr, Index firstDimension)
static const Index NumIndices
#define eigen_internal_assert(x)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()(Index index)
internal::traits< PlainObjectType >::Scalar Scalar
Generic expression where a coefficient-wise unary operator is applied to an expression.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()(Index i0, Index i1, Index i2)
internal::conditional< bool(internal::is_lvalue< PlainObjectType >::value), PointerType, PointerConstType >::type StoragePointerType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE StorageRefType operator()(Index i0, Index i1, Index i2, Index i3) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr, const array< Index, NumIndices > &dimensions)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index size() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rank() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr, Index dim1, Index dim2, Index dim3, Index dim4, Index dim5)