11#ifndef EIGEN_GENERAL_PRODUCT_H
12#define EIGEN_GENERAL_PRODUCT_H
27 enum {
is_large = MaxSize == Dynamic ||
28 Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD,
62 value = selector::ret,
65#ifdef EIGEN_DEBUG_PRODUCT
68 EIGEN_DEBUG_VAR(Rows);
69 EIGEN_DEBUG_VAR(Cols);
70 EIGEN_DEBUG_VAR(Depth);
71 EIGEN_DEBUG_VAR(rows_select);
72 EIGEN_DEBUG_VAR(cols_select);
73 EIGEN_DEBUG_VAR(depth_select);
74 EIGEN_DEBUG_VAR(value);
162template<
int S
ide,
int StorageOrder,
bool BlasCompatible>
171template<
typename Scalar,
int Size,
int MaxSize>
174 EIGEN_STRONG_INLINE Scalar* data() { eigen_internal_assert(
false &&
"should never be called");
return 0; }
177template<
typename Scalar,
int Size>
180 EIGEN_STRONG_INLINE Scalar* data() {
return 0; }
183template<
typename Scalar,
int Size,
int MaxSize>
186 #if EIGEN_MAX_STATIC_ALIGN_BYTES!=0
188 EIGEN_STRONG_INLINE Scalar* data() {
return m_data.array; }
196 internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize)+(ForceAlignment?PacketSize:0),0> m_data;
197 EIGEN_STRONG_INLINE Scalar* data() {
198 return ForceAlignment
199 ?
reinterpret_cast<Scalar*
>((
reinterpret_cast<size_t>(m_data.array) & ~(
size_t(EIGEN_MAX_ALIGN_BYTES-1))) + EIGEN_MAX_ALIGN_BYTES)
206template<
int StorageOrder,
bool BlasCompatible>
209 template<
typename Lhs,
typename Rhs,
typename Dest>
210 static void run(
const Lhs &lhs,
const Rhs &rhs,
Dest& dest,
const typename Dest::Scalar& alpha)
215 ::run(rhs.transpose(), lhs.transpose(),
destT, alpha);
221 template<
typename Lhs,
typename Rhs,
typename Dest>
222 static inline void run(
const Lhs &lhs,
const Rhs &rhs,
Dest& dest,
const typename Dest::Scalar& alpha)
224 typedef typename Lhs::Scalar LhsScalar;
225 typedef typename Rhs::Scalar RhsScalar;
226 typedef typename Dest::Scalar ResScalar;
227 typedef typename Dest::RealScalar RealScalar;
230 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
232 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
236 ActualLhsType
actualLhs = LhsBlasTraits::extract(lhs);
237 ActualRhsType
actualRhs = RhsBlasTraits::extract(rhs);
239 ResScalar
actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(lhs)
240 * RhsBlasTraits::extractScalarFactor(rhs);
257 ei_declare_aligned_stack_constructed_variable(ResScalar,
actualDestPtr,dest.size(),
262 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
263 Index size = dest.size();
297 template<
typename Lhs,
typename Rhs,
typename Dest>
298 static void run(
const Lhs &lhs,
const Rhs &rhs,
Dest& dest,
const typename Dest::Scalar& alpha)
300 typedef typename Lhs::Scalar LhsScalar;
301 typedef typename Rhs::Scalar RhsScalar;
302 typedef typename Dest::Scalar ResScalar;
305 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
307 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
313 ResScalar
actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(lhs)
314 * RhsBlasTraits::extractScalarFactor(rhs);
319 DirectlyUseRhs = ActualRhsTypeCleaned::InnerStrideAtCompileTime==1
329 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
343 dest.data(), dest.innerStride(),
350 template<
typename Lhs,
typename Rhs,
typename Dest>
351 static void run(
const Lhs &lhs,
const Rhs &rhs,
Dest& dest,
const typename Dest::Scalar& alpha)
355 const Index size = rhs.rows();
356 for(Index k=0; k<size; ++k)
357 dest += (alpha*
actual_rhs.coeff(k)) * lhs.col(k);
363 template<
typename Lhs,
typename Rhs,
typename Dest>
364 static void run(
const Lhs &lhs,
const Rhs &rhs,
Dest& dest,
const typename Dest::Scalar& alpha)
367 const Index rows = dest.rows();
368 for(Index i=0; i<rows; ++i)
369 dest.coeffRef(i) += alpha * (lhs.row(i).cwiseProduct(
actual_rhs.transpose())).sum();
387template<
typename Derived>
388template<
typename OtherDerived>
398 || OtherDerived::RowsAtCompileTime==Dynamic
399 || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime),
400 AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime,
407 INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
409 INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
411#ifdef EIGEN_DEBUG_PRODUCT
431template<
typename Derived>
432template<
typename OtherDerived>
438 || OtherDerived::RowsAtCompileTime==Dynamic
439 || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime),
440 AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime,
447 INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
449 INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
Pseudo expression representing a solving operation.
Definition Solve.h:63
@ Aligned
Definition Constants.h:235
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition Constants.h:320
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition Constants.h:322
@ OnTheLeft
Apply transformation on the left.
Definition Constants.h:333
@ OnTheRight
Apply transformation on the right.
Definition Constants.h:335
Holds information about the various numeric (i.e.
Definition NumTraits.h:108
Definition BlasUtil.h:257
Definition GeneralProduct.h:163
Definition GeneralProduct.h:169
Definition BlasUtil.h:113
Definition GenericPacketMath.h:90
Definition DenseStorage.h:45
Definition GeneralProduct.h:26
Definition GeneralProduct.h:23
Definition GeneralProduct.h:36
Definition ForwardDeclarations.h:17