11 #ifndef EIGEN_GENERAL_PRODUCT_H 12 #define EIGEN_GENERAL_PRODUCT_H 28 #ifndef EIGEN_CUDA_ARCH 29 is_large = MaxSize ==
Dynamic ||
71 #ifdef EIGEN_DEBUG_PRODUCT 144 template<
int S
ide,
int StorageOrder,
bool BlasCompatible>
153 template<
typename Scalar,
int Size,
int MaxSize>
159 template<
typename Scalar,
int Size>
165 template<
typename Scalar,
int Size,
int MaxSize>
172 #if EIGEN_MAX_STATIC_ALIGN_BYTES!=0 180 return ForceAlignment
188 template<
int StorageOrder,
bool BlasCompatible>
191 template<
typename Lhs,
typename Rhs,
typename Dest>
197 ::run(rhs.transpose(), lhs.transpose(), destT,
alpha);
203 template<
typename Lhs,
typename Rhs,
typename Dest>
212 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
214 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
218 ActualLhsType actualLhs = LhsBlasTraits::extract(lhs);
219 ActualRhsType actualRhs = RhsBlasTraits::extract(rhs);
221 ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(lhs)
222 * RhsBlasTraits::extractScalarFactor(rhs);
230 EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime==1),
232 MightCannotUseDest = (!EvalToDestAtCompileTime) || ComplexByReal
239 if(!MightCannotUseDest)
244 <
Index,LhsScalar,LhsMapper,
ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsMapper,RhsBlasTraits::NeedToConjugate>
::run(
245 actualLhs.rows(), actualLhs.cols(),
246 LhsMapper(actualLhs.data(), actualLhs.outerStride()),
247 RhsMapper(actualRhs.data(), actualRhs.innerStride()),
256 const bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible;
259 evalToDest ? dest.data() : static_dest.data());
263 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN 265 EIGEN_DENSE_STORAGE_CTOR_PLUGIN
267 if(!alphaIsCompatible)
269 MappedDest(actualDestPtr, dest.size()).
setZero();
270 compatibleAlpha = RhsScalar(1);
273 MappedDest(actualDestPtr, dest.size()) = dest;
277 <
Index,LhsScalar,LhsMapper,
ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsMapper,RhsBlasTraits::NeedToConjugate>
::run(
278 actualLhs.rows(), actualLhs.cols(),
279 LhsMapper(actualLhs.data(), actualLhs.outerStride()),
280 RhsMapper(actualRhs.data(), actualRhs.innerStride()),
286 if(!alphaIsCompatible)
287 dest.matrix() += actualAlpha * MappedDest(actualDestPtr, dest.size());
289 dest = MappedDest(actualDestPtr, dest.size());
297 template<
typename Lhs,
typename Rhs,
typename Dest>
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
325 DirectlyUseRhs ?
const_cast<RhsScalar*
>(actualRhs.
data()) : static_rhs.data());
329 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN 331 EIGEN_DENSE_STORAGE_CTOR_PLUGIN
339 <
Index,LhsScalar,LhsMapper,
RowMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsMapper,RhsBlasTraits::NeedToConjugate>
::run(
342 RhsMapper(actualRhsPtr, 1),
343 dest.data(), dest.col(0).innerStride(),
350 template<
typename Lhs,
typename Rhs,
typename Dest>
358 dest += (alpha*actual_rhs.
coeff(k)) * lhs.col(k);
364 template<
typename Lhs,
typename Rhs,
typename Dest>
371 dest.coeffRef(
i) += alpha * (lhs.row(
i).cwiseProduct(actual_rhs.transpose())).sum();
387 template<
typename Derived>
388 template<
typename OtherDerived>
397 ProductIsValid = Derived::ColsAtCompileTime==
Dynamic 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 429 template<
typename Derived>
430 template<
typename OtherDerived>
435 ProductIsValid = Derived::ColsAtCompileTime==
Dynamic 436 || OtherDerived::RowsAtCompileTime==
Dynamic 437 ||
int(Derived::ColsAtCompileTime)==
int(OtherDerived::RowsAtCompileTime),
438 AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime,
445 INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
447 INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
455 #endif // EIGEN_PRODUCT_H
#define EIGEN_STRONG_INLINE
Matrix< RealScalar, Dynamic, Dynamic > M
#define EIGEN_MAX_ALIGN_BYTES
Expression of the product of two arbitrary matrices or vectors.
EIGEN_DEVICE_FUNC Index cols() const
EIGEN_DEVICE_FUNC const Product< Derived, OtherDerived > operator*(const MatrixBase< OtherDerived > &other) const
#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. ...
EIGEN_DEVICE_FUNC ScalarWithConstIfNotLvalue * data()
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
#define EIGEN_SIZE_MIN_PREFER_FIXED(a, b)
virtual EIGEN_DEVICE_FUNC const Scalar coeff(DenseIndex index) const
internal::plain_array< Scalar, EIGEN_SIZE_MIN_PREFER_FIXED(Size, MaxSize)+(ForceAlignment?EIGEN_MAX_ALIGN_BYTES:0), 0 > m_data
EIGEN_DEVICE_FUNC Index outerStride() const
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 const Product< Derived, OtherDerived, LazyProduct > lazyProduct(const MatrixBase< OtherDerived > &other) const
NumTraits< Scalar >::Real RealScalar
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
EIGEN_STRONG_INLINE Scalar * data()
EIGEN_DEVICE_FUNC Index rows() const
static void run(const Lhs &lhs, const Rhs &rhs, Dest &dest, const typename Dest::Scalar &alpha)
EIGEN_STRONG_INLINE Scalar * data()
#define EIGEN_PREDICATE_SAME_MATRIX_SIZE(TYPE0, TYPE1)
#define EIGEN_PLAIN_ENUM_MIN(a, b)
EIGEN_DEVICE_FUNC const ImagReturnType imag() const
Expression of a diagonal/subdiagonal/superdiagonal in a matrix.
static void run(const Lhs &lhs, const Rhs &rhs, Dest &dest, const typename Dest::Scalar &alpha)
#define eigen_internal_assert(x)
static void run(const Lhs &lhs, const Rhs &rhs, Dest &dest, const typename Dest::Scalar &alpha)
void run(Expr &expr, Dev &dev)
product_type_selector< rows_select, cols_select, depth_select > selector
Base class for all dense matrices, vectors, and expressions.
EIGEN_STRONG_INLINE Scalar * data()