Skip to content

Commit 74c0bdd

Browse files
Precompile trust region only on v1.7+
Fixes #121
1 parent 2f043f7 commit 74c0bdd

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/NonlinearSolve.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,21 @@ 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+
49+
for alg in precompile_algs
50+
solve(prob, alg, abstol = T(1e-2))
4351
end
4452

4553
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))
54+
for alg in precompile_algs
55+
solve(prob, alg, abstol = T(1e-2))
4856
end
4957
end end
5058

0 commit comments

Comments
 (0)