11#ifndef EIGEN_GENERAL_PRODUCT_H
12#define EIGEN_GENERAL_PRODUCT_H
26#ifndef EIGEN_GEMM_TO_COEFFBASED_THRESHOLD
28#define EIGEN_GEMM_TO_COEFFBASED_THRESHOLD 20
38 #ifndef EIGEN_GPU_COMPILE_PHASE
40 Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD ||
41 (Size==
Dynamic && MaxSize>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD),
53 typedef typename remove_all<Lhs>::type _Lhs;
54 typedef typename remove_all<Rhs>::type _Rhs;
78 value = selector::ret,
81#ifdef EIGEN_DEBUG_PRODUCT
84 EIGEN_DEBUG_VAR(Rows);
85 EIGEN_DEBUG_VAR(Cols);
86 EIGEN_DEBUG_VAR(Depth);
87 EIGEN_DEBUG_VAR(rows_select);
88 EIGEN_DEBUG_VAR(cols_select);
89 EIGEN_DEBUG_VAR(depth_select);
90 EIGEN_DEBUG_VAR(value);
154template<
int S
ide,
int StorageOrder,
bool BlasCompatible>
163template<
typename Scalar,
int Size,
int MaxSize>
166 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Scalar* data() { eigen_internal_assert(
false &&
"should never be called");
return 0; }
169template<
typename Scalar,
int Size>
172 EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Scalar* data() {
return 0; }
175template<
typename Scalar,
int Size,
int MaxSize>
182 #if EIGEN_MAX_STATIC_ALIGN_BYTES!=0
183 internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize),0,EIGEN_PLAIN_ENUM_MIN(AlignedMax,PacketSize)> m_data;
184 EIGEN_STRONG_INLINE Scalar* data() {
return m_data.array; }
188 internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize)+(ForceAlignment?EIGEN_MAX_ALIGN_BYTES:0),0> m_data;
189 EIGEN_STRONG_INLINE Scalar* data() {
190 return ForceAlignment
191 ?
reinterpret_cast<Scalar*
>((internal::UIntPtr(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES-1))) + EIGEN_MAX_ALIGN_BYTES)
198template<
int StorageOrder,
bool BlasCompatible>
201 template<
typename Lhs,
typename Rhs,
typename Dest>
202 static void run(
const Lhs &lhs,
const Rhs &rhs,
Dest& dest,
const typename Dest::Scalar& alpha)
207 ::run(rhs.transpose(), lhs.transpose(),
destT, alpha);
213 template<
typename Lhs,
typename Rhs,
typename Dest>
214 static inline void run(
const Lhs &lhs,
const Rhs &rhs,
Dest& dest,
const typename Dest::Scalar& alpha)
216 typedef typename Lhs::Scalar LhsScalar;
217 typedef typename Rhs::Scalar RhsScalar;
218 typedef typename Dest::Scalar ResScalar;
219 typedef typename Dest::RealScalar RealScalar;
222 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
224 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
228 ActualLhsType
actualLhs = LhsBlasTraits::extract(lhs);
229 ActualRhsType
actualRhs = RhsBlasTraits::extract(rhs);
231 ResScalar
actualAlpha = combine_scalar_factors(alpha, lhs, rhs);
267 ei_declare_aligned_stack_constructed_variable(ResScalar,
actualDestPtr,dest.size(),
272 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
273 Index size = dest.size();
306 template<
typename Lhs,
typename Rhs,
typename Dest>
307 static void run(
const Lhs &lhs,
const Rhs &rhs,
Dest& dest,
const typename Dest::Scalar& alpha)
309 typedef typename Lhs::Scalar LhsScalar;
310 typedef typename Rhs::Scalar RhsScalar;
311 typedef typename Dest::Scalar ResScalar;
314 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
316 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
317 typedef typename internal::remove_all<ActualRhsType>::type ActualRhsTypeCleaned;
319 typename add_const<ActualLhsType>::type
actualLhs = LhsBlasTraits::extract(lhs);
320 typename add_const<ActualRhsType>::type
actualRhs = RhsBlasTraits::extract(rhs);
322 ResScalar
actualAlpha = combine_scalar_factors(alpha, lhs, rhs);
327 DirectlyUseRhs = ActualRhsTypeCleaned::InnerStrideAtCompileTime==1 || ActualRhsTypeCleaned::MaxSizeAtCompileTime==0
337 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
351 dest.data(), dest.col(0).innerStride(),
358 template<
typename Lhs,
typename Rhs,
typename Dest>
359 static void run(
const Lhs &lhs,
const Rhs &rhs,
Dest& dest,
const typename Dest::Scalar& alpha)
364 const Index size = rhs.rows();
365 for(
Index k=0; k<size; ++k)
366 dest += (alpha*
actual_rhs.coeff(k)) * lhs.col(k);
372 template<
typename Lhs,
typename Rhs,
typename Dest>
373 static void run(
const Lhs &lhs,
const Rhs &rhs,
Dest& dest,
const typename Dest::Scalar& alpha)
377 const Index rows = dest.rows();
378 for(
Index i=0; i<rows; ++i)
395template<
typename Derived>
396template<
typename OtherDerived>
397EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
407 || OtherDerived::RowsAtCompileTime==
Dynamic
408 || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime),
409 AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime,
416 INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
418 INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
420#ifdef EIGEN_DEBUG_PRODUCT
438template<
typename Derived>
439template<
typename OtherDerived>
440EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
446 || OtherDerived::RowsAtCompileTime==
Dynamic
447 || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime),
448 AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime,
455 INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
457 INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
EIGEN_DEVICE_FUNC Derived & setZero()
Sets all coefficients in this expression to zero.
Definition CwiseNullaryOp.h:546
EIGEN_DEVICE_FUNC TransposeReturnType transpose()
Definition Transpose.h:182
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition Constants.h:319
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition Constants.h:321
@ OnTheLeft
Apply transformation on the left.
Definition Constants.h:332
@ OnTheRight
Apply transformation on the right.
Definition Constants.h:334
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition Constants.h:22
Holds information about the various numeric (i.e.
Definition NumTraits.h:236
Definition BlasUtil.h:403
Definition GeneralProduct.h:155
Definition GeneralProduct.h:161
Definition XprHelper.h:458
Definition GenericPacketMath.h:107
Definition DenseStorage.h:45
Definition GeneralProduct.h:36
Definition GeneralProduct.h:33
Definition GeneralProduct.h:52
Definition ForwardDeclarations.h:17