SciML / NonlinearSolve.jl

High-performance and differentiation-enabled nonlinear solvers (Newton methods), bracketed rootfinding (bisection, Falsi), with sparsity and Newton-Krylov support.
https://docs.sciml.ai/NonlinearSolve/stable/
MIT License
221 stars 39 forks source link

Improvements for Broyden and Klement #303

Closed avik-pal closed 7 months ago

avik-pal commented 7 months ago

See https://github.com/JuliaNLSolvers/NLsolve.jl/pull/287

Needs #297 to go in first

Fixes https://github.com/SciML/NonlinearSolve.jl/issues/260

Summary

  1. Broyden and Klement can (re-)start with the true (inv-)jacobian if asked for
  2. For Broyden, it improves robustness but makes Klement even more unstable for ill-conditioned problems
  3. Klement with identity initialization makes the Jacobian always diagonal; the updated solver exploits this and is significantly faster
  4. Klement for non-diagonal jacobians resets the jacobian if the jacobian is "too" ill-conditioned; this improves the stability somewhat
  5. Bad Broyden Update Rule
  6. Klement with true jacobian diagonal initialization
  7. Initial Scaling factor to improve stability

TODOs

codecov[bot] commented 7 months ago

Codecov Report

Attention: 44 lines in your changes are missing coverage. Please review.

Comparison is base (021901e) 88.01% compared to head (c4bde4d) 86.08%. Report is 2 commits behind head on master.

Files Patch % Lines
src/utils.jl 69.87% 25 Missing :warning:
src/broyden.jl 90.27% 7 Missing :warning:
src/klement.jl 91.25% 7 Missing :warning:
src/trace.jl 25.00% 3 Missing :warning:
src/NonlinearSolve.jl 33.33% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #303 +/- ## ========================================== - Coverage 88.01% 86.08% -1.94% ========================================== Files 21 21 Lines 1669 1825 +156 ========================================== + Hits 1469 1571 +102 - Misses 200 254 +54 ```

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

avik-pal commented 7 months ago

This should be good as well!