diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-07-18 11:02:22 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-07-18 11:02:22 +0200 |
commit | a325d1cb1e607c36d602b1cad9a57b05c60050fa (patch) | |
tree | 0c4576947946af90cb8587a4ccbf7030c5b8f772 /Eigen/src/SVD/JacobiSVD.h | |
parent | 2bdb3b1afdbc07d54fec43edff92138f82492941 (diff) | |
parent | da62eb22e497d864ccaed93907818a384bad8e2a (diff) |
merge with default branch
Diffstat (limited to 'Eigen/src/SVD/JacobiSVD.h')
-rw-r--r-- | Eigen/src/SVD/JacobiSVD.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Eigen/src/SVD/JacobiSVD.h b/Eigen/src/SVD/JacobiSVD.h index a0c0c9172..d1b63b607 100644 --- a/Eigen/src/SVD/JacobiSVD.h +++ b/Eigen/src/SVD/JacobiSVD.h @@ -375,17 +375,19 @@ struct svd_precondition_2x2_block_to_be_real<MatrixType, QRPreconditioner, true> Scalar z; JacobiRotation<Scalar> rot; RealScalar n = sqrt(numext::abs2(work_matrix.coeff(p,p)) + numext::abs2(work_matrix.coeff(q,p))); + if(n==0) { z = abs(work_matrix.coeff(p,q)) / work_matrix.coeff(p,q); work_matrix.row(p) *= z; if(svd.computeU()) svd.m_matrixU.col(p) *= conj(z); if(work_matrix.coeff(q,q)!=Scalar(0)) + { z = abs(work_matrix.coeff(q,q)) / work_matrix.coeff(q,q); - else - z = Scalar(0); - work_matrix.row(q) *= z; - if(svd.computeU()) svd.m_matrixU.col(q) *= conj(z); + work_matrix.row(q) *= z; + if(svd.computeU()) svd.m_matrixU.col(q) *= conj(z); + } + // otherwise the second row is already zero, so we have nothing to do. } else { @@ -852,7 +854,7 @@ JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsig if(m_computeThinV) m_matrixV.setIdentity(m_cols, m_diagSize); } - // Scaling factor to reducover/under-flows + // Scaling factor to reduce over/under-flows RealScalar scale = m_workMatrix.cwiseAbs().maxCoeff(); if(scale==RealScalar(0)) scale = RealScalar(1); m_workMatrix /= scale; |