Skip to content

Commit

Permalink
Merge pull request #61 from avik-pal/ap/term
Browse files Browse the repository at this point in the history
Use a mutable struct instead of Dict for Safe termination
  • Loading branch information
ChrisRackauckas authored Apr 13, 2023
2 parents 18d4ca2 + 6c4cf4d commit 5ca2d21
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/SimpleNonlinearSolve/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Manifest.toml

.vscode
wip
2 changes: 1 addition & 1 deletion lib/SimpleNonlinearSolve/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ SimpleBatchedNonlinearSolveExt = "NNlib"

[compat]
ArrayInterface = "6, 7"
DiffEqBase = "6.119"
DiffEqBase = "6.123.0"
FiniteDiff = "2"
ForwardDiff = "0.10.3"
NNlib = "0.8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::Broyden{true}, args...;
error("Broyden currently doesn't support SAFE_BEST termination modes")
end

storage = mode DiffEqBase.SAFE_TERMINATION_MODES ? Dict() : nothing
storage = mode DiffEqBase.SAFE_TERMINATION_MODES ? NLSolveSafeTerminationResult() :
nothing
termination_condition = tc(storage)

xₙ = x
Expand Down
3 changes: 2 additions & 1 deletion lib/SimpleNonlinearSolve/src/broyden.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::Broyden{false}, args...;
error("Broyden currently doesn't support SAFE_BEST termination modes")
end

storage = mode DiffEqBase.SAFE_TERMINATION_MODES ? Dict() : nothing
storage = mode DiffEqBase.SAFE_TERMINATION_MODES ? NLSolveSafeTerminationResult() :
nothing
termination_condition = tc(storage)

xₙ = x
Expand Down
3 changes: 2 additions & 1 deletion lib/SimpleNonlinearSolve/src/lbroyden.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ end
error("LBroyden currently doesn't support SAFE_BEST termination modes")
end

storage = mode DiffEqBase.SAFE_TERMINATION_MODES ? Dict() : nothing
storage = mode DiffEqBase.SAFE_TERMINATION_MODES ? NLSolveSafeTerminationResult() :
nothing
termination_condition = tc(storage)

xₙ = x
Expand Down

0 comments on commit 5ca2d21

Please sign in to comment.