From 70df09b76d1a13a55de1ebe6834ee359f403be89 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 24 Oct 2011 09:31:33 +0200 Subject: move DynamicSparseMatrix to SparseExtra --- Eigen/src/Sparse/SparseDenseProduct.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'Eigen/src/Sparse/SparseDenseProduct.h') diff --git a/Eigen/src/Sparse/SparseDenseProduct.h b/Eigen/src/Sparse/SparseDenseProduct.h index 0f77aa5be..dda14bc13 100644 --- a/Eigen/src/Sparse/SparseDenseProduct.h +++ b/Eigen/src/Sparse/SparseDenseProduct.h @@ -167,8 +167,11 @@ class SparseTimeDenseProduct typedef typename internal::remove_all::type _Rhs; typedef typename _Lhs::InnerIterator LhsInnerIterator; enum { LhsIsRowMajor = (_Lhs::Flags&RowMajorBit)==RowMajorBit }; - for(Index j=0; j + EIGEN_DONT_INLINE void kernel(Dest& dest, Scalar alpha, int j) const + { + typedef typename internal::remove_all::type _Lhs; + typedef typename internal::remove_all::type _Rhs; + typedef typename _Lhs::InnerIterator LhsInnerIterator; + enum { LhsIsRowMajor = (_Lhs::Flags&RowMajorBit)==RowMajorBit }; + { + typename Rhs::Scalar rhs_j = alpha * m_rhs.coeff(LhsIsRowMajor ? 0 : j,0); + typename Dest::RowXpr dest_j(dest.row(LhsIsRowMajor ? j : 0)); + for(LhsInnerIterator it(m_lhs,j); it ;++it) + { + if(LhsIsRowMajor) dest_j += (alpha*it.value()) * m_rhs.row(it.index()); + else if(Rhs::ColsAtCompileTime==1) dest.coeffRef(it.index()) += it.value() * rhs_j; + else dest.row(it.index()) += (alpha*it.value()) * m_rhs.row(j); + } + } + } SparseTimeDenseProduct& operator=(const SparseTimeDenseProduct&); }; -- cgit v1.2.3