JuliaMath / QuadGK.jl

adaptive 1d numerical Gauss–Kronrod integration in Julia
MIT License
268 stars 37 forks source link

bugfix in gauss for large n #111

Closed stevengj closed 1 month ago

stevengj commented 1 month ago

Should fix #109.

Our arbitrary-precision eigensolver works by Newton's method on $\det(J - \lambda I)$ where $J$ is the Jacobi matrix, but the problem is that the determinant calculation easily underflows. However, since what we actually want is only the ratio $\det(J - \lambda I) / \det'(J - \lambda I)$ (the Newton step), we can rescale to this ratio at each step of the tridiagonal-determinant iteration to suppress under/ovrerflow.

On a separate note, the Newton iteration was missing the break statement on the convergence check, so it was taking 1000x longer than necessary!

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.54%. Comparing base (d5bbb69) to head (a529373).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #111 +/- ## ======================================= Coverage 98.53% 98.54% ======================================= Files 7 7 Lines 682 686 +4 ======================================= + Hits 672 676 +4 Misses 10 10 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.