diff --git a/Eigen/src/QR/SelfAdjointEigenSolver.h b/Eigen/src/QR/SelfAdjointEigenSolver.h index a99a0b79b..1c9ad513d 100644 --- a/Eigen/src/QR/SelfAdjointEigenSolver.h +++ b/Eigen/src/QR/SelfAdjointEigenSolver.h @@ -357,10 +357,12 @@ static void ei_tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, int st subdiag[k - 1] = c * subdiag[k-1] - s * z; x = subdiag[k]; - z = -s * subdiag[k+1]; if (k < end - 1) + { + z = -s * subdiag[k+1]; subdiag[k + 1] = c * subdiag[k+1]; + } // apply the givens rotation to the unit matrix Q = Q * G // G only modifies the two columns k and k+1