10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_REF_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_REF_H
20 template <
typename Dimensions,
typename Scalar>
44 template <
typename Dimensions,
typename Expr,
typename Device>
65 eigen_assert(
false &&
"can't reference the coefficient of a rvalue");
75 template <
typename Dimensions,
typename Expr,
typename Device>
89 template <
typename Dimensions,
typename Expr,
typename Device>
91 TensorLazyEvaluatorWritable<Dimensions, Expr, Device>,
92 TensorLazyEvaluatorReadOnly<Dimensions, const Expr, Device> > {
113 template <
typename PlainObjectType>
117 typedef typename PlainObjectType::Base
Base;
130 static constexpr
int Layout = PlainObjectType::Layout;
146 template <
typename Expression>
152 template <
typename Expression>
168 if (
this != &other) {
185 template <
typename... IndexTypes>
187 const std::size_t num_indices = (
sizeof...(otherIndices) + 1);
189 return coeff(indices);
191 template <
typename... IndexTypes>
193 const std::size_t num_indices = (
sizeof...(otherIndices) + 1);
198 template <std::
size_t NumIndices>
202 if (PlainObjectType::Options &
RowMajor) {
205 index = index * dims[
i] + indices[
i];
210 index = index * dims[
i] + indices[
i];
215 template <std::
size_t NumIndices>
219 if (PlainObjectType::Options &
RowMajor) {
222 index = index * dims[
i] + indices[
i];
227 index = index * dims[
i] + indices[
i];
251 template <
typename Derived,
typename Device>
266 PreferBlockAccess =
false,
294 template <
typename Derived,
typename Device>
304 enum {
IsAligned =
false,
PacketAccess =
false, BlockAccess =
false, PreferBlockAccess =
false, RawAccess =
false };
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
SCALAR Scalar
Definition: bench_gemm.cpp:45
The tensor base class.
Definition: TensorBase.h:1026
A reference to a tensor expression The expression will be evaluated lazily (as much as possible).
Definition: TensorRef.h:114
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index index) const
Definition: TensorRef.h:233
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index dimension(Index n) const
Definition: TensorRef.h:178
internal::traits< PlainObjectType >::Index Index
Definition: TensorRef.h:120
TensorRef(const TensorRef &other)
Definition: TensorRef.h:162
TensorRef & operator=(const TensorRef &other)
Definition: TensorRef.h:167
PlainObjectType::Dimensions Dimensions
Definition: TensorRef.h:128
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition: TensorRef.h:179
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Definition: TensorRef.h:235
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(Index firstIndex, IndexTypes... otherIndices) const
Definition: TensorRef.h:186
EIGEN_STRONG_INLINE TensorRef & operator=(const Expression &expr)
Definition: TensorRef.h:153
~TensorRef()
Definition: TensorRef.h:160
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(const array< Index, NumIndices > &indices) const
Definition: TensorRef.h:199
internal::TensorLazyBaseEvaluator< Dimensions, Scalar > * m_evaluator
Definition: TensorRef.h:247
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(const array< Index, NumIndices > &indices)
Definition: TensorRef.h:216
Base::CoeffReturnType CoeffReturnType
Definition: TensorRef.h:123
NumTraits< Scalar >::Real RealScalar
Definition: TensorRef.h:122
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rank() const
Definition: TensorRef.h:177
static constexpr Index NumIndices
Definition: TensorRef.h:127
EIGEN_STRONG_INLINE TensorRef()
Definition: TensorRef.h:144
PlainObjectType::Base Base
Definition: TensorRef.h:117
@ PacketAccess
Definition: TensorRef.h:133
@ PreferBlockAccess
Definition: TensorRef.h:135
@ BlockAccess
Definition: TensorRef.h:134
@ IsAligned
Definition: TensorRef.h:132
@ CoordAccess
Definition: TensorRef.h:136
@ RawAccess
Definition: TensorRef.h:137
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar * data() const
Definition: TensorRef.h:181
PointerType PointerArgType
Definition: TensorRef.h:125
EIGEN_STRONG_INLINE void unrefEvaluator()
Definition: TensorRef.h:238
TensorRef< PlainObjectType > Self
Definition: TensorRef.h:116
Eigen::internal::nested< Self >::type Nested
Definition: TensorRef.h:118
internal::TensorBlockNotImplemented TensorBlock
Definition: TensorRef.h:141
EIGEN_STRONG_INLINE TensorRef(const Expression &expr)
Definition: TensorRef.h:147
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index firstIndex, IndexTypes... otherIndices)
Definition: TensorRef.h:192
internal::traits< PlainObjectType >::StorageKind StorageKind
Definition: TensorRef.h:119
internal::traits< PlainObjectType >::Scalar Scalar
Definition: TensorRef.h:121
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(Index index) const
Definition: TensorRef.h:183
static constexpr int Layout
Definition: TensorRef.h:130
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index size() const
Definition: TensorRef.h:180
Scalar * PointerType
Definition: TensorRef.h:124
Definition: TensorBlock.h:566
Definition: TensorRef.h:21
int refCount() const
Definition: TensorRef.h:34
void decrRefCount()
Definition: TensorRef.h:33
virtual EIGEN_DEVICE_FUNC const Scalar coeff(DenseIndex index) const =0
virtual EIGEN_DEVICE_FUNC const Dimensions & dimensions() const =0
virtual ~TensorLazyBaseEvaluator()
Definition: TensorRef.h:24
int m_refcount
Definition: TensorRef.h:41
void incrRefCount()
Definition: TensorRef.h:32
TensorLazyBaseEvaluator()
Definition: TensorRef.h:23
virtual EIGEN_DEVICE_FUNC Scalar & coeffRef(DenseIndex index)=0
TensorLazyBaseEvaluator & operator=(const TensorLazyBaseEvaluator &other)
virtual EIGEN_DEVICE_FUNC const Scalar * data() const =0
TensorLazyBaseEvaluator(const TensorLazyBaseEvaluator &other)
Definition: TensorRef.h:46
virtual EIGEN_DEVICE_FUNC const Scalar coeff(DenseIndex index) const
Definition: TensorRef.h:63
TensorLazyEvaluatorReadOnly(const Expr &expr, const Device &device)
Definition: TensorRef.h:54
Storage::Type EvaluatorPointerType
Definition: TensorRef.h:51
Scalar m_dummy
Definition: TensorRef.h:72
virtual ~TensorLazyEvaluatorReadOnly()
Definition: TensorRef.h:58
StorageMemory< Scalar, Device > Storage
Definition: TensorRef.h:50
virtual EIGEN_DEVICE_FUNC const Scalar * data() const
Definition: TensorRef.h:61
TensorEvaluator< Expr, Device >::Scalar Scalar
Definition: TensorRef.h:49
TensorEvaluator< Expr, Device > m_impl
Definition: TensorRef.h:67
virtual EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
Definition: TensorRef.h:60
virtual EIGEN_DEVICE_FUNC Scalar & coeffRef(DenseIndex)
Definition: TensorRef.h:64
TensorEvaluator< Expr, Device > EvalType
Definition: TensorRef.h:52
Dimensions m_dims
Definition: TensorRef.h:71
Definition: TensorRef.h:76
Storage::Type EvaluatorPointerType
Definition: TensorRef.h:81
TensorLazyEvaluatorReadOnly< Dimensions, Expr, Device > Base
Definition: TensorRef.h:78
virtual EIGEN_DEVICE_FUNC Scalar & coeffRef(DenseIndex index)
Definition: TensorRef.h:86
virtual ~TensorLazyEvaluatorWritable()
Definition: TensorRef.h:84
TensorLazyEvaluatorWritable(const Expr &expr, const Device &device)
Definition: TensorRef.h:83
StorageMemory< Scalar, Device > Storage
Definition: TensorRef.h:80
Base::Scalar Scalar
Definition: TensorRef.h:79
Definition: TensorRef.h:92
TensorLazyEvaluator(const Expr &expr, const Device &device)
Definition: TensorRef.h:100
virtual ~TensorLazyEvaluator()
Definition: TensorRef.h:101
Base::Scalar Scalar
Definition: TensorRef.h:98
std::conditional_t< bool(internal::is_lvalue< Expr >::value), TensorLazyEvaluatorWritable< Dimensions, Expr, Device >, TensorLazyEvaluatorReadOnly< Dimensions, const Expr, Device > > Base
Definition: TensorRef.h:97
@ RowMajor
Definition: Constants.h:320
int * m
Definition: level2_cplx_impl.h:294
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
std::array< T, N > array
Definition: EmulateArray.h:231
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
Definition: Meta.h:75
Definition: Eigen_Colamd.h:49
Definition: TensorDeviceDefault.h:19
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Definition: TensorForwardDeclarations.h:42
internal::TensorBlockNotImplemented TensorBlock
Definition: TensorRef.h:307
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorRef.h:299
TensorEvaluator< const TensorRef< Derived >, Device > Base
Definition: TensorRef.h:302
Derived::Scalar CoeffReturnType
Definition: TensorRef.h:298
EIGEN_STRONG_INLINE TensorEvaluator(TensorRef< Derived > &m, const Device &d)
Definition: TensorRef.h:310
Derived::Dimensions Dimensions
Definition: TensorRef.h:300
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Definition: TensorRef.h:312
Derived::Index Index
Definition: TensorRef.h:296
Derived::Scalar Scalar
Definition: TensorRef.h:297
Definition: TensorRef.h:252
EIGEN_DEVICE_FUNC const Scalar * data() const
Definition: TensorRef.h:287
Derived::Index Index
Definition: TensorRef.h:253
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Definition: TensorRef.h:285
TensorRef< Derived > m_ref
Definition: TensorRef.h:290
EIGEN_STRONG_INLINE void cleanup()
Definition: TensorRef.h:281
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: TensorRef.h:283
Derived::Scalar Scalar
Definition: TensorRef.h:254
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
Definition: TensorRef.h:279
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition: TensorRef.h:277
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorRef.h:256
EIGEN_STRONG_INLINE TensorEvaluator(const TensorRef< Derived > &m, const Device &)
Definition: TensorRef.h:275
Derived::Dimensions Dimensions
Definition: TensorRef.h:257
internal::TensorBlockNotImplemented TensorBlock
Definition: TensorRef.h:272
Derived::Scalar CoeffReturnType
Definition: TensorRef.h:255
Storage::Type EvaluatorPointerType
Definition: TensorRef.h:259
StorageMemory< CoeffReturnType, Device > Storage
Definition: TensorRef.h:258
A cost model used to limit the number of threads used for evaluating tensor expression.
Definition: TensorEvaluator.h:31
static constexpr int Layout
Definition: TensorEvaluator.h:46
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType dest)
Definition: TensorEvaluator.h:71
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType & coeffRef(Index index) const
Definition: TensorEvaluator.h:94
@ PacketAccess
Definition: TensorEvaluator.h:50
@ IsAligned
Definition: TensorEvaluator.h:49
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition: TensorEvaluator.h:165
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: TensorEvaluator.h:89
EIGEN_STRONG_INLINE void cleanup()
Definition: TensorEvaluator.h:87
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition: TensorEvaluator.h:69
Definition: XprHelper.h:819
ref_selector< T >::type type
Definition: TensorTraits.h:153
Definition: ForwardDeclarations.h:21