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)
68 tmp += it.value() * rhs.coeff(it.index(),
col);
85 template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType,
typename AlphaType>
93 static void run(
const SparseLhsType& lhs,
const DenseRhsType& rhs, DenseResType&
res,
const AlphaType&
alpha)
98 for(
Index j=0;
j<lhs.outerSize(); ++
j)
103 res.coeffRef(it.index(),
c) += it.value() * rhs_j;
109 template<
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)
145 res_i += (
alpha*it.value()) * rhs.row(it.index());
149 template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType>
159 for(
Index j=0;
j<lhs.outerSize(); ++
j)
163 res.row(it.index()) += (
alpha*it.value()) * rhs_j;
168 template<
typename SparseLhsType,
typename DenseRhsType,
typename DenseResType,
typename AlphaType>
178 template<
typename Lhs,
typename Rhs,
int ProductType>
184 template<
typename Dest>
189 LhsNested lhsNested(lhs);
190 RhsNested rhsNested(rhs);
195 template<
typename Lhs,
typename Rhs,
int ProductType>
200 template<
typename Lhs,
typename Rhs,
int ProductType>
206 template<
typename Dst>
211 LhsNested lhsNested(lhs);
212 RhsNested rhsNested(rhs);
220 template<
typename Lhs,
typename Rhs,
int ProductType>
225 template<
typename LhsT,
typename RhsT,
bool NeedToTranspose>
271 return rhs.coeff(
outer);
276 typename RhsEval::InnerIterator it(rhs,
outer);
277 if (it && it.index()==0 && it.value()!=
Scalar(0))
308 template<
typename Lhs,
typename Rhs>
318 :
Base(xpr.lhs(), xpr.rhs())
323 template<
typename Lhs,
typename Rhs>
333 :
Base(xpr.lhs(), xpr.rhs())
342 #endif // EIGEN_SPARSEDENSEPRODUCT_H
internal::remove_all< DenseResType >::type Res
Product< Lhs, Rhs >::Scalar Scalar
XprType::PlainObject PlainObject
internal::remove_all< SparseLhsType >::type Lhs
Namespace containing all symbols from the Eigen library.
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
const unsigned int RowMajorBit
XprType::PlainObject PlainObject
evaluator< Lhs >::InnerIterator LhsInnerIterator
Scalar get(const RhsEval &rhs, Index outer, Sparse=Sparse())
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...
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Product< Lhs, Rhs >::Scalar Scalar
evaluator< ActualLhs >::InnerIterator LhsIterator
Product< Lhs, Rhs > XprType
LhsEval::InnerIterator LhsInnerIterator
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
LhsEval::InnerIterator LhsInnerIterator
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
Eigen::SparseMatrix< double > Sparse
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
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
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
static void processRow(const LhsEval &lhsEval, const DenseRhsType &rhs, Res &res, const typename Res::Scalar &alpha, Index i)
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.
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:35:41