Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove the common files #486

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions common/nlls_problem_workloads.jl

This file was deleted.

12 changes: 0 additions & 12 deletions common/nonlinear_problem_workloads.jl

This file was deleted.

41 changes: 38 additions & 3 deletions lib/NonlinearSolveFirstOrder/src/NonlinearSolveFirstOrder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ using NonlinearSolveBase: NonlinearSolveBase, AbstractNonlinearSolveAlgorithm,
update_trace!, L2_NORM,
NewtonDescent, DampedNewtonDescent, GeodesicAcceleration,
Dogleg
using SciMLBase: SciMLBase, AbstractNonlinearProblem, NLStats, ReturnCode, NonlinearFunction
using SciMLBase: SciMLBase, AbstractNonlinearProblem, NLStats, ReturnCode,
NonlinearFunction,
NonlinearLeastSquaresProblem, NonlinearProblem, NoSpecialize
using SciMLJacobianOperators: VecJacOperator, JacVecOperator, StatefulJacobianOperator

using FiniteDiff: FiniteDiff # Default Finite Difference Method
Expand All @@ -37,8 +39,41 @@ include("pseudo_transient.jl")
include("solve.jl")

@setup_workload begin
include("../../../common/nonlinear_problem_workloads.jl")
include("../../../common/nlls_problem_workloads.jl")
nonlinear_functions = (
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), 0.1),
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), [0.1]),
(NonlinearFunction{true, NoSpecialize}((du, u, p) -> du .= u .* u .- p), [0.1])
)

nonlinear_problems = NonlinearProblem[]
for (fn, u0) in nonlinear_functions
push!(nonlinear_problems, NonlinearProblem(fn, u0, 2.0))
end

nonlinear_functions = (
(NonlinearFunction{false, NoSpecialize}((u, p) -> (u .^ 2 .- p)[1:1]), [0.1, 0.0]),
(
NonlinearFunction{false, NoSpecialize}((u, p) -> vcat(u .* u .- p, u .* u .- p)),
[0.1, 0.1]
),
(
NonlinearFunction{true, NoSpecialize}(
(du, u, p) -> du[1] = u[1] * u[1] - p, resid_prototype = zeros(1)
),
[0.1, 0.0]
),
(
NonlinearFunction{true, NoSpecialize}(
(du, u, p) -> du .= vcat(u .* u .- p, u .* u .- p), resid_prototype = zeros(4)
),
[0.1, 0.1]
)
)

nlls_problems = NonlinearLeastSquaresProblem[]
for (fn, u0) in nonlinear_functions
push!(nlls_problems, NonlinearLeastSquaresProblem(fn, u0, 2.0))
end

nlp_algs = [NewtonRaphson(), TrustRegion(), LevenbergMarquardt()]
nlls_algs = [GaussNewton(), TrustRegion(), LevenbergMarquardt()]
Expand Down
14 changes: 12 additions & 2 deletions lib/NonlinearSolveQuasiNewton/src/NonlinearSolveQuasiNewton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ using NonlinearSolveBase: NonlinearSolveBase, AbstractNonlinearSolveAlgorithm,
AbstractApproximateJacobianUpdateRuleCache,
Utils, InternalAPI, get_timer_output, @static_timeit,
update_trace!, L2_NORM, NewtonDescent
using SciMLBase: SciMLBase, AbstractNonlinearProblem, NLStats, ReturnCode
using SciMLBase: SciMLBase, AbstractNonlinearProblem, NLStats, ReturnCode,
NonlinearProblem, NonlinearFunction, NoSpecialize
using SciMLOperators: AbstractSciMLOperator

include("reset_conditions.jl")
Expand All @@ -34,7 +35,16 @@ include("klement.jl")
include("solve.jl")

@setup_workload begin
include("../../../common/nonlinear_problem_workloads.jl")
nonlinear_functions = (
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), 0.1),
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), [0.1]),
(NonlinearFunction{true, NoSpecialize}((du, u, p) -> du .= u .* u .- p), [0.1])
)

nonlinear_problems = NonlinearProblem[]
for (fn, u0) in nonlinear_functions
push!(nonlinear_problems, NonlinearProblem(fn, u0, 2.0))
end

algs = [Broyden(), Klement()]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,24 @@ using MaybeInplace: @bb
using NonlinearSolveBase: NonlinearSolveBase, AbstractNonlinearSolveAlgorithm,
AbstractNonlinearSolveCache, Utils, InternalAPI, get_timer_output,
@static_timeit, update_trace!
using SciMLBase: SciMLBase, AbstractNonlinearProblem, NLStats, ReturnCode
using SciMLBase: SciMLBase, AbstractNonlinearProblem, NLStats, ReturnCode,
NonlinearProblem, NonlinearFunction, NoSpecialize

include("dfsane.jl")

include("solve.jl")

@setup_workload begin
include("../../../common/nonlinear_problem_workloads.jl")
nonlinear_functions = (
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), 0.1),
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), [0.1]),
(NonlinearFunction{true, NoSpecialize}((du, u, p) -> du .= u .* u .- p), [0.1])
)

nonlinear_problems = NonlinearProblem[]
for (fn, u0) in nonlinear_functions
push!(nonlinear_problems, NonlinearProblem(fn, u0, 2.0))
end

algs = [DFSane()]

Expand Down
42 changes: 38 additions & 4 deletions src/NonlinearSolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ using NonlinearSolveBase: NonlinearSolveBase, InternalAPI, AbstractNonlinearSolv
enable_timer_outputs, disable_timer_outputs

using Preferences: set_preferences!
using SciMLBase: SciMLBase, NLStats, ReturnCode, AbstractNonlinearProblem, NonlinearProblem,
NonlinearLeastSquaresProblem
using SciMLBase: SciMLBase, NLStats, ReturnCode, AbstractNonlinearProblem,
NonlinearFunction,
NonlinearProblem, NonlinearLeastSquaresProblem, NoSpecialize
using SymbolicIndexingInterface: SymbolicIndexingInterface
using StaticArraysCore: StaticArray

Expand Down Expand Up @@ -63,8 +64,41 @@ const ALL_SOLVER_TYPES = [
include("forward_diff.jl")

@setup_workload begin
include("../common/nonlinear_problem_workloads.jl")
include("../common/nlls_problem_workloads.jl")
nonlinear_functions = (
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), 0.1),
(NonlinearFunction{false, NoSpecialize}((u, p) -> u .* u .- p), [0.1]),
(NonlinearFunction{true, NoSpecialize}((du, u, p) -> du .= u .* u .- p), [0.1])
)

nonlinear_problems = NonlinearProblem[]
for (fn, u0) in nonlinear_functions
push!(nonlinear_problems, NonlinearProblem(fn, u0, 2.0))
end

nonlinear_functions = (
(NonlinearFunction{false, NoSpecialize}((u, p) -> (u .^ 2 .- p)[1:1]), [0.1, 0.0]),
(
NonlinearFunction{false, NoSpecialize}((u, p) -> vcat(u .* u .- p, u .* u .- p)),
[0.1, 0.1]
),
(
NonlinearFunction{true, NoSpecialize}(
(du, u, p) -> du[1] = u[1] * u[1] - p, resid_prototype = zeros(1)
),
[0.1, 0.0]
),
(
NonlinearFunction{true, NoSpecialize}(
(du, u, p) -> du .= vcat(u .* u .- p, u .* u .- p), resid_prototype = zeros(4)
),
[0.1, 0.1]
)
)

nlls_problems = NonlinearLeastSquaresProblem[]
for (fn, u0) in nonlinear_functions
push!(nlls_problems, NonlinearLeastSquaresProblem(fn, u0, 2.0))
end

@compile_workload begin
@sync begin
Expand Down
Loading