10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_ASSIGN_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_ASSIGN_H
27 template <
typename LhsXprType,
typename RhsXprType>
44 template <
typename LhsXprType,
typename RhsXprType>
49 template <
typename LhsXprType,
typename RhsXprType>
56 template <
typename LhsXprType,
typename RhsXprType>
85 template <
typename LeftArgType,
typename RightArgType,
typename Device>
97 static constexpr
int NumDims = XprType::NumDims;
120 : m_leftImpl(
op.lhsExpression(), device), m_rightImpl(
op.rhsExpression(), device) {
123 YOU_MADE_A_PROGRAMMING_MISTAKE);
130 return m_rightImpl.dimensions();
135 m_leftImpl.evalSubExprsIfNeeded(NULL);
140 return m_rightImpl.evalSubExprsIfNeeded(m_leftImpl.data());
143 #ifdef EIGEN_USE_THREADS
144 template <
typename EvalSubExprsCallback>
146 m_leftImpl.evalSubExprsIfNeededAsync(
nullptr, [
this, done](
bool) {
147 m_rightImpl.evalSubExprsIfNeededAsync(m_leftImpl.data(), [done](
bool need_assign) { done(need_assign); });
153 m_leftImpl.cleanup();
154 m_rightImpl.cleanup();
158 m_leftImpl.coeffRef(
i) = m_rightImpl.coeff(
i);
163 m_leftImpl.template writePacket<LhsStoreMode>(
i, m_rightImpl.template packet<RhsLoadMode>(
i));
166 template <
int LoadMode>
168 return m_leftImpl.template packet<LoadMode>(index);
175 TensorOpCost left = m_leftImpl.costPerCoeff(vectorized);
176 return m_rightImpl.costPerCoeff(vectorized) +
184 m_rightImpl.getResourceRequirements());
191 desc.template AddDestinationBuffer<Layout>(
192 m_leftImpl.data() + desc.
offset(),
193 internal::strides<Layout>(m_leftImpl.dimensions()));
199 m_leftImpl.writeBlock(desc,
block);
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
SCALAR Scalar
Definition: bench_gemm.cpp:45
Definition: TensorAssign.h:57
const internal::remove_all_t< typename RhsXprType::Nested > & m_rhs_xpr
Definition: TensorAssign.h:82
internal::remove_all_t< typename LhsXprType::Nested > & m_lhs_xpr
Definition: TensorAssign.h:81
LhsXprType::CoeffReturnType CoeffReturnType
Definition: TensorAssign.h:61
Eigen::internal::traits< TensorAssignOp >::StorageKind StorageKind
Definition: TensorAssign.h:63
Eigen::internal::traits< TensorAssignOp >::Scalar Scalar
Definition: TensorAssign.h:59
static constexpr int NumDims
Definition: TensorAssign.h:66
Eigen::internal::nested< TensorAssignOp >::type Nested
Definition: TensorAssign.h:62
EIGEN_DEVICE_FUNC const internal::remove_all_t< typename RhsXprType::Nested > & rhsExpression() const
Definition: TensorAssign.h:76
Eigen::NumTraits< Scalar >::Real RealScalar
Definition: TensorAssign.h:60
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorAssignOp(LhsXprType &lhs, const RhsXprType &rhs)
Definition: TensorAssign.h:68
EIGEN_DEVICE_FUNC internal::remove_all_t< typename LhsXprType::Nested > & lhsExpression() const
Definition: TensorAssign.h:72
Eigen::internal::traits< TensorAssignOp >::Index Index
Definition: TensorAssign.h:64
The tensor base class.
Definition: TensorBase.h:1026
Definition: TensorCostModel.h:28
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double bytes_stored() const
Definition: TensorCostModel.h:69
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double bytes_loaded() const
Definition: TensorCostModel.h:68
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double compute_cycles() const
Definition: TensorCostModel.h:70
IndexType offset() const
Definition: TensorBlock.h:270
Definition: TensorBlock.h:475
Definition: TensorBlock.h:604
TensorBlockKind kind() const
Definition: TensorBlock.h:617
void cleanup()
Definition: TensorBlock.h:626
@ Unaligned
Definition: Constants.h:235
@ Aligned
Definition: Constants.h:242
char char * op
Definition: level2_impl.h:374
@ kMaterializedInOutput
Definition: TensorBlock.h:559
typename remove_all< T >::type remove_all_t
Definition: Meta.h:142
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
Definition: MathFunctions.h:926
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool dimensions_match(Dims1 dims1, Dims2 dims2)
Definition: TensorDimensions.h:322
Extend namespace for flags.
Definition: fsi_chan_precond_driver.cc:56
type
Definition: compute_granudrum_aor.py:141
Definition: Eigen_Colamd.h:49
Definition: Constants.h:519
T Real
Definition: NumTraits.h:183
Definition: TensorMeta.h:47
Definition: TensorForwardDeclarations.h:42
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalPacket(Index i) const
Definition: TensorAssign.h:160
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition: TensorAssign.h:171
Storage::Type EvaluatorPointerType
Definition: TensorAssign.h:94
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalScalar(Index i) const
Definition: TensorAssign.h:157
TensorAssignOp< LeftArgType, RightArgType > XprType
Definition: TensorAssign.h:87
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
Definition: TensorAssign.h:133
TensorEvaluator< RightArgType, Device >::Dimensions Dimensions
Definition: TensorAssign.h:92
TensorEvaluator(const XprType &op, const Device &device)
Definition: TensorAssign.h:119
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
Definition: TensorAssign.h:113
EIGEN_DEVICE_FUNC PacketReturnType packet(Index index) const
Definition: TensorAssign.h:167
EIGEN_STRONG_INLINE void cleanup()
Definition: TensorAssign.h:152
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
Definition: TensorAssign.h:126
XprType::CoeffReturnType CoeffReturnType
Definition: TensorAssign.h:90
XprType::Scalar Scalar
Definition: TensorAssign.h:89
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
Definition: TensorAssign.h:114
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::TensorBlockResourceRequirements getResourceRequirements() const
Definition: TensorAssign.h:182
TensorEvaluator< const RightArgType, Device >::TensorBlock RightTensorBlock
Definition: TensorAssign.h:116
StorageMemory< CoeffReturnType, Device > Storage
Definition: TensorAssign.h:93
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorAssign.h:91
TensorEvaluator< LeftArgType, Device > m_leftImpl
Definition: TensorAssign.h:207
TensorEvaluator< RightArgType, Device > m_rightImpl
Definition: TensorAssign.h:208
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalBlock(TensorBlockDesc &desc, TensorBlockScratch &scratch)
Definition: TensorAssign.h:187
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition: TensorAssign.h:204
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
Definition: TensorAssign.h:165
XprType::Index Index
Definition: TensorAssign.h:88
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
Storage::Type EvaluatorPointerType
Definition: TensorEvaluator.h:41
@ PacketAccess
Definition: TensorEvaluator.h:50
@ IsAligned
Definition: TensorEvaluator.h:49
static constexpr int PacketSize
Definition: TensorEvaluator.h:38
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition: TensorEvaluator.h:165
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool=false) const
Definition: TensorEvaluator.h:147
Definition: TensorBlock.h:75
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlockResourceRequirements merge(const TensorBlockResourceRequirements &lhs, const TensorBlockResourceRequirements &rhs)
Definition: TensorBlock.h:129
const TensorAssignOp< LhsXprType, RhsXprType > & type
Definition: TensorAssign.h:46
Definition: XprHelper.h:427
TensorAssignOp< LhsXprType, RhsXprType > type
Definition: TensorAssign.h:51
Definition: TensorTraits.h:152
ref_selector< T >::type type
Definition: TensorTraits.h:153
RhsXprType::Nested RhsNested
Definition: TensorAssign.h:34
traits< LhsXprType >::StorageKind StorageKind
Definition: TensorAssign.h:30
std::remove_reference_t< RhsNested > RhsNested_
Definition: TensorAssign.h:36
traits< LhsXprType >::PointerType PointerType
Definition: TensorAssign.h:39
LhsXprType::Nested LhsNested
Definition: TensorAssign.h:33
LhsXprType::Scalar Scalar
Definition: TensorAssign.h:29
promote_index_type< typename traits< LhsXprType >::Index, typename traits< RhsXprType >::Index >::type Index
Definition: TensorAssign.h:32
std::remove_reference_t< LhsNested > LhsNested_
Definition: TensorAssign.h:35
Definition: ForwardDeclarations.h:21