From 280b8d47cf8ad8bebfc45ba8edcbb2e9d529d4ee Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Mon, 21 Oct 2024 17:35:20 -0400 Subject: [PATCH] fix: remove deprecated APIs --- docs/src/basics/sparsity_detection.md | 19 ---------------- docs/src/basics/termination_condition.md | 15 ------------ test/core/rootfind_tests.jl | 29 ++++++++++++------------ 3 files changed, 15 insertions(+), 48 deletions(-) diff --git a/docs/src/basics/sparsity_detection.md b/docs/src/basics/sparsity_detection.md index de924c398..b7782c437 100644 --- a/docs/src/basics/sparsity_detection.md +++ b/docs/src/basics/sparsity_detection.md @@ -76,22 +76,3 @@ prob = NonlinearProblem( Refer to the documentation of DifferentiationInterface.jl and SparseConnectivityTracer.jl for more information on sparsity detection algorithms. - -## Case III: Sparse AD Type is being Used - -!!! warning - - This is now deprecated. Please use the previous two cases instead. - -If you constructed a Nonlinear Solver with a sparse AD type, for example - -```julia -NewtonRaphson(; autodiff = AutoSparse(AutoForwardDiff())) -# OR -TrustRegion(; autodiff = AutoSparse(AutoZygote())) -``` - -then NonlinearSolve will automatically perform matrix coloring and use sparse -differentiation if none of `sparsity` or `jac_prototype` is provided. We default to using -`TracerSparsityDetector()`. `Case I/II` take precedence for sparsity detection and we -perform sparse AD based on those options if those are provided. diff --git a/docs/src/basics/termination_condition.md b/docs/src/basics/termination_condition.md index a87f157aa..fd01a06ad 100644 --- a/docs/src/basics/termination_condition.md +++ b/docs/src/basics/termination_condition.md @@ -54,18 +54,3 @@ not used as a default anywhere. ```@docs SimpleNonlinearSolveTerminationMode ``` - -### Return Codes (Deprecated) - -These are deprecated and will be removed in a future release. Use the -`use_deprecated_retcodes = Val(false)` option to `SciMLBase.init` to use the new return -`ReturnCode` versions. - -```@docs -DiffEqBase.NonlinearSafeTerminationReturnCode -DiffEqBase.NonlinearSafeTerminationReturnCode.Success -DiffEqBase.NonlinearSafeTerminationReturnCode.Default -DiffEqBase.NonlinearSafeTerminationReturnCode.Failure -DiffEqBase.NonlinearSafeTerminationReturnCode.PatienceTermination -DiffEqBase.NonlinearSafeTerminationReturnCode.ProtectiveTermination -``` diff --git a/test/core/rootfind_tests.jl b/test/core/rootfind_tests.jl index 36c3e335b..e3f92fd26 100644 --- a/test/core/rootfind_tests.jl +++ b/test/core/rootfind_tests.jl @@ -1,7 +1,8 @@ @testsetup module CoreRootfindTesting using Reexport @reexport using BenchmarkTools, LinearSolve, NonlinearSolve, StaticArrays, Random, - LinearAlgebra, ForwardDiff, Zygote, Enzyme, DiffEqBase + LinearAlgebra, ForwardDiff, Zygote, Enzyme, DiffEqBase, + SparseConnectivityTracer using LineSearches: LineSearches _nameof(x) = applicable(nameof, x) ? nameof(x) : _nameof(typeof(x)) @@ -116,12 +117,12 @@ end @test nlprob_iterator_interface(quadratic_f, p, Val(false), NewtonRaphson()) ≈ sqrt.(p) @test nlprob_iterator_interface(quadratic_f!, p, Val(true), NewtonRaphson()) ≈ sqrt.(p) - @testset "ADType: $(autodiff) u0: $(_nameof(u0))" for autodiff in ( - AutoSparse(AutoForwardDiff()), AutoSparse(AutoFiniteDiff()), - AutoZygote(), AutoSparse(AutoZygote()), AutoSparse(AutoEnzyme())), + @testset "Sparsity ADType: $(autodiff) u0: $(_nameof(u0))" for autodiff in ( + AutoForwardDiff(), AutoFiniteDiff(), AutoZygote(), AutoEnzyme()), u0 in (1.0, [1.0, 1.0]) - probN = NonlinearProblem(quadratic_f, u0, 2.0) + probN = NonlinearProblem( + NonlinearFunction(quadratic_f; sparsity = TracerSparsityDetector()), u0, 2.0) @test all(solve(probN, NewtonRaphson(; autodiff)).u .≈ sqrt(2.0)) end @@ -180,12 +181,12 @@ end @test nlprob_iterator_interface(quadratic_f!, p, Val(true), TrustRegion()) ≈ sqrt.(p) @testset "$(_nameof(autodiff)) u0: $(_nameof(u0)) $(radius_update_scheme)" for autodiff in ( - AutoSparse(AutoForwardDiff()), AutoSparse(AutoFiniteDiff()), - AutoZygote(), AutoSparse(AutoZygote()), AutoSparse(AutoEnzyme())), + AutoForwardDiff(), AutoFiniteDiff(), AutoZygote(), AutoEnzyme()), u0 in (1.0, [1.0, 1.0]), radius_update_scheme in radius_update_schemes - probN = NonlinearProblem(quadratic_f, u0, 2.0) + probN = NonlinearProblem( + NonlinearFunction(quadratic_f; sparsity = TracerSparsityDetector()), u0, 2.0) @test all(solve(probN, TrustRegion(; autodiff, radius_update_scheme)).u .≈ sqrt(2.0)) end @@ -276,11 +277,11 @@ end end @testset "ADType: $(autodiff) u0: $(_nameof(u0))" for autodiff in ( - AutoSparse(AutoForwardDiff()), AutoSparse(AutoFiniteDiff()), - AutoZygote(), AutoSparse(AutoZygote()), AutoSparse(AutoEnzyme())), + AutoForwardDiff(), AutoFiniteDiff(), AutoZygote(), AutoEnzyme()), u0 in (1.0, [1.0, 1.0]) - probN = NonlinearProblem(quadratic_f, u0, 2.0) + probN = NonlinearProblem( + NonlinearFunction(quadratic_f; sparsity = TracerSparsityDetector()), u0, 2.0) @test all(solve( probN, LevenbergMarquardt(; autodiff); abstol = 1e-9, reltol = 1e-9).u .≈ sqrt(2.0)) @@ -458,11 +459,11 @@ end quadratic_f!, p, Val(true), PseudoTransient(; alpha_initial = 10.0)) ≈ sqrt.(p) @testset "ADType: $(autodiff) u0: $(_nameof(u0))" for autodiff in ( - AutoSparse(AutoForwardDiff()), AutoSparse(AutoFiniteDiff()), - AutoZygote(), AutoSparse(AutoZygote()), AutoSparse(AutoEnzyme())), + AutoForwardDiff(), AutoFiniteDiff(), AutoZygote(), AutoEnzyme()), u0 in (1.0, [1.0, 1.0]) - probN = NonlinearProblem(quadratic_f, u0, 2.0) + probN = NonlinearProblem( + NonlinearFunction(quadratic_f; sparsity = TracerSparsityDetector()), u0, 2.0) @test all(solve(probN, PseudoTransient(; alpha_initial = 10.0, autodiff)).u .≈ sqrt(2.0)) end