From 81d4bfa8d9c9f17a58d827956f7d529085151afe Mon Sep 17 00:00:00 2001 From: Desire NUENTSA Date: Fri, 25 Jan 2013 18:17:17 +0100 Subject: add support for solving with sparse right hand side --- Eigen/src/misc/SparseSolve.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Eigen/src/misc') diff --git a/Eigen/src/misc/SparseSolve.h b/Eigen/src/misc/SparseSolve.h index 272c4a479..244bb8ec7 100644 --- a/Eigen/src/misc/SparseSolve.h +++ b/Eigen/src/misc/SparseSolve.h @@ -47,6 +47,23 @@ template struct sparse_solve_retval_b } protected: + template + inline void defaultEvalTo(SparseMatrix& dst) const + { + // we process the sparse rhs per block of NbColsAtOnce columns temporarily stored into a dense matrix. + static const int NbColsAtOnce = 4; + int rhsCols = m_rhs.cols(); + int size = m_rhs.rows(); + Eigen::Matrix tmp(size,rhsCols); + Eigen::Matrix tmpX(size,rhsCols); + for(int k=0; k(rhsCols-k, NbColsAtOnce); + tmp.leftCols(actualCols) = m_rhs.middleCols(k,actualCols); + tmpX.leftCols(actualCols) = m_dec.solve(tmp.leftCols(actualCols)); + dst.middleCols(k,actualCols) = tmpX.leftCols(actualCols).sparseView(); + } + } const DecompositionType& m_dec; typename Rhs::Nested m_rhs; }; -- cgit v1.2.3