10#ifndef EIGEN_CXX11_TENSOR_TENSOR_ASSIGN_H
11#define EIGEN_CXX11_TENSOR_TENSOR_ASSIGN_H
24template<
typename LhsXprType,
typename RhsXprType>
27 typedef typename LhsXprType::Scalar
Scalar;
44template<
typename LhsXprType,
typename RhsXprType>
50template<
typename LhsXprType,
typename RhsXprType>
60template<
typename LhsXprType,
typename RhsXprType>
91template<
typename LeftArgType,
typename RightArgType,
typename Device>
104 static const int NumDims = XprType::NumDims;
128 m_leftImpl(op.lhsExpression(), device),
129 m_rightImpl(op.rhsExpression(), device)
134 YOU_MADE_A_PROGRAMMING_MISTAKE);
142 return m_rightImpl.dimensions();
147 m_leftImpl.evalSubExprsIfNeeded(NULL);
152 return m_rightImpl.evalSubExprsIfNeeded(m_leftImpl.data());
155#ifdef EIGEN_USE_THREADS
156 template <
typename EvalSubExprsCallback>
159 m_leftImpl.evalSubExprsIfNeededAsync(
nullptr, [
this, done](
bool) {
160 m_rightImpl.evalSubExprsIfNeededAsync(
161 m_leftImpl.data(), [done](
bool need_assign) { done(need_assign); });
167 m_leftImpl.cleanup();
168 m_rightImpl.cleanup();
172 m_leftImpl.coeffRef(
i) = m_rightImpl.coeff(
i);
178 m_leftImpl.template writePacket<LhsStoreMode>(
i, m_rightImpl.template packet<RhsLoadMode>(
i));
182 return m_leftImpl.coeff(index);
184 template<
int LoadMode>
187 return m_leftImpl.template packet<LoadMode>(index);
195 TensorOpCost left = m_leftImpl.costPerCoeff(vectorized);
196 return m_rightImpl.costPerCoeff(vectorized) +
206 m_leftImpl.getResourceRequirements(),
207 m_rightImpl.getResourceRequirements());
213 m_leftImpl.
data() != NULL) {
216 desc.template AddDestinationBuffer<Layout>(
217 m_leftImpl.data() + desc.
offset(),
224 m_leftImpl.writeBlock(desc,
block);
232 m_leftImpl.bind(cgh);
233 m_rightImpl.bind(cgh);
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
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition StaticAssert.h:127
Definition TensorAssign.h:62
EIGEN_DEVICE_FUNC const internal::remove_all< typenameRhsXprType::Nested >::type & rhsExpression() const
Definition TensorAssign.h:83
LhsXprType::CoeffReturnType CoeffReturnType
Definition TensorAssign.h:66
Eigen::internal::traits< TensorAssignOp >::StorageKind StorageKind
Definition TensorAssign.h:68
EIGEN_DEVICE_FUNC internal::remove_all< typenameLhsXprType::Nested >::type & lhsExpression() const
Definition TensorAssign.h:79
Eigen::internal::traits< TensorAssignOp >::Scalar Scalar
Definition TensorAssign.h:64
const internal::remove_all< typenameRhsXprType::Nested >::type & m_rhs_xpr
Definition TensorAssign.h:87
internal::remove_all< typenameLhsXprType::Nested >::type & m_lhs_xpr
Definition TensorAssign.h:86
Eigen::internal::nested< TensorAssignOp >::type Nested
Definition TensorAssign.h:67
static const int NumDims
Definition TensorAssign.h:71
Eigen::NumTraits< Scalar >::Real RealScalar
Definition TensorAssign.h:65
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorAssignOp(LhsXprType &lhs, const RhsXprType &rhs)
Definition TensorAssign.h:73
Eigen::internal::traits< TensorAssignOp >::Index Index
Definition TensorAssign.h:69
The tensor base class.
Definition TensorBase.h:973
Definition TensorCostModel.h:25
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double bytes_stored() const
Definition TensorCostModel.h:77
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double bytes_loaded() const
Definition TensorCostModel.h:74
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double compute_cycles() const
Definition TensorCostModel.h:80
IndexType offset() const
Definition TensorBlock.h:298
Definition TensorRef.h:81
@ Unaligned
Definition Constants.h:233
@ Aligned
Definition Constants.h:240
@ kMaterializedInOutput
Definition TensorBlock.h:610
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
Definition MathFunctions.h:1091
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool dimensions_match(Dims1 dims1, Dims2 dims2)
Definition TensorDimensions.h:484
Definition BandTriangularSolver.h:13
Definition Constants.h:507
Definition TensorMeta.h:50
Definition TensorForwardDeclarations.h:37
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition TensorAssign.h:98
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition TensorAssign.h:191
Storage::Type EvaluatorPointerType
Definition TensorAssign.h:101
TensorAssignOp< LeftArgType, RightArgType > XprType
Definition TensorAssign.h:94
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
Definition TensorAssign.h:145
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
Definition TensorAssign.h:137
TensorEvaluator(const XprType &op, const Device &device)
Definition TensorAssign.h:127
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalPacket(Index i)
Definition TensorAssign.h:174
TensorEvaluator< constRightArgType, Device >::TensorBlock RightTensorBlock
Definition TensorAssign.h:124
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
Definition TensorAssign.h:120
EIGEN_DEVICE_FUNC PacketReturnType packet(Index index) const
Definition TensorAssign.h:185
EIGEN_STRONG_INLINE void cleanup()
Definition TensorAssign.h:166
XprType::CoeffReturnType CoeffReturnType
Definition TensorAssign.h:97
XprType::Scalar Scalar
Definition TensorAssign.h:96
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
Definition TensorAssign.h:121
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::TensorBlockResourceRequirements getResourceRequirements() const
Definition TensorAssign.h:204
StorageMemory< CoeffReturnType, Device > Storage
Definition TensorAssign.h:100
TensorEvaluator< RightArgType, Device >::Dimensions Dimensions
Definition TensorAssign.h:99
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalScalar(Index i)
Definition TensorAssign.h:171
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalBlock(TensorBlockDesc &desc, TensorBlockScratch &scratch)
Definition TensorAssign.h:210
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition TensorAssign.h:237
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
Definition TensorAssign.h:180
XprType::Index Index
Definition TensorAssign.h:95
A cost model used to limit the number of threads used for evaluating tensor expression.
Definition TensorEvaluator.h:29
Storage::Type EvaluatorPointerType
Definition TensorEvaluator.h:39
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition TensorEvaluator.h:181
@ 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
Derived::Dimensions Dimensions
Definition TensorEvaluator.h:34
static const int PacketSize
Definition TensorEvaluator.h:36
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool=false) const
Definition TensorEvaluator.h:158
Definition TensorBlock.h:75
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlockResourceRequirements merge(const TensorBlockResourceRequirements &lhs, const TensorBlockResourceRequirements &rhs)
Definition TensorBlock.h:138
const TensorAssignOp< LhsXprType, RhsXprType > & type
Definition TensorAssign.h:47
Definition XprHelper.h:332
TensorAssignOp< LhsXprType, RhsXprType > type
Definition TensorAssign.h:53
Definition TensorTraits.h:175
RhsXprType::Nested RhsNested
Definition TensorAssign.h:32
traits< LhsXprType >::StorageKind StorageKind
Definition TensorAssign.h:28
remove_reference< RhsNested >::type _RhsNested
Definition TensorAssign.h:34
traits< LhsXprType >::PointerType PointerType
Definition TensorAssign.h:37
remove_reference< LhsNested >::type _LhsNested
Definition TensorAssign.h:33
LhsXprType::Nested LhsNested
Definition TensorAssign.h:31
LhsXprType::Scalar Scalar
Definition TensorAssign.h:27
promote_index_type< typenametraits< LhsXprType >::Index, typenametraits< RhsXprType >::Index >::type Index
Definition TensorAssign.h:30
Definition ForwardDeclarations.h:17