10#ifndef EIGEN_SPARSEDENSEPRODUCT_H
11#define EIGEN_SPARSEDENSEPRODUCT_H
26template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType>
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)
66 typename Res::Scalar
tmp(0);
85template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType,
typename AlphaType>
98 for(
Index j=0;
j<lhs.outerSize(); ++
j)
109template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType>
122#ifdef EIGEN_HAS_OPENMP
127 if(threads>1 &&
lhsEval.nonZerosEstimate()*rhs.cols() > 20000)
129 #pragma omp parallel for schedule(dynamic,(n+threads*4-1)/(threads*4)) num_threads(threads)
149template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType>
159 for(
Index j=0;
j<lhs.outerSize(); ++
j)
161 typename Rhs::ConstRowXpr
rhs_j(rhs.row(
j));
168template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType,
typename AlphaType>
178template<
typename Lhs,
typename Rhs,
int ProductType>
184 template<
typename Dest>
195template<
typename Lhs,
typename Rhs,
int ProductType>
200template<
typename Lhs,
typename Rhs,
int ProductType>
206 template<
typename Dst>
220template<
typename Lhs,
typename Rhs,
int ProductType>
225template<
typename LhsT,
typename RhsT,
bool NeedToTranspose>
243 typedef typename ProdXprType::Scalar
Scalar;
271 return rhs.coeff(
outer);
276 typename RhsEval::InnerIterator
it(rhs,
outer);
308template<
typename Lhs,
typename Rhs>
323template<
typename Lhs,
typename Rhs>
int n
Definition BiCGSTAB_simple.cpp:1
int i
Definition BiCGSTAB_step_by_step.cpp:9
#define EIGEN_STRONG_INLINE
Definition Macros.h:917
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition PartialRedux_count.cpp:3
#define EIGEN_INTERNAL_CHECK_COST_VALUE(C)
Definition StaticAssert.h:218
Scalar Scalar * c
Definition benchVecAdd.cpp:17
SCALAR Scalar
Definition bench_gemm.cpp:46
Expression of the product of two arbitrary matrices or vectors.
Definition Product.h:75
Definition TensorRef.h:81
Definition SparseDenseProduct.h:252
EIGEN_STRONG_INLINE Index outer() const
Definition SparseDenseProduct.h:261
Scalar m_factor
Definition SparseDenseProduct.h:285
Scalar get(const RhsEval &rhs, Index outer, Sparse=Sparse())
Definition SparseDenseProduct.h:274
EIGEN_STRONG_INLINE Scalar value() const
Definition SparseDenseProduct.h:265
InnerIterator(const sparse_dense_outer_product_evaluator &xprEval, Index outer)
Definition SparseDenseProduct.h:254
EIGEN_STRONG_INLINE Index col() const
Definition SparseDenseProduct.h:263
bool m_empty
Definition SparseDenseProduct.h:284
Scalar get(const RhsEval &rhs, Index outer, Dense=Dense()) const
Definition SparseDenseProduct.h:269
EIGEN_STRONG_INLINE Index row() const
Definition SparseDenseProduct.h:262
Index m_outer
Definition SparseDenseProduct.h:283
@ ColMajor
Definition Constants.h:319
@ RowMajor
Definition Constants.h:321
const unsigned int RowMajorBit
Definition Constants.h:66
RealScalar alpha
Definition level1_cplx_impl.h:147
@ Lhs
Definition TensorContractionMapper.h:19
@ Rhs
Definition TensorContractionMapper.h:18
void sparse_time_dense_product(const SparseLhsType &lhs, const DenseRhsType &rhs, DenseResType &res, const AlphaType &alpha)
Definition SparseDenseProduct.h:169
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
@ DefaultProduct
Definition Constants.h:500
@ OuterProduct
Definition Constants.h:500
const int HugeCost
Definition Constants.h:44
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
void initParallel()
Definition Parallelizer.h:53
int nbThreads()
Definition Parallelizer.h:63
const int Dynamic
Definition Constants.h:22
Definition BandTriangularSolver.h:13
Definition Constants.h:528
Definition Constants.h:507
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
Definition XprHelper.h:806
Definition Constants.h:537
Definition Constants.h:510
Definition SparseUtil.h:137
Definition CoreEvaluators.h:91
static void scaleAndAddTo(Dst &dst, const Lhs &lhs, const Rhs &rhs, const Scalar &alpha)
Definition SparseDenseProduct.h:207
Product< Lhs, Rhs >::Scalar Scalar
Definition SparseDenseProduct.h:204
Product< Lhs, Rhs >::Scalar Scalar
Definition SparseDenseProduct.h:182
static void scaleAndAddTo(Dest &dst, const Lhs &lhs, const Rhs &rhs, const Scalar &alpha)
Definition SparseDenseProduct.h:185
Definition ProductEvaluators.h:344
Definition ProductEvaluators.h:86
Definition CXX11Meta.h:115
Definition XprHelper.h:458
XprType::PlainObject PlainObject
Definition SparseDenseProduct.h:315
product_evaluator(const XprType &xpr)
Definition SparseDenseProduct.h:317
sparse_dense_outer_product_evaluator< Lhs, Rhs, Lhs::IsRowMajor > Base
Definition SparseDenseProduct.h:312
Product< Lhs, Rhs > XprType
Definition SparseDenseProduct.h:314
Product< Lhs, Rhs > XprType
Definition SparseDenseProduct.h:329
XprType::PlainObject PlainObject
Definition SparseDenseProduct.h:330
sparse_dense_outer_product_evaluator< Lhs, Rhs, Rhs::IsRowMajor > Base
Definition SparseDenseProduct.h:327
product_evaluator(const XprType &xpr)
Definition SparseDenseProduct.h:332
Definition ForwardDeclarations.h:164
Definition SparseDenseProduct.h:227
evaluator< ActualLhs > m_lhsXprImpl
Definition SparseDenseProduct.h:303
evaluator< ActualRhs > m_rhsXprImpl
Definition SparseDenseProduct.h:304
ProdXprType::Scalar Scalar
Definition SparseDenseProduct.h:243
conditional< is_same< typenameinternal::traits< Lhs1 >::StorageKind, Sparse >::value, Lhs1const &, SparseView< Lhs1 > >::type LhsArg
Definition SparseDenseProduct.h:238
sparse_dense_outer_product_evaluator(const Lhs1 &lhs, const ActualRhs &rhs)
Definition SparseDenseProduct.h:288
conditional< is_same< typenameinternal::traits< Lhs1 >::StorageKind, Sparse >::value, Lhs1, SparseView< Lhs1 > >::type ActualLhs
Definition SparseDenseProduct.h:236
conditional< NeedToTranspose, LhsT, RhsT >::type ActualRhs
Definition SparseDenseProduct.h:230
sparse_dense_outer_product_evaluator(const ActualRhs &rhs, const Lhs1 &lhs)
Definition SparseDenseProduct.h:295
conditional< NeedToTranspose, RhsT, LhsT >::type Lhs1
Definition SparseDenseProduct.h:229
evaluator< ActualRhs > RhsEval
Definition SparseDenseProduct.h:241
Product< LhsT, RhsT, DefaultProduct > ProdXprType
Definition SparseDenseProduct.h:231
@ Flags
Definition SparseDenseProduct.h:247
@ CoeffReadCost
Definition SparseDenseProduct.h:248
const LhsArg m_lhs
Definition SparseDenseProduct.h:302
evaluator< ActualLhs >::InnerIterator LhsIterator
Definition SparseDenseProduct.h:242
evaluator< ActualLhs > LhsEval
Definition SparseDenseProduct.h:240
internal::remove_all< SparseLhsType >::type Lhs
Definition SparseDenseProduct.h:88
LhsEval::InnerIterator LhsInnerIterator
Definition SparseDenseProduct.h:92
internal::remove_all< DenseResType >::type Res
Definition SparseDenseProduct.h:90
evaluator< Lhs > LhsEval
Definition SparseDenseProduct.h:91
static void run(const SparseLhsType &lhs, const DenseRhsType &rhs, DenseResType &res, const AlphaType &alpha)
Definition SparseDenseProduct.h:93
internal::remove_all< DenseRhsType >::type Rhs
Definition SparseDenseProduct.h:89
static void run(const SparseLhsType &lhs, const DenseRhsType &rhs, DenseResType &res, const typename Res::Scalar &alpha)
Definition SparseDenseProduct.h:156
internal::remove_all< SparseLhsType >::type Lhs
Definition SparseDenseProduct.h:152
internal::remove_all< DenseResType >::type Res
Definition SparseDenseProduct.h:154
internal::remove_all< DenseRhsType >::type Rhs
Definition SparseDenseProduct.h:153
evaluator< Lhs >::InnerIterator LhsInnerIterator
Definition SparseDenseProduct.h:155
internal::remove_all< DenseRhsType >::type Rhs
Definition SparseDenseProduct.h:30
evaluator< Lhs > LhsEval
Definition SparseDenseProduct.h:33
internal::remove_all< DenseResType >::type Res
Definition SparseDenseProduct.h:31
evaluator< Lhs >::InnerIterator LhsInnerIterator
Definition SparseDenseProduct.h:32
static void processRow(const LhsEval &lhsEval, const DenseRhsType &rhs, DenseResType &res, const typename Res::Scalar &alpha, Index i, Index col)
Definition SparseDenseProduct.h:64
static void run(const SparseLhsType &lhs, const DenseRhsType &rhs, DenseResType &res, const typename Res::Scalar &alpha)
Definition SparseDenseProduct.h:34
internal::remove_all< SparseLhsType >::type Lhs
Definition SparseDenseProduct.h:29
internal::remove_all< SparseLhsType >::type Lhs
Definition SparseDenseProduct.h:112
internal::remove_all< DenseResType >::type Res
Definition SparseDenseProduct.h:114
static void run(const SparseLhsType &lhs, const DenseRhsType &rhs, DenseResType &res, const typename Res::Scalar &alpha)
Definition SparseDenseProduct.h:117
evaluator< Lhs > LhsEval
Definition SparseDenseProduct.h:115
static void processRow(const LhsEval &lhsEval, const DenseRhsType &rhs, Res &res, const typename Res::Scalar &alpha, Index i)
Definition SparseDenseProduct.h:141
internal::remove_all< DenseRhsType >::type Rhs
Definition SparseDenseProduct.h:113
LhsEval::InnerIterator LhsInnerIterator
Definition SparseDenseProduct.h:116
Definition SparseDenseProduct.h:24
Definition ForwardDeclarations.h:17
std::ptrdiff_t j
Definition tut_arithmetic_redux_minmax.cpp:2