10#ifndef EIGEN_CXX11_TENSOR_TENSOR_REF_H
11#define EIGEN_CXX11_TENSOR_TENSOR_REF_H
17template <
typename Dimensions,
typename Scalar>
42template <
typename Dimensions,
typename Expr,
typename Device>
70 eigen_assert(
false &&
"can't reference the coefficient of a rvalue");
80template <
typename Dimensions,
typename Expr,
typename Device>
84 typedef typename Base::Scalar
Scalar;
98template <
typename Dimensions,
typename Expr,
typename Device>
100 TensorLazyEvaluatorWritable<Dimensions, Expr, Device>,
101 TensorLazyEvaluatorReadOnly<Dimensions, const Expr, Device> >::type {
128 typedef typename PlainObjectType::Base
Base;
158 template <
typename Expression>
160 m_evaluator->incrRefCount();
163 template <
typename Expression>
167 m_evaluator->incrRefCount();
177 m_evaluator->incrRefCount();
181 if (
this != &other) {
183 m_evaluator = other.m_evaluator;
185 m_evaluator->incrRefCount();
204 return m_evaluator->coeff(index);
207#if EIGEN_HAS_VARIADIC_TEMPLATES
211 const std::size_t num_indices = (
sizeof...(otherIndices) + 1);
213 return coeff(indices);
218 const std::size_t num_indices = (
sizeof...(otherIndices) + 1);
219 const array<Index, num_indices> indices{{firstIndex, otherIndices...}};
230 return coeff(indices);
239 return coeff(indices);
249 return coeff(indices);
260 return coeff(indices);
307 if (PlainObjectType::Options &
RowMajor) {
310 index = index * dims[
i] + indices[
i];
315 index = index * dims[
i] + indices[
i];
318 return m_evaluator->coeff(index);
325 if (PlainObjectType::Options &
RowMajor) {
328 index = index * dims[
i] + indices[
i];
333 index = index * dims[
i] + indices[
i];
336 return m_evaluator->coeffRef(index);
342 return m_evaluator->coeff(index);
348 return m_evaluator->coeffRef(index);
354 m_evaluator->decrRefCount();
355 if (m_evaluator->refCount() == 0) {
361 internal::TensorLazyBaseEvaluator<Dimensions, Scalar>* m_evaluator;
366template<
typename Derived,
typename Device>
369 typedef typename Derived::Index
Index;
404 return m_ref.coeff(index);
408 return m_ref.coeffRef(index);
419template<
typename Derived,
typename Device>
422 typedef typename Derived::Index
Index;
446 return this->m_ref.coeffRef(index);
Matrix3f m
Definition AngleAxis_mimic_euler.cpp:1
int n
Definition BiCGSTAB_simple.cpp:1
int i
Definition BiCGSTAB_step_by_step.cpp:9
#define EIGEN_DEVICE_FUNC
Definition Macros.h:976
#define eigen_assert(x)
Definition Macros.h:1037
#define EIGEN_STRONG_INLINE
Definition Macros.h:917
SCALAR Scalar
Definition bench_gemm.cpp:46
The tensor base class.
Definition TensorBase.h:973
A reference to a tensor expression The expression will be evaluated lazily (as much as possible).
Definition TensorRef.h:125
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index index) const
Definition TensorRef.h:340
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index dimension(Index n) const
Definition TensorRef.h:193
internal::traits< PlainObjectType >::Index Index
Definition TensorRef.h:131
TensorRef(const TensorRef &other)
Definition TensorRef.h:175
PlainObjectType::Dimensions Dimensions
Definition TensorRef.h:139
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(const array< Index, NumIndices > &indices)
Definition TensorRef.h:321
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition TensorRef.h:195
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(Index i0, Index i1, Index i2, Index i3, Index i4) const
Definition TensorRef.h:252
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()(Index i0, Index i1, Index i2, Index i3)
Definition TensorRef.h:280
~TensorRef()
Definition TensorRef.h:171
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(const array< Index, NumIndices > &indices) const
Definition TensorRef.h:303
@ PacketAccess
Definition TensorRef.h:143
@ Layout
Definition TensorRef.h:146
@ PreferBlockAccess
Definition TensorRef.h:145
@ BlockAccess
Definition TensorRef.h:144
@ IsAligned
Definition TensorRef.h:142
@ CoordAccess
Definition TensorRef.h:147
@ RawAccess
Definition TensorRef.h:148
Base::CoeffReturnType CoeffReturnType
Definition TensorRef.h:134
NumTraits< Scalar >::Real RealScalar
Definition TensorRef.h:133
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rank() const
Definition TensorRef.h:191
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index i0, Index i1, Index i2)
Definition TensorRef.h:271
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index i0, Index i1, Index i2, Index i3, Index i4)
Definition TensorRef.h:290
static const Index NumIndices
Definition TensorRef.h:138
EIGEN_STRONG_INLINE TensorRef()
Definition TensorRef.h:155
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(Index i0, Index i1, Index i2, Index i3) const
Definition TensorRef.h:242
PlainObjectType::Base Base
Definition TensorRef.h:128
PointerType PointerArgType
Definition TensorRef.h:136
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(Index i0, Index i1, Index i2) const
Definition TensorRef.h:233
TensorRef< PlainObjectType > Self
Definition TensorRef.h:127
Eigen::internal::nested< Self >::type Nested
Definition TensorRef.h:129
internal::TensorBlockNotImplemented TensorBlock
Definition TensorRef.h:152
EIGEN_STRONG_INLINE TensorRef(const Expression &expr)
Definition TensorRef.h:159
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(Index i0, Index i1) const
Definition TensorRef.h:225
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index i0, Index i1)
Definition TensorRef.h:263
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar * data() const
Definition TensorRef.h:199
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Definition TensorRef.h:346
EIGEN_STRONG_INLINE TensorRef & operator=(const Expression &expr)
Definition TensorRef.h:164
internal::traits< PlainObjectType >::StorageKind StorageKind
Definition TensorRef.h:130
internal::traits< PlainObjectType >::Scalar Scalar
Definition TensorRef.h:132
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(Index index) const
Definition TensorRef.h:202
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index size() const
Definition TensorRef.h:197
Scalar * PointerType
Definition TensorRef.h:135
Definition EmulateArray.h:21
Definition TensorBlock.h:617
Definition TensorRef.h:18
int refCount() const
Definition TensorRef.h:31
void decrRefCount()
Definition TensorRef.h:30
virtual EIGEN_DEVICE_FUNC const Scalar coeff(DenseIndex index) const =0
virtual ~TensorLazyBaseEvaluator()
Definition TensorRef.h:21
virtual EIGEN_DEVICE_FUNC const Dimensions & dimensions() const =0
virtual EIGEN_DEVICE_FUNC const Scalar * data() const =0
void incrRefCount()
Definition TensorRef.h:29
TensorLazyBaseEvaluator()
Definition TensorRef.h:20
virtual EIGEN_DEVICE_FUNC Scalar & coeffRef(DenseIndex index)=0
Definition TensorRef.h:43
virtual EIGEN_DEVICE_FUNC Scalar & coeffRef(DenseIndex)
Definition TensorRef.h:69
virtual EIGEN_DEVICE_FUNC const Scalar coeff(DenseIndex index) const
Definition TensorRef.h:66
TensorLazyEvaluatorReadOnly(const Expr &expr, const Device &device)
Definition TensorRef.h:51
Storage::Type EvaluatorPointerType
Definition TensorRef.h:48
TensorEvaluator< Expr, Device >::Scalar Scalar
Definition TensorRef.h:46
Scalar m_dummy
Definition TensorRef.h:77
virtual ~TensorLazyEvaluatorReadOnly()
Definition TensorRef.h:55
StorageMemory< Scalar, Device > Storage
Definition TensorRef.h:47
virtual EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
Definition TensorRef.h:59
virtual EIGEN_DEVICE_FUNC const Scalar * data() const
Definition TensorRef.h:62
TensorEvaluator< Expr, Device > m_impl
Definition TensorRef.h:75
TensorEvaluator< Expr, Device > EvalType
Definition TensorRef.h:49
Dimensions m_dims
Definition TensorRef.h:76
Definition TensorRef.h:81
Storage::Type EvaluatorPointerType
Definition TensorRef.h:86
TensorLazyEvaluatorReadOnly< Dimensions, Expr, Device > Base
Definition TensorRef.h:83
virtual ~TensorLazyEvaluatorWritable()
Definition TensorRef.h:90
TensorLazyEvaluatorWritable(const Expr &expr, const Device &device)
Definition TensorRef.h:88
virtual EIGEN_DEVICE_FUNC Scalar & coeffRef(DenseIndex index)
Definition TensorRef.h:93
StorageMemory< Scalar, Device > Storage
Definition TensorRef.h:85
Base::Scalar Scalar
Definition TensorRef.h:84
Definition TensorRef.h:101
TensorLazyEvaluator(const Expr &expr, const Device &device)
Definition TensorRef.h:108
virtual ~TensorLazyEvaluator()
Definition TensorRef.h:110
Base::Scalar Scalar
Definition TensorRef.h:106
internal::conditional< bool(internal::is_lvalue< Expr >::value), TensorLazyEvaluatorWritable< Dimensions, Expr, Device >, TensorLazyEvaluatorReadOnly< Dimensions, constExpr, Device > >::type Base
Definition TensorRef.h:105
@ RowMajor
Definition Constants.h:321
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
Definition Meta.h:66
Definition BandTriangularSolver.h:13
Definition TensorDeviceDefault.h:17
Definition TensorForwardDeclarations.h:37
internal::TensorBlockNotImplemented TensorBlock
Definition TensorRef.h:439
TensorEvaluator< const TensorRef< Derived >, Device > Base
Definition TensorRef.h:428
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition TensorRef.h:425
Derived::Scalar CoeffReturnType
Definition TensorRef.h:424
EIGEN_STRONG_INLINE TensorEvaluator(TensorRef< Derived > &m, const Device &d)
Definition TensorRef.h:442
Derived::Dimensions Dimensions
Definition TensorRef.h:426
Derived::Index Index
Definition TensorRef.h:422
Derived::Scalar Scalar
Definition TensorRef.h:423
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Definition TensorRef.h:445
Definition TensorRef.h:368
Derived::Index Index
Definition TensorRef.h:369
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition TensorRef.h:395
TensorRef< Derived > m_ref
Definition TensorRef.h:414
EIGEN_STRONG_INLINE void cleanup()
Definition TensorRef.h:401
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition TensorRef.h:403
Derived::Scalar Scalar
Definition TensorRef.h:370
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
Definition TensorRef.h:397
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition TensorRef.h:372
EIGEN_STRONG_INLINE TensorEvaluator(const TensorRef< Derived > &m, const Device &)
Definition TensorRef.h:391
Derived::Dimensions Dimensions
Definition TensorRef.h:373
internal::TensorBlockNotImplemented TensorBlock
Definition TensorRef.h:388
Derived::Scalar CoeffReturnType
Definition TensorRef.h:371
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Definition TensorRef.h:407
EIGEN_DEVICE_FUNC const Scalar * data() const
Definition TensorRef.h:411
Storage::Type EvaluatorPointerType
Definition TensorRef.h:375
StorageMemory< CoeffReturnType, Device > Storage
Definition TensorRef.h:374
A cost model used to limit the number of threads used for evaluating tensor expression.
Definition TensorEvaluator.h:29
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType dest)
Definition TensorEvaluator.h:75
Derived::Scalar Scalar
Definition TensorEvaluator.h:31
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType & coeffRef(Index index)
Definition TensorEvaluator.h:99
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition TensorEvaluator.h:73
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition TensorEvaluator.h:181
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition TensorEvaluator.h:94
EIGEN_STRONG_INLINE void cleanup()
Definition TensorEvaluator.h:92
@ BlockAccess
Definition TensorEvaluator.h:48
@ PreferBlockAccess
Definition TensorEvaluator.h:49
@ PacketAccess
Definition TensorEvaluator.h:47
@ Layout
Definition TensorEvaluator.h:50
@ IsAligned
Definition TensorEvaluator.h:46
Definition XprHelper.h:660
Definition ForwardDeclarations.h:17