Skip to content

Commit b249167

Browse files
Merge pull request #127 from SciML/prec
Precompile trust region only on v1.7+
2 parents 2f043f7 + dab302c commit b249167

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/NonlinearSolve.jl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,20 @@ import SnoopPrecompile
3838

3939
SnoopPrecompile.@precompile_all_calls begin for T in (Float32, Float64)
4040
prob = NonlinearProblem{false}((u, p) -> u .* u .- p, T(0.1), T(2))
41-
for alg in (NewtonRaphson,)
42-
solve(prob, alg(), abstol = T(1e-2))
41+
42+
precompile_algs = if VERSION >= v"1.7"
43+
(NewtonRaphson(), TrustRegion())
44+
else
45+
(NewtonRaphson(),)
46+
end
47+
48+
for alg in precompile_algs
49+
solve(prob, alg, abstol = T(1e-2))
4350
end
4451

4552
prob = NonlinearProblem{true}((du, u, p) -> du[1] = u[1] * u[1] - p[1], T[0.1], T[2])
46-
for alg in (NewtonRaphson,)
47-
solve(prob, alg(), abstol = T(1e-2))
53+
for alg in precompile_algs
54+
solve(prob, alg, abstol = T(1e-2))
4855
end
4956
end end
5057

0 commit comments

Comments
 (0)