Go to the documentation of this file.
10 #ifndef EIGEN_SPARSEDENSEPRODUCT_H
11 #define EIGEN_SPARSEDENSEPRODUCT_H
20 template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType,
23 bool ColPerCol = ((DenseRhsType::Flags&
RowMajorBit)==0) || DenseRhsType::ColsAtCompileTime==1>
26 template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType>
34 static void run(
const SparseLhsType& lhs,
const DenseRhsType& rhs, DenseResType& res,
const typename Res::Scalar&
alpha)
39 #ifdef EIGEN_HAS_OPENMP
46 #ifdef EIGEN_HAS_OPENMP
49 if(threads>1 && lhsEval.nonZerosEstimate() > 20000)
51 #pragma omp parallel for schedule(dynamic,(n+threads*4-1)/(threads*4)) num_threads(threads)
53 processRow(lhsEval,rhs,res,
alpha,i,
c);
59 processRow(lhsEval,rhs,res,
alpha,i,
c);
68 tmp += it.value() * rhs.coeff(it.index(),
col);
85 template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType,
typename AlphaType>
92 static void run(
const SparseLhsType& lhs,
const DenseRhsType& rhs, DenseResType& res,
const AlphaType&
alpha)
97 for(
Index j=0; j<lhs.outerSize(); ++j)
102 res.coeffRef(it.index(),
c) += it.value() * rhs_j;
108 template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType>
115 static void run(
const SparseLhsType& lhs,
const DenseRhsType& rhs, DenseResType& res,
const typename Res::Scalar&
alpha)
118 for(
Index j=0; j<lhs.outerSize(); ++j)
122 res_j += (
alpha*it.value()) * rhs.row(it.index());
127 template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType>
134 static void run(
const SparseLhsType& lhs,
const DenseRhsType& rhs, DenseResType& res,
const typename Res::Scalar&
alpha)
137 for(
Index j=0; j<lhs.outerSize(); ++j)
141 res.row(it.index()) += (
alpha*it.value()) * rhs_j;
146 template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType,
typename AlphaType>
156 template<
typename Lhs,
typename Rhs,
int ProductType>
162 template<
typename Dest>
167 LhsNested lhsNested(lhs);
168 RhsNested rhsNested(rhs);
173 template<
typename Lhs,
typename Rhs,
int ProductType>
178 template<
typename Lhs,
typename Rhs,
int ProductType>
184 template<
typename Dst>
189 LhsNested lhsNested(lhs);
190 RhsNested rhsNested(rhs);
198 template<
typename Lhs,
typename Rhs,
int ProductType>
203 template<
typename LhsT,
typename RhsT,
bool NeedToTranspose>
249 return rhs.coeff(
outer);
254 typename RhsEval::InnerIterator it(rhs,
outer);
255 if (it && it.index()==0 && it.value()!=
Scalar(0))
286 template<
typename Lhs,
typename Rhs>
296 :
Base(xpr.lhs(), xpr.rhs())
301 template<
typename Lhs,
typename Rhs>
311 :
Base(xpr.lhs(), xpr.rhs())
320 #endif // EIGEN_SPARSEDENSEPRODUCT_H
internal::remove_all< DenseResType >::type Res
Product< Lhs, Rhs >::Scalar Scalar
XprType::PlainObject PlainObject
internal::remove_all< SparseLhsType >::type Lhs
Block< Derived, 1, internal::traits< Derived >::ColsAtCompileTime, IsRowMajor > RowXpr
EIGEN_STRONG_INLINE Index outer() const
internal::remove_all< DenseResType >::type Res
static void run(const SparseLhsType &lhs, const DenseRhsType &rhs, DenseResType &res, const typename Res::Scalar &alpha)
Product< Lhs, Rhs > XprType
EIGEN_DEVICE_FUNC ColXpr col(Index i)
This is the const version of col().
const unsigned int RowMajorBit
XprType::PlainObject PlainObject
evaluator< Lhs >::InnerIterator LhsInnerIterator
Scalar get(const RhsEval &rhs, Index outer, Sparse=Sparse())
evaluator< Lhs >::InnerIterator LhsInnerIterator
static void run(const SparseLhsType &lhs, const DenseRhsType &rhs, DenseResType &res, const AlphaType &alpha)
conditional< NeedToTranspose, RhsT, LhsT >::type Lhs1
evaluator< Lhs >::InnerIterator LhsInnerIterator
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
Product< Lhs, Rhs >::Scalar Scalar
evaluator< ActualLhs >::InnerIterator LhsIterator
Product< Lhs, Rhs > XprType
Expression of the transpose of a matrix.
sparse_dense_outer_product_evaluator< Lhs, Rhs, Lhs::IsRowMajor > Base
static void run(const SparseLhsType &lhs, const DenseRhsType &rhs, DenseResType &res, const typename Res::Scalar &alpha)
internal::remove_all< DenseRhsType >::type Rhs
product_evaluator(const XprType &xpr)
static void scaleAndAddTo(Dst &dst, const Lhs &lhs, const Rhs &rhs, const Scalar &alpha)
sparse_dense_outer_product_evaluator< Lhs, Rhs, Rhs::IsRowMajor > Base
void sparse_time_dense_product(const SparseLhsType &lhs, const DenseRhsType &rhs, DenseResType &res, const AlphaType &alpha)
evaluator< ActualLhs > m_lhsXprImpl
sparse_dense_outer_product_evaluator(const ActualRhs &rhs, const Lhs1 &lhs)
#define EIGEN_STRONG_INLINE
static void run(const SparseLhsType &lhs, const DenseRhsType &rhs, DenseResType &res, const typename Res::Scalar &alpha)
sparse_dense_outer_product_evaluator(const Lhs1 &lhs, const ActualRhs &rhs)
internal::remove_all< SparseLhsType >::type Lhs
Expression of the product of two arbitrary matrices or vectors.
static void scaleAndAddTo(Dest &dst, const Lhs &lhs, const Rhs &rhs, const Scalar &alpha)
internal::remove_all< SparseLhsType >::type Lhs
conditional< is_same< typename internal::traits< Lhs1 >::StorageKind, Sparse >::value, Lhs1 const &, SparseView< Lhs1 > >::type LhsArg
internal::remove_all< SparseLhsType >::type Lhs
internal::remove_all< DenseResType >::type Res
InnerIterator(const sparse_dense_outer_product_evaluator &xprEval, Index outer)
EIGEN_STRONG_INLINE Scalar value() const
internal::remove_all< DenseRhsType >::type Rhs
conditional< NeedToTranspose, LhsT, RhsT >::type ActualRhs
void run(Expr &expr, Dev &dev)
internal::remove_all< DenseRhsType >::type Rhs
Expression of a dense or sparse matrix with zero or too small values removed.
evaluator< ActualRhs > RhsEval
static void processRow(const LhsEval &lhsEval, const DenseRhsType &rhs, DenseResType &res, const typename Res::Scalar &alpha, Index i, Index col)
internal::remove_all< DenseRhsType >::type Rhs
ProdXprType::Scalar Scalar
evaluator< Lhs >::InnerIterator LhsInnerIterator
product_evaluator(const XprType &xpr)
internal::remove_all< DenseResType >::type Res
conditional< is_same< typename internal::traits< Lhs1 >::StorageKind, Sparse >::value, Lhs1, SparseView< Lhs1 > >::type ActualLhs
EIGEN_STRONG_INLINE Index col() const
Scalar get(const RhsEval &rhs, Index outer, Dense=Dense()) const
#define EIGEN_INTERNAL_CHECK_COST_VALUE(C)
EIGEN_STRONG_INLINE Index row() const
evaluator< ActualLhs > LhsEval
const typedef Block< const Derived, 1, internal::traits< Derived >::ColsAtCompileTime, IsRowMajor > ConstRowXpr
evaluator< ActualRhs > m_rhsXprImpl
Product< LhsT, RhsT, DefaultProduct > ProdXprType
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
control_box_rst
Author(s): Christoph Rösmann
autogenerated on Wed Mar 2 2022 00:06:18