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 39 is_large = MaxSize ==
Dynamic ||
81 #ifdef EIGEN_DEBUG_PRODUCT 154 template<
int S
ide,
int StorageOrder,
bool BlasCompatible>
163 template<
typename Scalar,
int Size,
int MaxSize>
169 template<
typename Scalar,
int Size>
175 template<
typename Scalar,
int Size,
int MaxSize>
182 #if EIGEN_MAX_STATIC_ALIGN_BYTES!=0 190 return ForceAlignment
198 template<
int StorageOrder,
bool BlasCompatible>
201 template<
typename Lhs,
typename Rhs,
typename Dest>
207 ::run(rhs.transpose(), lhs.transpose(), destT,
alpha);
213 template<
typename Lhs,
typename Rhs,
typename Dest>
222 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
224 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
228 ActualLhsType actualLhs = LhsBlasTraits::extract(lhs);
229 ActualRhsType actualRhs = RhsBlasTraits::extract(rhs);
239 EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime==1),
241 MightCannotUseDest = ((!EvalToDestAtCompileTime) || ComplexByReal) && (ActualDest::MaxSizeAtCompileTime!=0)
248 if(!MightCannotUseDest)
253 <
Index,LhsScalar,LhsMapper,
ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsMapper,RhsBlasTraits::NeedToConjugate>
::run(
254 actualLhs.rows(), actualLhs.cols(),
255 LhsMapper(actualLhs.data(), actualLhs.outerStride()),
256 RhsMapper(actualRhs.data(), actualRhs.innerStride()),
265 const bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible;
268 evalToDest ? dest.data() : static_dest.data());
272 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN 274 EIGEN_DENSE_STORAGE_CTOR_PLUGIN
276 if(!alphaIsCompatible)
278 MappedDest(actualDestPtr, dest.size()).
setZero();
279 compatibleAlpha = RhsScalar(1);
282 MappedDest(actualDestPtr, dest.size()) = dest;
286 <
Index,LhsScalar,LhsMapper,
ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsMapper,RhsBlasTraits::NeedToConjugate>
::run(
287 actualLhs.rows(), actualLhs.cols(),
288 LhsMapper(actualLhs.data(), actualLhs.outerStride()),
289 RhsMapper(actualRhs.data(), actualRhs.innerStride()),
295 if(!alphaIsCompatible)
296 dest.matrix() += actualAlpha * MappedDest(actualDestPtr, dest.size());
298 dest = MappedDest(actualDestPtr, dest.size());
306 template<
typename Lhs,
typename Rhs,
typename Dest>
314 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
316 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
327 DirectlyUseRhs = ActualRhsTypeCleaned::InnerStrideAtCompileTime==1 || ActualRhsTypeCleaned::MaxSizeAtCompileTime==0
333 DirectlyUseRhs ?
const_cast<RhsScalar*
>(actualRhs.data()) : static_rhs.data());
337 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN 339 EIGEN_DENSE_STORAGE_CTOR_PLUGIN
347 <
Index,LhsScalar,LhsMapper,
RowMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsMapper,RhsBlasTraits::NeedToConjugate>
::run(
349 LhsMapper(actualLhs.data(), actualLhs.outerStride()),
350 RhsMapper(actualRhsPtr, 1),
351 dest.data(), dest.col(0).innerStride(),
358 template<
typename Lhs,
typename Rhs,
typename Dest>
366 dest += (alpha*actual_rhs.coeff(k)) * lhs.col(k);
372 template<
typename Lhs,
typename Rhs,
typename Dest>
379 dest.coeffRef(
i) += alpha * (lhs.row(
i).cwiseProduct(actual_rhs.transpose())).sum();
395 template<
typename Derived>
396 template<
typename OtherDerived>
406 ProductIsValid = Derived::ColsAtCompileTime==
Dynamic 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 438 template<
typename Derived>
439 template<
typename OtherDerived>
445 ProductIsValid = Derived::ColsAtCompileTime==
Dynamic 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)
465 #endif // EIGEN_PRODUCT_H
#define EIGEN_STRONG_INLINE
Matrix< RealScalar, Dynamic, Dynamic > M
Expression of the product of two arbitrary matrices or vectors.
#define EIGEN_DEBUG_VAR(x)
#define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
A matrix or vector expression mapping an existing array of data.
Expression of the transpose of a matrix.
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE To run(const From &x)
static void run(const Lhs &lhs, const Rhs &rhs, Dest &dest, const typename Dest::Scalar &alpha)
remove_all< Lhs >::type _Lhs
Namespace containing all symbols from the Eigen library.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
EIGEN_DEVICE_FUNC const Product< Derived, OtherDerived, LazyProduct > lazyProduct(const MatrixBase< OtherDerived > &other) const
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Scalar * data()
#define EIGEN_SIZE_MIN_PREFER_FIXED(a, b)
EIGEN_DEVICE_FUNC const Product< Derived, OtherDerived > operator*(const MatrixBase< OtherDerived > &other) const
static constexpr bool debug
internal::plain_array< Scalar, EIGEN_SIZE_MIN_PREFER_FIXED(Size, MaxSize)+(ForceAlignment?EIGEN_MAX_ALIGN_BYTES:0), 0 > m_data
remove_all< Rhs >::type _Rhs
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
static void run(const Lhs &lhs, const Rhs &rhs, Dest &dest, const typename Dest::Scalar &alpha)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE ResScalar combine_scalar_factors(const ResScalar &alpha, const Lhs &lhs, const Rhs &rhs)
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Scalar * data()
NumTraits< Scalar >::Real RealScalar
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
EIGEN_STRONG_INLINE Scalar * data()
EIGEN_CONSTEXPR Index size(const T &x)
#define EIGEN_DEVICE_FUNC
static void run(const Lhs &lhs, const Rhs &rhs, Dest &dest, const typename Dest::Scalar &alpha)
#define EIGEN_PREDICATE_SAME_MATRIX_SIZE(TYPE0, TYPE1)
#define EIGEN_PLAIN_ENUM_MIN(a, b)
EIGEN_DEVICE_FUNC const ImagReturnType imag() const
static void run(const Lhs &lhs, const Rhs &rhs, Dest &dest, const typename Dest::Scalar &alpha)
#define eigen_internal_assert(x)
Generic expression where a coefficient-wise unary operator is applied to an expression.
static void run(const Lhs &lhs, const Rhs &rhs, Dest &dest, const typename Dest::Scalar &alpha)
product_type_selector< rows_select, cols_select, depth_select > selector
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Base class for all dense matrices, vectors, and expressions.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT