Skip to content

Remove copy in termination conditions reinit! #640

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

Merged
merged 3 commits into from
Jul 19, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/NonlinearSolveBase/src/termination_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ function SciMLBase.reinit!(
length(saved_value_prototype) != 0 && (cache.saved_values = saved_value_prototype)

mode = cache.mode
u_unaliased = mode isa AbstractSafeBestNonlinearTerminationMode ?
(ArrayInterface.can_setindex(u) ? copy(u) : u) : nothing
cache.u = u_unaliased
if ArrayInterface.can_setindex(u)
cache.u .= u
else
cache.u = u
end
cache.retcode = ReturnCode.Default

cache.abstol = get_tolerance(u, abstol, T)
Expand Down
Loading