Skip to content

Commit

Permalink
Simplify precompilation
Browse files Browse the repository at this point in the history
Remove Float32 method and the Vector out of place methods since these are less likely to be useful to users. This brings down precompilation time by ~2x. I think this is good to do before #418 since I'm more sure that it's a good idea.
  • Loading branch information
oscardssmith authored May 3, 2024
1 parent 71b3f87 commit 9733034
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions src/NonlinearSolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,10 @@ include("default.jl")

@setup_workload begin
nlfuncs = ((NonlinearFunction{false}((u, p) -> u .* u .- p), 0.1),
(NonlinearFunction{false}((u, p) -> u .* u .- p), [0.1]),
(NonlinearFunction{true}((du, u, p) -> du .= u .* u .- p), [0.1]))
probs_nls = NonlinearProblem[]
for T in (Float32, Float64), (fn, u0) in nlfuncs
push!(probs_nls, NonlinearProblem(fn, T.(u0), T(2)))
for (fn, u0) in nlfuncs
push!(probs_nls, NonlinearProblem(fn, u0, 2.0))
end

nls_algs = (NewtonRaphson(), TrustRegion(), LevenbergMarquardt(),
Expand All @@ -114,20 +113,6 @@ include("default.jl")
for (fn, u0) in nlfuncs
push!(probs_nlls, NonlinearLeastSquaresProblem(fn, u0, 2.0))
end
nlfuncs = ((NonlinearFunction{false}((u, p) -> (u .^ 2 .- p)[1:1]), Float32[0.1, 0.0]),
(NonlinearFunction{false}((u, p) -> vcat(u .* u .- p, u .* u .- p)),
Float32[0.1, 0.1]),
(
NonlinearFunction{true}(
(du, u, p) -> du[1] = u[1] * u[1] - p, resid_prototype = zeros(Float32, 1)),
Float32[0.1, 0.0]),
(
NonlinearFunction{true}((du, u, p) -> du .= vcat(u .* u .- p, u .* u .- p),
resid_prototype = zeros(Float32, 4)),
Float32[0.1, 0.1]))
for (fn, u0) in nlfuncs
push!(probs_nlls, NonlinearLeastSquaresProblem(fn, u0, 2.0f0))
end

nlls_algs = (LevenbergMarquardt(), GaussNewton(), TrustRegion(),
LevenbergMarquardt(; linsolve = LUFactorization()),
Expand Down

0 comments on commit 9733034

Please sign in to comment.