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
216 stars 39 forks source link

Consolidate `stats` handling #410

Closed avik-pal closed 1 month ago

avik-pal commented 2 months ago

As pointed out by @oscardssmith, it would be good to store a centralized stats in the cache and update references to it instead of adding up the stats at the end.

Would probably make https://github.com/SciML/OrdinaryDiffEq.jl/pull/2167 easier

oscardssmith commented 2 months ago

Also worth noting that I'm pretty sure that for the polyalgs, the stats are just wrong. They appear to only report the stats from the solver that it actually used: https://github.com/SciML/NonlinearSolve.jl/blob/b389d0e9e9e4a1ff4350a2cce824ec8a03310e53/src/default.jl#L184C9-L184C14.

avik-pal commented 2 months ago

Yes that is an unfortunate decision I made. Previously we showed no stats but then I decided it is atleast worthwhile to get the stats for the oslver that worked. Using a reference to a top level stats object solves all of them