diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-09-10 11:54:20 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-09-10 11:54:20 +0200 |
commit | d6236d3b26f6b652c452d884c440099892fdcdba (patch) | |
tree | d17b0626b623ba55b47543f9551a9657eb4516ce /Eigen/src/SVD/JacobiSVD.h | |
parent | 921a645481aa8825549960c19db2c1bee8375f8f (diff) |
Fix bug #791: infinite loop in JacobiSVD in the presence of NaN.
Diffstat (limited to 'Eigen/src/SVD/JacobiSVD.h')
-rw-r--r-- | Eigen/src/SVD/JacobiSVD.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Eigen/src/SVD/JacobiSVD.h b/Eigen/src/SVD/JacobiSVD.h index 6f3907f5d..6ff689de3 100644 --- a/Eigen/src/SVD/JacobiSVD.h +++ b/Eigen/src/SVD/JacobiSVD.h @@ -741,7 +741,8 @@ JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsig EIGEN_USING_STD_MATH(max); RealScalar threshold = (max)(considerAsZero, precision * (max)(abs(m_workMatrix.coeff(p,p)), abs(m_workMatrix.coeff(q,q)))); - if((max)(abs(m_workMatrix.coeff(p,q)),abs(m_workMatrix.coeff(q,p))) > threshold) + // We compare both values to threshold instead of calling max to be robust to NaN (See bug 791) + if(abs(m_workMatrix.coeff(p,q))>threshold || abs(m_workMatrix.coeff(q,p)) > threshold) { finished = false; |