10 #ifndef EIGEN_SPARSESPARSEPRODUCTWITHPRUNING_H
11 #define EIGEN_SPARSESPARSEPRODUCTWITHPRUNING_H
19 template<
typename Lhs,
typename Rhs,
typename ResultType>
38 if(ResultType::IsRowMajor)
52 Index estimated_nnz_prod = lhsEval.nonZerosEstimate() + rhsEval.nonZerosEstimate();
54 res.reserve(estimated_nnz_prod);
55 double ratioColRes = double(estimated_nnz_prod)/(double(lhs.rows())*double(rhs.cols()));
61 tempVector.
init(ratioColRes);
67 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,
81 int LhsStorageOrder = traits<Lhs>::Flags&
RowMajorBit,
82 int RhsStorageOrder = traits<Rhs>::Flags&
RowMajorBit,
83 int ResStorageOrder = traits<ResultType>::Flags&
RowMajorBit>
86 template<
typename Lhs,
typename Rhs,
typename ResultType>
94 internal::sparse_sparse_product_with_pruning_impl<Lhs,Rhs,ResultType>(lhs, rhs, _res, tolerance);
99 template<
typename Lhs,
typename Rhs,
typename ResultType>
107 SparseTemporaryType _res(
res.rows(),
res.cols());
108 internal::sparse_sparse_product_with_pruning_impl<Lhs,Rhs,SparseTemporaryType>(lhs, rhs, _res, tolerance);
113 template<
typename Lhs,
typename Rhs,
typename ResultType>
121 internal::sparse_sparse_product_with_pruning_impl<Rhs,Lhs,ResultType>(rhs, lhs, _res, tolerance);
126 template<
typename Lhs,
typename Rhs,
typename ResultType>
134 ColMajorMatrixLhs colLhs(lhs);
135 ColMajorMatrixRhs colRhs(rhs);
136 internal::sparse_sparse_product_with_pruning_impl<ColMajorMatrixLhs,ColMajorMatrixRhs,ResultType>(colLhs, colRhs,
res, tolerance);
146 template<
typename Lhs,
typename Rhs,
typename ResultType>
153 RowMajorMatrixLhs rowLhs(lhs);
158 template<
typename Lhs,
typename Rhs,
typename ResultType>
165 RowMajorMatrixRhs rowRhs(rhs);
170 template<
typename Lhs,
typename Rhs,
typename ResultType>
177 ColMajorMatrixRhs colRhs(rhs);
178 internal::sparse_sparse_product_with_pruning_impl<Lhs,ColMajorMatrixRhs,ResultType>(lhs, colRhs,
res, tolerance);
182 template<
typename Lhs,
typename Rhs,
typename ResultType>
189 ColMajorMatrixLhs colLhs(lhs);
190 internal::sparse_sparse_product_with_pruning_impl<ColMajorMatrixLhs,Rhs,ResultType>(colLhs, rhs,
res, tolerance);
198 #endif // EIGEN_SPARSESPARSEPRODUCTWITHPRUNING_H