10 #ifndef EIGEN_SPARSESPARSEPRODUCTWITHPRUNING_H
11 #define EIGEN_SPARSESPARSEPRODUCTWITHPRUNING_H
21 template <
typename Lhs,
typename Rhs,
typename ResultType>
40 if (ResultType::IsRowMajor)
54 Index estimated_nnz_prod = lhsEval.nonZerosEstimate() + rhsEval.nonZerosEstimate();
56 res.reserve(estimated_nnz_prod);
57 double ratioColRes =
double(estimated_nnz_prod) / (
double(lhs.rows()) *
double(rhs.cols()));
63 tempVector.
init(ratioColRes);
68 RhsScalar
x = rhsIt.value();
70 tempVector.
coeffRef(lhsIt.index()) += lhsIt.value() *
x;
75 res.insertBackByOuterInner(
j, it.index()) = it.value();
80 template <typename Lhs, typename Rhs, typename ResultType, int LhsStorageOrder = traits<Lhs>::Flags &
RowMajorBit,
81 int RhsStorageOrder = traits<Rhs>::Flags &
RowMajorBit,
82 int ResStorageOrder = traits<ResultType>::Flags &
RowMajorBit>
85 template <
typename Lhs,
typename Rhs,
typename ResultType>
91 internal::sparse_sparse_product_with_pruning_impl<Lhs, Rhs, ResultType>(lhs, rhs, res_, tolerance);
96 template <
typename Lhs,
typename Rhs,
typename ResultType>
102 SparseTemporaryType res_(
res.rows(),
res.cols());
103 internal::sparse_sparse_product_with_pruning_impl<Lhs, Rhs, SparseTemporaryType>(lhs, rhs, res_, tolerance);
108 template <
typename Lhs,
typename Rhs,
typename ResultType>
114 internal::sparse_sparse_product_with_pruning_impl<Rhs, Lhs, ResultType>(rhs, lhs, res_, tolerance);
119 template <
typename Lhs,
typename Rhs,
typename ResultType>
125 ColMajorMatrixLhs colLhs(lhs);
126 ColMajorMatrixRhs colRhs(rhs);
127 internal::sparse_sparse_product_with_pruning_impl<ColMajorMatrixLhs, ColMajorMatrixRhs, ResultType>(colLhs, colRhs,
138 template <
typename Lhs,
typename Rhs,
typename ResultType>
143 RowMajorMatrixLhs rowLhs(lhs);
149 template <
typename Lhs,
typename Rhs,
typename ResultType>
154 RowMajorMatrixRhs rowRhs(rhs);
156 lhs, rowRhs,
res, tolerance);
160 template <
typename Lhs,
typename Rhs,
typename ResultType>
165 ColMajorMatrixRhs colRhs(rhs);
166 internal::sparse_sparse_product_with_pruning_impl<Lhs, ColMajorMatrixRhs, ResultType>(lhs, colRhs,
res, tolerance);
170 template <
typename Lhs,
typename Rhs,
typename ResultType>
175 ColMajorMatrixLhs colLhs(lhs);
176 internal::sparse_sparse_product_with_pruning_impl<ColMajorMatrixLhs, Rhs, ResultType>(colLhs, rhs,
res, tolerance);
#define eigen_assert(x)
Definition: Macros.h:910
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
NumTraits< Scalar >::Real RealScalar
Definition: bench_gemm.cpp:46
A versatible sparse matrix representation.
Definition: SparseMatrix.h:121
Definition: AmbiVector.h:251
Definition: AmbiVector.h:26
Scalar & coeffRef(Index i)
Definition: AmbiVector.h:171
void setZero()
Definition: AmbiVector.h:160
void init(double estimatedDensity)
Definition: AmbiVector.h:130
void restart()
Definition: AmbiVector.h:154
@ ColMajor
Definition: Constants.h:318
@ RowMajor
Definition: Constants.h:320
const unsigned int RowMajorBit
Definition: Constants.h:70
static void sparse_sparse_product_with_pruning_impl(const Lhs &lhs, const Rhs &rhs, ResultType &res, const typename ResultType::RealScalar &tolerance)
Definition: SparseSparseProductWithPruning.h:22
@ Lhs
Definition: TensorContractionMapper.h:20
@ Rhs
Definition: TensorContractionMapper.h:20
typename remove_all< T >::type remove_all_t
Definition: Meta.h:142
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
Definition: Eigen_Colamd.h:49
list x
Definition: plotDoE.py:28
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition: SparseSparseProductWithPruning.h:99
ResultType::RealScalar RealScalar
Definition: SparseSparseProductWithPruning.h:98
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition: SparseSparseProductWithPruning.h:111
ResultType::RealScalar RealScalar
Definition: SparseSparseProductWithPruning.h:110
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition: SparseSparseProductWithPruning.h:122
ResultType::RealScalar RealScalar
Definition: SparseSparseProductWithPruning.h:121
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition: SparseSparseProductWithPruning.h:163
ResultType::RealScalar RealScalar
Definition: SparseSparseProductWithPruning.h:162
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition: SparseSparseProductWithPruning.h:141
ResultType::RealScalar RealScalar
Definition: SparseSparseProductWithPruning.h:140
ResultType::RealScalar RealScalar
Definition: SparseSparseProductWithPruning.h:87
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition: SparseSparseProductWithPruning.h:89
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition: SparseSparseProductWithPruning.h:173
ResultType::RealScalar RealScalar
Definition: SparseSparseProductWithPruning.h:172
ResultType::RealScalar RealScalar
Definition: SparseSparseProductWithPruning.h:151
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition: SparseSparseProductWithPruning.h:152
Definition: SparseSparseProductWithPruning.h:83
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2