Skip to content

Commit f809d0a

Browse files
Merge pull request #127 from SciML/ap/propagate_kwargs
Dispatch didn't propagate problem kwargs
2 parents 3dfa6a2 + 05c80bb commit f809d0a

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

lib/SimpleNonlinearSolve/.github/workflows/CI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
test:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
13+
fail-fast: false
1314
matrix:
1415
group:
1516
- Core

lib/SimpleNonlinearSolve/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SimpleNonlinearSolve"
22
uuid = "727e6d20-b764-4bd8-a329-72de5adea6c7"
33
authors = ["SciML"]
4-
version = "1.4.1"
4+
version = "1.4.2"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"

lib/SimpleNonlinearSolve/src/SimpleNonlinearSolve.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ include("ad.jl")
5353
# Set the default bracketing method to ITP
5454
SciMLBase.solve(prob::IntervalNonlinearProblem; kwargs...) = solve(prob, ITP(); kwargs...)
5555
function SciMLBase.solve(prob::IntervalNonlinearProblem, alg::Nothing, args...; kwargs...)
56-
return solve(prob, ITP(), args...; kwargs...)
56+
return solve(prob, ITP(), args...; prob.kwargs..., kwargs...)
5757
end
5858

5959
# By Pass the highlevel checks for NonlinearProblem for Simple Algorithms
@@ -67,7 +67,7 @@ function SciMLBase.solve(
6767
new_p = p !== nothing ? p : prob.p
6868
return __internal_solve_up(
6969
prob, sensealg, new_u0, u0 === nothing, new_p, p === nothing,
70-
alg, args...; kwargs...)
70+
alg, args...; prob.kwargs..., kwargs...)
7171
end
7272

7373
function __internal_solve_up(_prob::NonlinearProblem, sensealg, u0, u0_changed, p,

lib/SimpleNonlinearSolve/test/core/rootfind_tests.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,19 @@ end
120120
p = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
121121

122122
@testset "$(nameof(typeof(alg)))" for alg in (SimpleDFSane(), SimpleTrustRegion(),
123-
SimpleHalley(),
124-
SimpleTrustRegion(; nlsolve_update_rule = Val(true)))
123+
SimpleHalley(), SimpleTrustRegion(; nlsolve_update_rule = Val(true)))
125124
sol = benchmark_nlsolve_oop(newton_fails, u0, p; solver = alg)
126125
@test SciMLBase.successful_retcode(sol)
127126
@test all(abs.(newton_fails(sol.u, p)) .< 1e-9)
128127
end
129128
end
130129

130+
@testitem "Kwargs Propagation" setup=[RootfindingTesting] begin
131+
prob = NonlinearProblem(quadratic_f, ones(4), 2.0; maxiters = 2)
132+
sol = solve(prob, SimpleNewtonRaphson())
133+
@test sol.retcode === ReturnCode.MaxIters
134+
end
135+
131136
@testitem "Allocation Checks" setup=[RootfindingTesting] begin
132137
@testset "$(nameof(typeof(alg)))" for alg in (SimpleNewtonRaphson(),
133138
SimpleHalley(), SimpleBroyden(), SimpleKlement(), SimpleLimitedMemoryBroyden(),

0 commit comments

Comments
 (0)