Skip to content

Commit 81d46d9

Browse files
Merge pull request #449 from SciML/ap/extra_warning
Don't warn if user specified FiniteDifferencing
2 parents 4312611 + e3ea547 commit 81d46d9

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NonlinearSolve"
22
uuid = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
33
authors = ["SciML"]
4-
version = "3.12.4"
4+
version = "3.12.5"
55

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

src/internal/helpers.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ end
5757
function get_concrete_reverse_ad(
5858
autodiff::ADTypes.AbstractADType, prob, sp::Val{test_sparse} = True,
5959
args...; check_reverse_mode = true, kwargs...) where {test_sparse}
60-
if !isa(ADTypes.mode(autodiff), ADTypes.ReverseMode) && check_reverse_mode
60+
if !isa(ADTypes.mode(autodiff), ADTypes.ReverseMode) &&
61+
!isa(autodiff, ADTypes.AutoFiniteDiff) && # User specified finite differencing
62+
check_reverse_mode
6163
@warn "$(autodiff)::$(typeof(autodiff)) is not a `ReverseMode`. Use with caution." maxlog=1
6264
end
6365
if autodiff isa Union{AutoZygote, AutoSparse{<:AutoZygote}} && isinplace(prob)

test/downstream/mtk_cache_indexing_tests.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
nlprob = NonlinearProblem(nlsys, [X => 1.0], [p => 2.0, d => 3.0])
1212

1313
@testset "$integtype" for (alg, integtype) in [
14-
(NewtonRaphson(), NonlinearSolve.GeneralizedFirstOrderAlgorithmCache),
15-
(FastShortcutNonlinearPolyalg(), NonlinearSolve.NonlinearSolvePolyAlgorithmCache),
16-
(SimpleNewtonRaphson(), NonlinearSolve.NonlinearSolveNoInitCache),
17-
]
14+
(NewtonRaphson(), NonlinearSolve.GeneralizedFirstOrderAlgorithmCache),
15+
(FastShortcutNonlinearPolyalg(), NonlinearSolve.NonlinearSolvePolyAlgorithmCache),
16+
(SimpleNewtonRaphson(), NonlinearSolve.NonlinearSolveNoInitCache)]
1817
nint = init(nlprob, alg)
1918
@test nint isa integtype
2019

test/misc/other_tests.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@testitem "No warning tests" tags=[:misc] begin
2+
using NonlinearSolve
3+
4+
f(u, p) = u .* u .- p
5+
u0 = [1.0, 1.0]
6+
p = 2.0
7+
prob = NonlinearProblem(f, u0, p)
8+
@test_nowarn solve(
9+
prob, NewtonRaphson(autodiff = AutoFiniteDiff(), linesearch = LineSearchesJL()))
10+
end

0 commit comments

Comments
 (0)