Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 769737e

Browse files
snoopprecompile
1 parent 58fe0cf commit 769737e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
99
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
1010
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1111
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
12+
SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c"
1213
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
1314

1415
[compat]
@@ -17,6 +18,7 @@ FiniteDiff = "2"
1718
ForwardDiff = "0.10.3"
1819
Reexport = "0.2, 1"
1920
SciMLBase = "1.73"
21+
SnoopPrecompile = "1"
2022
StaticArraysCore = "1.4"
2123
julia = "1.6"
2224

src/SimpleNonlinearSolve.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,30 @@ include("falsi.jl")
1919
include("raphson.jl")
2020
include("ad.jl")
2121

22+
import SnoopPrecompile
23+
24+
SnoopPrecompile.@precompile_all_calls begin for T in (Float32, Float64)
25+
prob_no_brack = NonlinearProblem{false}((u, p) -> u .* u .- p, T(0.1), T(2))
26+
for alg in (SimpleNewtonRaphson,)
27+
solve(prob_no_brack, alg(), tol = T(1e-2))
28+
end
29+
30+
#=
31+
for alg in (SimpleNewtonRaphson,)
32+
for u0 in ([1., 1.], StaticArraysCore.SA[1.0, 1.0])
33+
u0 = T.(.1)
34+
probN = NonlinearProblem{false}((u,p) -> u .* u .- p, u0, T(2))
35+
solve(probN, alg(), tol = T(1e-2))
36+
end
37+
end
38+
=#
39+
40+
prob_brack = IntervalNonlinearProblem{false}((u, p) -> u * u - p, T.((0.0, 2.0)), T(2))
41+
for alg in (Bisection, Falsi)
42+
solve(prob_brack, alg(), tol = T(1e-2))
43+
end
44+
end end
45+
2246
# DiffEq styled algorithms
2347
export Bisection, Falsi, SimpleNewtonRaphson
2448

0 commit comments

Comments
 (0)