From bd8c9c69e4b32384d161f097e769ece68b227cf4 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 22 Feb 2013 14:41:32 +0100 Subject: [PATCH] Protect min with parenthesis in IncompleteLLT --- unsupported/Eigen/src/IterativeSolvers/IncompleteCholesky.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unsupported/Eigen/src/IterativeSolvers/IncompleteCholesky.h b/unsupported/Eigen/src/IterativeSolvers/IncompleteCholesky.h index b4a67ded0..96a11a144 100644 --- a/unsupported/Eigen/src/IterativeSolvers/IncompleteCholesky.h +++ b/unsupported/Eigen/src/IterativeSolvers/IncompleteCholesky.h @@ -132,6 +132,7 @@ template void IncompleteCholesky::factorize(const _MatrixType& mat) { using std::sqrt; + using std::min; eigen_assert(m_analysisIsOk && "analyzePattern() should be called first"); // Dropping strategies : Keep only the p largest elements per column, where p is the number of elements in the column of the original matrix. Other strategies will be added @@ -165,7 +166,7 @@ void IncompleteCholesky::factorize(const _MatrixType for (int j = 0; j < n; j++){ for (int k = colPtr[j]; k < colPtr[j+1]; k++) vals[k] /= (m_scal(j) * m_scal(rowIdx[k])); - mindiag = std::min(vals[colPtr[j]], mindiag); + mindiag = (min)(vals[colPtr[j]], mindiag); } if(mindiag < Scalar(0.)) m_shift = m_shift - mindiag;