10 #ifndef EIGEN_CONSERVATIVESPARSESPARSEPRODUCT_H
11 #define EIGEN_CONSERVATIVESPARSESPARSEPRODUCT_H
17 template<
typename Lhs,
typename Rhs,
typename ResultType>
33 std::memset(mask,0,
sizeof(
bool)*
rows);
44 Index estimated_nnz_prod = lhsEval.nonZerosEstimate() + rhsEval.nonZerosEstimate();
47 res.reserve(
Index(estimated_nnz_prod));
56 RhsScalar
y = rhsIt.value();
57 Index k = rhsIt.index();
61 LhsScalar
x = lhsIt.value();
76 for(
Index k=0; k<nnz; ++k)
98 for(
Index k=0; k<nnz; ++k)
127 template<
typename Lhs,
typename Rhs,
typename ResultType,
133 template<
typename Lhs,
typename Rhs,
typename ResultType>
148 if(lhs.rows()>rhs.cols())
152 internal::conservative_sparse_sparse_product_impl<Lhs,Rhs,ColMajorMatrix>(lhs, rhs, resCol,
true);
153 res = resCol.markAsRValue();
157 ColMajorMatrixAux resCol(lhs.rows(),rhs.cols());
159 internal::conservative_sparse_sparse_product_impl<Lhs,Rhs,ColMajorMatrixAux>(lhs, rhs, resCol,
false);
160 RowMajorMatrix resRow(resCol);
161 res = resRow.markAsRValue();
166 template<
typename Lhs,
typename Rhs,
typename ResultType>
173 RowMajorRhs rhsRow = rhs;
174 RowMajorRes resRow(lhs.rows(), rhs.cols());
175 internal::conservative_sparse_sparse_product_impl<RowMajorRhs,Lhs,RowMajorRes>(rhsRow, lhs, resRow);
180 template<
typename Lhs,
typename Rhs,
typename ResultType>
187 RowMajorLhs lhsRow = lhs;
188 RowMajorRes resRow(lhs.rows(), rhs.cols());
189 internal::conservative_sparse_sparse_product_impl<Rhs,RowMajorLhs,RowMajorRes>(rhs, lhsRow, resRow);
194 template<
typename Lhs,
typename Rhs,
typename ResultType>
200 RowMajorMatrix resRow(lhs.rows(), rhs.cols());
201 internal::conservative_sparse_sparse_product_impl<Rhs,Lhs,RowMajorMatrix>(rhs, lhs, resRow);
207 template<
typename Lhs,
typename Rhs,
typename ResultType>
216 internal::conservative_sparse_sparse_product_impl<Lhs,Rhs,ColMajorMatrix>(lhs, rhs, resCol);
221 template<
typename Lhs,
typename Rhs,
typename ResultType>
228 ColMajorLhs lhsCol = lhs;
229 ColMajorRes resCol(lhs.rows(), rhs.cols());
230 internal::conservative_sparse_sparse_product_impl<ColMajorLhs,Rhs,ColMajorRes>(lhsCol, rhs, resCol);
235 template<
typename Lhs,
typename Rhs,
typename ResultType>
242 ColMajorRhs rhsCol = rhs;
243 ColMajorRes resCol(lhs.rows(), rhs.cols());
244 internal::conservative_sparse_sparse_product_impl<Lhs,ColMajorRhs,ColMajorRes>(lhs, rhsCol, resCol);
249 template<
typename Lhs,
typename Rhs,
typename ResultType>
256 RowMajorMatrix resRow(lhs.rows(),rhs.cols());
257 internal::conservative_sparse_sparse_product_impl<Rhs,Lhs,RowMajorMatrix>(rhs, lhs, resRow);
269 template<
typename Lhs,
typename Rhs,
typename ResultType>
284 RhsScalar
y = rhsIt.value();
285 Index k = rhsIt.index();
289 LhsScalar
x = lhsIt.value();
301 template<
typename Lhs,
typename Rhs,
typename ResultType,
306 template<
typename Lhs,
typename Rhs,
typename ResultType>
311 internal::sparse_sparse_to_dense_product_impl<Lhs,Rhs,ResultType>(lhs, rhs,
res);
315 template<
typename Lhs,
typename Rhs,
typename ResultType>
321 ColMajorLhs lhsCol(lhs);
322 internal::sparse_sparse_to_dense_product_impl<ColMajorLhs,Rhs,ResultType>(lhsCol, rhs,
res);
326 template<
typename Lhs,
typename Rhs,
typename ResultType>
332 ColMajorRhs rhsCol(rhs);
333 internal::sparse_sparse_to_dense_product_impl<Lhs,ColMajorRhs,ResultType>(lhs, rhsCol,
res);
337 template<
typename Lhs,
typename Rhs,
typename ResultType>
343 internal::sparse_sparse_to_dense_product_impl<Rhs,Lhs,Transpose<ResultType> >(rhs, lhs, trRes);
352 #endif // EIGEN_CONSERVATIVESPARSESPARSEPRODUCT_H