Skip to content

Commit

Permalink
snoopprecompile
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Nov 24, 2022
1 parent 26cee49 commit 41a1d01
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/SimpleNonlinearSolve/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"

[compat]
Expand All @@ -17,6 +18,7 @@ FiniteDiff = "2"
ForwardDiff = "0.10.3"
Reexport = "0.2, 1"
SciMLBase = "1.73"
SnoopPrecompile = "1"
StaticArraysCore = "1.4"
julia = "1.6"

Expand Down
24 changes: 24 additions & 0 deletions lib/SimpleNonlinearSolve/src/SimpleNonlinearSolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@ include("falsi.jl")
include("raphson.jl")
include("ad.jl")

import SnoopPrecompile

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

#=
for alg in (SimpleNewtonRaphson,)
for u0 in ([1., 1.], StaticArraysCore.SA[1.0, 1.0])
u0 = T.(.1)
probN = NonlinearProblem{false}((u,p) -> u .* u .- p, u0, T(2))
solve(probN, alg(), tol = T(1e-2))
end
end
=#

prob_brack = IntervalNonlinearProblem{false}((u, p) -> u * u - p, T.((0.0, 2.0)), T(2))
for alg in (Bisection, Falsi)
solve(prob_brack, alg(), tol = T(1e-2))
end
end end

# DiffEq styled algorithms
export Bisection, Falsi, SimpleNewtonRaphson

Expand Down

0 comments on commit 41a1d01

Please sign in to comment.