patrick-kidger / optimistix

Nonlinear optimisation (root-finding, least squares, ...) in JAX+Equinox. https://docs.kidger.site/optimistix/
Apache License 2.0
265 stars 12 forks source link

Adds a check in order to prevent terminating on first step for functions with initial condition yielding 0 in function evaluation. Corresponding tests. #49

Closed NightWinkle closed 3 months ago

NightWinkle commented 3 months ago

Corresponding to issue #47 which states function whose initial value is zero are considered terminated as a result of their initial function difference value being zero.

As for the commit itself, I'm not sure if using jnp.where is the way since I'm relatively new to jax.

patrick-kidger commented 3 months ago

This looks great, thank you! Indeed I believe jnp.where is the appropriate thing here.

Merged :)