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 #437

Closed avik-pal closed 1 month ago

avik-pal commented 1 month ago

Fixes #410

Oops lost my local changes it seems...

Merge after https://github.com/SciML/NonlinearSolve.jl/pull/435

avik-pal commented 1 month ago

Now cache.stats gives the total counts correctly. For polyalgorithms this means we get the accumulated stats from all the solve calls.

avik-pal commented 1 month ago

cc @oscardssmith because you needed this in OrdinaryDiffEq.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 94.28571% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 86.42%. Comparing base (86bb307) to head (50aa5c4). Report is 2 commits behind head on master.

Files Patch % Lines
src/default.jl 75.00% 1 Missing :warning:
src/descent/steepest.jl 0.00% 1 Missing :warning:
src/internal/jacobian.jl 87.50% 1 Missing :warning:
src/internal/operators.jl 66.66% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #437 +/- ## ========================================== - Coverage 86.46% 86.42% -0.05% ========================================== Files 47 47 Lines 2904 2865 -39 ========================================== - Hits 2511 2476 -35 + Misses 393 389 -4 ```

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

oscardssmith commented 1 month ago

This change appears to have broken https://github.com/SciML/OrdinaryDiffEq.jl/pull/2167. Do you want to make the corresponding OrdinaryDiffEq change or should I?

avik-pal commented 1 month ago

Can you do it? I am not sure what broke, this was a purely internal API change

oscardssmith commented 1 month ago

will do. The problem was that OrdinaryDiffEq with NonlinearSolveAlg runs the step!(cache) loops of a nonlinear solver itself and was using nf to determine how many calls the step! had made to update the integrator's stats.