aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Sparse/SparseDenseProduct.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2011-10-24 09:31:33 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2011-10-24 09:31:33 +0200
commit70df09b76d1a13a55de1ebe6834ee359f403be89 (patch)
tree6a9a6d69ed28fc352bcdadda01af6a749c9fea61 /Eigen/src/Sparse/SparseDenseProduct.h
parenta2d414f56876c5fa4fbaebfc90c212e9d1830148 (diff)
move DynamicSparseMatrix to SparseExtra
Diffstat (limited to 'Eigen/src/Sparse/SparseDenseProduct.h')
-rw-r--r--Eigen/src/Sparse/SparseDenseProduct.h23
1 files changed, 22 insertions, 1 deletions
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<Rhs>::type _Rhs;
typedef typename _Lhs::InnerIterator LhsInnerIterator;
enum { LhsIsRowMajor = (_Lhs::Flags&RowMajorBit)==RowMajorBit };
- for(Index j=0; j<m_lhs.outerSize(); ++j)
+ Index j=0;
+//#pragma omp parallel for private(j) schedule(static,4)
+ for(j=0; j<m_lhs.outerSize(); ++j)
{
+ //kernel(dest,alpha,j);
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)
@@ -181,6 +184,24 @@ class SparseTimeDenseProduct
}
private:
+ template<typename Dest>
+ EIGEN_DONT_INLINE void kernel(Dest& dest, Scalar alpha, int j) const
+ {
+ typedef typename internal::remove_all<Lhs>::type _Lhs;
+ typedef typename internal::remove_all<Rhs>::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&);
};