Skip to content

Commit

Permalink
Merge pull request #127 from SciML/prec
Browse files Browse the repository at this point in the history
Precompile trust region only on v1.7+
  • Loading branch information
ChrisRackauckas authored Jan 21, 2023
2 parents 2f043f7 + dab302c commit b249167
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/NonlinearSolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,20 @@ import SnoopPrecompile

SnoopPrecompile.@precompile_all_calls begin for T in (Float32, Float64)
prob = NonlinearProblem{false}((u, p) -> u .* u .- p, T(0.1), T(2))
for alg in (NewtonRaphson,)
solve(prob, alg(), abstol = T(1e-2))

precompile_algs = if VERSION >= v"1.7"
(NewtonRaphson(), TrustRegion())
else
(NewtonRaphson(),)
end

for alg in precompile_algs
solve(prob, alg, abstol = T(1e-2))
end

prob = NonlinearProblem{true}((du, u, p) -> du[1] = u[1] * u[1] - p[1], T[0.1], T[2])
for alg in (NewtonRaphson,)
solve(prob, alg(), abstol = T(1e-2))
for alg in precompile_algs
solve(prob, alg, abstol = T(1e-2))
end
end end

Expand Down

0 comments on commit b249167

Please sign in to comment.