Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newton + LineSearch in Hot Loop: Reduce allocations #290

Open
DanielDoehring opened this issue Nov 13, 2024 · 0 comments
Open

Newton + LineSearch in Hot Loop: Reduce allocations #290

DanielDoehring opened this issue Nov 13, 2024 · 0 comments

Comments

@DanielDoehring
Copy link

DanielDoehring commented Nov 13, 2024

I really like the NLsolve.jl package in conjunction with LineSearches.jl - great stuff!

I have a scalar, relatively simple nonlinear equation that I can solve using

res = nlsolve(gamma -> f(gamma[1], bla, bla, bla),
              gamma -> j(gamma[1], bla, bla, bla),
              [gamma], method = :newton,  ftol = 2 * eps(RealT), iterations = 20,
              linesearch = LineSearches.BackTracking(order=3))
gamma = res.zero[1]

which works really well.
The issue is, however, that I get a couple allocations whenever I call this. Is there any way to reduce these by e.g. initalizing the problem once and then updating it later?

The functions f and g stay constant over time, although their arguments bla change over time.

Xref: https://discourse.julialang.org/t/newton-linesearch-in-hot-loop-reduce-allocations/122585

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant