10#ifndef EIGEN_CXX11_TENSOR_TENSOR_CUSTOM_OP_H
11#define EIGEN_CXX11_TENSOR_TENSOR_CUSTOM_OP_H
23template<
typename CustomUnaryFunc,
typename XprType>
26 typedef typename XprType::Scalar
Scalar;
28 typedef typename XprType::Index
Index;
29 typedef typename XprType::Nested
Nested;
36template<
typename CustomUnaryFunc,
typename XprType>
42template<
typename CustomUnaryFunc,
typename XprType>
52template<
typename CustomUnaryFunc,
typename XprType>
80template<
typename CustomUnaryFunc,
typename XprType,
typename Device>
110 : m_op(op),
m_device(device), m_result(NULL)
137 return m_result[index];
140 template<
int LoadMode>
162 m_op.func().eval(m_op.expression(), result,
m_device);
181template<
typename CustomBinaryFunc,
typename LhsXprType,
typename RhsXprType>
202template<
typename CustomBinaryFunc,
typename LhsXprType,
typename RhsXprType>
208template<
typename CustomBinaryFunc,
typename LhsXprType,
typename RhsXprType>
218template<
typename CustomBinaryFunc,
typename LhsXprType,
typename RhsXprType>
252template<
typename CustomBinaryFunc,
typename LhsXprType,
typename RhsXprType,
typename Device>
283 : m_op(op),
m_device(device), m_result(NULL)
303 if (m_result != NULL) {
310 return m_result[index];
313 template<
int LoadMode>
335 m_op.func().eval(m_op.lhsExpression(), m_op.rhsExpression(), result,
m_device);
#define EIGEN_DEVICE_FUNC
Definition Macros.h:976
#define EIGEN_STRONG_INLINE
Definition Macros.h:917
#define EIGEN_DEVICE_REF
Definition TensorMacros.h:50
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition CwiseBinaryOp.h:84
The tensor base class.
Definition TensorBase.h:973
Tensor custom class.
Definition TensorCustomOp.h:220
internal::traits< TensorCustomBinaryOp >::StorageKind StorageKind
Definition TensorCustomOp.h:226
const CustomBinaryFunc m_func
Definition TensorCustomOp.h:247
internal::traits< TensorCustomBinaryOp >::CoeffReturnType CoeffReturnType
Definition TensorCustomOp.h:224
EIGEN_DEVICE_FUNC const CustomBinaryFunc & func() const
Definition TensorCustomOp.h:234
internal::traits< TensorCustomBinaryOp >::Index Index
Definition TensorCustomOp.h:227
EIGEN_DEVICE_FUNC const internal::remove_all< typenameRhsXprType::Nested >::type & rhsExpression() const
Definition TensorCustomOp.h:242
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorCustomBinaryOp(const LhsXprType &lhs, const RhsXprType &rhs, const CustomBinaryFunc &func)
Definition TensorCustomOp.h:229
Eigen::NumTraits< Scalar >::Real RealScalar
Definition TensorCustomOp.h:223
EIGEN_DEVICE_FUNC const internal::remove_all< typenameLhsXprType::Nested >::type & lhsExpression() const
Definition TensorCustomOp.h:238
LhsXprType::Nested m_lhs_xpr
Definition TensorCustomOp.h:245
RhsXprType::Nested m_rhs_xpr
Definition TensorCustomOp.h:246
internal::nested< TensorCustomBinaryOp >::type Nested
Definition TensorCustomOp.h:225
internal::traits< TensorCustomBinaryOp >::Scalar Scalar
Definition TensorCustomOp.h:222
Tensor custom class.
Definition TensorCustomOp.h:54
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorCustomUnaryOp(const XprType &expr, const CustomUnaryFunc &func)
Definition TensorCustomOp.h:63
EIGEN_DEVICE_FUNC const internal::remove_all< typenameXprType::Nested >::type & expression() const
Definition TensorCustomOp.h:71
internal::traits< TensorCustomUnaryOp >::Index Index
Definition TensorCustomOp.h:61
Eigen::NumTraits< Scalar >::Real RealScalar
Definition TensorCustomOp.h:57
EIGEN_DEVICE_FUNC const CustomUnaryFunc & func() const
Definition TensorCustomOp.h:67
const CustomUnaryFunc m_func
Definition TensorCustomOp.h:75
XprType::Nested m_expr
Definition TensorCustomOp.h:74
XprType::CoeffReturnType CoeffReturnType
Definition TensorCustomOp.h:58
internal::traits< TensorCustomUnaryOp >::StorageKind StorageKind
Definition TensorCustomOp.h:60
internal::traits< TensorCustomUnaryOp >::Scalar Scalar
Definition TensorCustomOp.h:56
internal::nested< TensorCustomUnaryOp >::type Nested
Definition TensorCustomOp.h:59
A tensor expression mapping an existing array of data.
Definition TensorMap.h:30
Definition TensorCostModel.h:25
Definition TensorBlock.h:617
Definition TensorRef.h:81
DenseIndex ret
Definition level1_cplx_impl.h:44
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
Definition BandTriangularSolver.h:13
Definition TensorDimensions.h:263
Definition Constants.h:507
Definition TensorMeta.h:50
Definition TensorForwardDeclarations.h:37
Storage::Type EvaluatorPointerType
Definition TensorCustomOp.h:266
StorageMemory< CoeffReturnType, Device > Storage
Definition TensorCustomOp.h:265
internal::remove_const< typenameXprType::CoeffReturnType >::type CoeffReturnType
Definition TensorCustomOp.h:260
internal::traits< XprType >::Index Index
Definition TensorCustomOp.h:256
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType data)
Definition TensorCustomOp.h:290
Dimensions m_dimensions
Definition TensorCustomOp.h:338
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition TensorCustomOp.h:261
XprType::Scalar Scalar
Definition TensorCustomOp.h:259
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition TensorCustomOp.h:318
const Device EIGEN_DEVICE_REF m_device
Definition TensorCustomOp.h:340
EvaluatorPointerType m_result
Definition TensorCustomOp.h:341
Eigen::internal::traits< XprType >::PointerType TensorPointerType
Definition TensorCustomOp.h:264
EIGEN_STRONG_INLINE void cleanup()
Definition TensorCustomOp.h:302
void evalTo(EvaluatorPointerType data)
Definition TensorCustomOp.h:333
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition TensorCustomOp.h:309
DSizes< Index, NumDims > Dimensions
Definition TensorCustomOp.h:258
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition TensorCustomOp.h:323
EIGEN_STRONG_INLINE TensorEvaluator(const XprType &op, const Device &device)
Definition TensorCustomOp.h:282
const XprType m_op
Definition TensorCustomOp.h:339
internal::TensorBlockNotImplemented TensorBlock
Definition TensorCustomOp.h:279
TensorCustomBinaryOp< CustomBinaryFunc, LhsXprType, RhsXprType > XprType
Definition TensorCustomOp.h:255
EIGEN_DEVICE_FUNC PacketReturnType packet(Index index) const
Definition TensorCustomOp.h:314
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition TensorCustomOp.h:288
const ArgType m_op
Definition TensorCustomOp.h:166
void evalTo(EvaluatorPointerType data)
Definition TensorCustomOp.h:160
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition TensorCustomOp.h:136
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition TensorCustomOp.h:115
Eigen::internal::traits< XprType >::PointerType TensorPointerType
Definition TensorCustomOp.h:91
internal::remove_const< typenameXprType::CoeffReturnType >::type CoeffReturnType
Definition TensorCustomOp.h:88
EIGEN_STRONG_INLINE void cleanup()
Definition TensorCustomOp.h:129
internal::remove_const< typenameArgType::Scalar >::type Scalar
Definition TensorCustomOp.h:87
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType data)
Definition TensorCustomOp.h:117
EIGEN_STRONG_INLINE TensorEvaluator(const ArgType &op, const Device &device)
Definition TensorCustomOp.h:109
StorageMemory< CoeffReturnType, Device > Storage
Definition TensorCustomOp.h:92
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition TensorCustomOp.h:89
internal::TensorBlockNotImplemented TensorBlock
Definition TensorCustomOp.h:106
DSizes< Index, NumDims > Dimensions
Definition TensorCustomOp.h:86
internal::traits< ArgType >::Index Index
Definition TensorCustomOp.h:84
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Definition TensorCustomOp.h:150
Storage::Type EvaluatorPointerType
Definition TensorCustomOp.h:93
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition TensorCustomOp.h:145
Dimensions m_dimensions
Definition TensorCustomOp.h:165
TensorCustomUnaryOp< CustomUnaryFunc, XprType > ArgType
Definition TensorCustomOp.h:83
EvaluatorPointerType m_result
Definition TensorCustomOp.h:168
EIGEN_DEVICE_FUNC PacketReturnType packet(Index index) const
Definition TensorCustomOp.h:141
const Device EIGEN_DEVICE_REF m_device
Definition TensorCustomOp.h:167
A cost model used to limit the number of threads used for evaluating tensor expression.
Definition TensorEvaluator.h:29
const Device EIGEN_DEVICE_REF m_device
Definition TensorEvaluator.h:192
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition TensorEvaluator.h:73
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
static const int PacketSize
Definition TensorEvaluator.h:36
const TensorCustomBinaryOp< CustomBinaryFunc, LhsXprType, RhsXprType > & type
Definition TensorCustomOp.h:205
const TensorCustomUnaryOp< CustomUnaryFunc, XprType > EIGEN_DEVICE_REF type
Definition TensorCustomOp.h:39
Definition XprHelper.h:332
TensorCustomBinaryOp< CustomBinaryFunc, LhsXprType, RhsXprType > type
Definition TensorCustomOp.h:211
TensorCustomUnaryOp< CustomUnaryFunc, XprType > type
Definition TensorCustomOp.h:45
Definition TensorTraits.h:175
promote_storage_type< typenametraits< LhsXprType >::StorageKind, typenametraits< RhsXprType >::StorageKind >::ret StorageKind
Definition TensorCustomOp.h:189
conditional< Pointer_type_promotion< typenameLhsXprType::Scalar, Scalar >::val, typenametraits< LhsXprType >::PointerType, typenametraits< RhsXprType >::PointerType >::type PointerType
Definition TensorCustomOp.h:199
internal::promote_storage_type< typenameLhsXprType::Scalar, typenameRhsXprType::Scalar >::ret Scalar
Definition TensorCustomOp.h:185
LhsXprType::Nested LhsNested
Definition TensorCustomOp.h:192
RhsXprType::Nested RhsNested
Definition TensorCustomOp.h:193
remove_reference< LhsNested >::type _LhsNested
Definition TensorCustomOp.h:194
promote_index_type< typenametraits< LhsXprType >::Index, typenametraits< RhsXprType >::Index >::type Index
Definition TensorCustomOp.h:191
remove_reference< RhsNested >::type _RhsNested
Definition TensorCustomOp.h:195
internal::promote_storage_type< typenameLhsXprType::CoeffReturnType, typenameRhsXprType::CoeffReturnType >::ret CoeffReturnType
Definition TensorCustomOp.h:187
traits< XprType >::PointerType PointerType
Definition TensorCustomOp.h:33
XprType::Index Index
Definition TensorCustomOp.h:28
XprType::Scalar Scalar
Definition TensorCustomOp.h:26
remove_reference< Nested >::type _Nested
Definition TensorCustomOp.h:30
XprType::StorageKind StorageKind
Definition TensorCustomOp.h:27
XprType::Nested Nested
Definition TensorCustomOp.h:29
Definition ForwardDeclarations.h:17
Definition benchGeometry.cpp:23