From 66f1c56aabc4ec4789405d11f544806312d49cd6 Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Sun, 19 Jan 2014 03:04:51 +0100 Subject: [PATCH] sparse_solve_retval_base::defaultEvalTo created extremely oversized temporary matrices in some cases --- Eigen/src/misc/SparseSolve.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Eigen/src/misc/SparseSolve.h b/Eigen/src/misc/SparseSolve.h index 244bb8ec7..05caa9266 100644 --- a/Eigen/src/misc/SparseSolve.h +++ b/Eigen/src/misc/SparseSolve.h @@ -54,8 +54,10 @@ template struct sparse_solve_retval_b 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); + // the temporary matrices do not need more columns than NbColsAtOnce: + int tmpCols = (std::min)(rhsCols, NbColsAtOnce); + Eigen::Matrix tmp(size,tmpCols); + Eigen::Matrix tmpX(size,tmpCols); for(int k=0; k(rhsCols-k, NbColsAtOnce);