Nateckert / newton_rootfinder

Newton root-finding algorithm written in Rust
Apache License 2.0
7 stars 2 forks source link

Improve reusability of `Rootfinder.solve()` on different models in a row #24

Open Nateckert opened 2 years ago

Nateckert commented 2 years ago

Reusing the struct Rootfinder in order to call Rootfinder.solve() several times on different models is one of the goal of the solver. One can find such a use case in situation in which the different models are quite similar and one want to reuse the same solver settings.

However, the Rootfinder struct holds currently information about the resolution process and is not resetted in between each run.

The tasks are the following:

Providing an optional information jacobian to Rootfinder.solve() allows to NOT compute the jacobian at the first step when using quasi-newton methods and thus saving computational time. The jacobian could be provided based on some heuristic, or could be reused from a previous computation with a slightly different model (exactly in the same way as for the initial_guess parameter, justifying the choice of moving it from the constructor to the solve method)

Nateckert commented 1 year ago

After this change, the benchmarks could be redesigned and rerun. Currently, as they are executed in a loop, there are not really meaningful