diff --git a/.github/workflows/CI_BracketingNonlinearSolve.yml b/.github/workflows/CI_BracketingNonlinearSolve.yml index eafa2f54f..87b4aa77c 100644 --- a/.github/workflows/CI_BracketingNonlinearSolve.yml +++ b/.github/workflows/CI_BracketingNonlinearSolve.yml @@ -2,8 +2,6 @@ name: CI (BracketingNonlinearSolve) on: pull_request: - branches: - - master paths: - "lib/BracketingNonlinearSolve/**" - ".github/workflows/CI_BracketingNonlinearSolve.yml" diff --git a/.github/workflows/CI_NonlinearSolve.yml b/.github/workflows/CI_NonlinearSolve.yml index 2b1140a5a..759428487 100644 --- a/.github/workflows/CI_NonlinearSolve.yml +++ b/.github/workflows/CI_NonlinearSolve.yml @@ -2,8 +2,6 @@ name: CI (NonlinearSolve) on: pull_request: - branches: - - master paths: - "src/**" - "ext/**" diff --git a/.github/workflows/CI_NonlinearSolveBase.yml b/.github/workflows/CI_NonlinearSolveBase.yml index 357fda00c..ca2f08e34 100644 --- a/.github/workflows/CI_NonlinearSolveBase.yml +++ b/.github/workflows/CI_NonlinearSolveBase.yml @@ -2,8 +2,6 @@ name: CI (NonlinearSolveBase) on: pull_request: - branches: - - master paths: - "lib/NonlinearSolveBase/**" - ".github/workflows/CI_NonlinearSolveBase.yml" diff --git a/.github/workflows/CI_NonlinearSolveFirstOrder.yml b/.github/workflows/CI_NonlinearSolveFirstOrder.yml index 207276661..ff5bd5a3e 100644 --- a/.github/workflows/CI_NonlinearSolveFirstOrder.yml +++ b/.github/workflows/CI_NonlinearSolveFirstOrder.yml @@ -2,8 +2,6 @@ name: CI (NonlinearSolveFirstOrder) on: pull_request: - branches: - - master paths: - "lib/NonlinearSolveFirstOrder/**" - ".github/workflows/CI_NonlinearSolveFirstOrder.yml" diff --git a/.github/workflows/CI_NonlinearSolveHomotopyContinuation.yml b/.github/workflows/CI_NonlinearSolveHomotopyContinuation.yml index cd5f48cf5..cb410f4a5 100644 --- a/.github/workflows/CI_NonlinearSolveHomotopyContinuation.yml +++ b/.github/workflows/CI_NonlinearSolveHomotopyContinuation.yml @@ -2,8 +2,6 @@ name: CI (NonlinearSolveHomotopyContinuation) on: pull_request: - branches: - - master paths: - "lib/NonlinearSolveHomotopyContinuation/**" - ".github/workflows/CI_NonlinearSolveHomotopyContinuation.yml" diff --git a/.github/workflows/CI_NonlinearSolveQuasiNewton.yml b/.github/workflows/CI_NonlinearSolveQuasiNewton.yml index d25432a25..c2b2899de 100644 --- a/.github/workflows/CI_NonlinearSolveQuasiNewton.yml +++ b/.github/workflows/CI_NonlinearSolveQuasiNewton.yml @@ -2,8 +2,6 @@ name: CI (NonlinearSolveQuasiNewton) on: pull_request: - branches: - - master paths: - "lib/NonlinearSolveQuasiNewton/**" - ".github/workflows/CI_NonlinearSolveQuasiNewton.yml" diff --git a/.github/workflows/CI_NonlinearSolveSpectralMethods.yml b/.github/workflows/CI_NonlinearSolveSpectralMethods.yml index d11605c7b..6540ead05 100644 --- a/.github/workflows/CI_NonlinearSolveSpectralMethods.yml +++ b/.github/workflows/CI_NonlinearSolveSpectralMethods.yml @@ -2,8 +2,6 @@ name: CI (NonlinearSolveSpectralMethods) on: pull_request: - branches: - - master paths: - "lib/NonlinearSolveSpectralMethods/**" - ".github/workflows/CI_NonlinearSolveSpectralMethods.yml" diff --git a/.github/workflows/CI_SCCNonlinearSolve.yml b/.github/workflows/CI_SCCNonlinearSolve.yml index e3eb7524d..1b8bd939a 100644 --- a/.github/workflows/CI_SCCNonlinearSolve.yml +++ b/.github/workflows/CI_SCCNonlinearSolve.yml @@ -2,8 +2,6 @@ name: CI (SCCNonlinearSolve) on: pull_request: - branches: - - master paths: - "lib/SCCNonlinearSolve/**" - ".github/workflows/CI_SCCNonlinearSolve.yml" diff --git a/.github/workflows/CI_SciMLJacobianOperators.yml b/.github/workflows/CI_SciMLJacobianOperators.yml index 9cb622247..c4d7d5bb2 100644 --- a/.github/workflows/CI_SciMLJacobianOperators.yml +++ b/.github/workflows/CI_SciMLJacobianOperators.yml @@ -2,8 +2,6 @@ name: CI (SciMLJacobianOperators) on: pull_request: - branches: - - master paths: - "lib/SciMLJacobianOperators/**" - ".github/workflows/CI_SciMLJacobianOperators.yml" diff --git a/.github/workflows/CI_SimpleNonlinearSolve.yml b/.github/workflows/CI_SimpleNonlinearSolve.yml index 170184f7f..894c41eb5 100644 --- a/.github/workflows/CI_SimpleNonlinearSolve.yml +++ b/.github/workflows/CI_SimpleNonlinearSolve.yml @@ -2,8 +2,6 @@ name: CI (SimpleNonlinearSolve) on: pull_request: - branches: - - master paths: - "lib/SimpleNonlinearSolve/**" - ".github/workflows/CI_SimpleNonlinearSolve.yml" diff --git a/Project.toml b/Project.toml index 819a5f2c1..f26780676 100644 --- a/Project.toml +++ b/Project.toml @@ -111,7 +111,7 @@ Random = "1.10" ReTestItems = "1.24" Reexport = "1.2" SIAMFANLEquations = "1.0.1" -SciMLBase = "2.68.1" +SciMLBase = "2.69" SimpleNonlinearSolve = "2.1" SparseArrays = "1.10" SparseConnectivityTracer = "0.6.5" diff --git a/docs/Project.toml b/docs/Project.toml index 2264ea99d..f5310ebe0 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -54,7 +54,7 @@ OrdinaryDiffEqTsit5 = "1.1.0" PETSc = "0.3" Plots = "1" Random = "1.10" -SciMLBase = "2.68.1" +SciMLBase = "2.69" SciMLJacobianOperators = "0.1" SimpleNonlinearSolve = "2" SparseConnectivityTracer = "0.6.5" diff --git a/lib/BracketingNonlinearSolve/Project.toml b/lib/BracketingNonlinearSolve/Project.toml index 2dae2db0c..65a89977f 100644 --- a/lib/BracketingNonlinearSolve/Project.toml +++ b/lib/BracketingNonlinearSolve/Project.toml @@ -30,7 +30,7 @@ InteractiveUtils = "<0.0.1, 1" NonlinearSolveBase = "1.1" PrecompileTools = "1.2" Reexport = "1.2" -SciMLBase = "2.68.1" +SciMLBase = "2.69" Test = "1.10" TestItemRunner = "1" julia = "1.10" diff --git a/lib/NonlinearSolveBase/Project.toml b/lib/NonlinearSolveBase/Project.toml index 0783805dc..5fef9b120 100644 --- a/lib/NonlinearSolveBase/Project.toml +++ b/lib/NonlinearSolveBase/Project.toml @@ -68,7 +68,7 @@ MaybeInplace = "0.1.4" Preferences = "1.4" Printf = "1.10" RecursiveArrayTools = "3" -SciMLBase = "2.68.1" +SciMLBase = "2.69" SciMLJacobianOperators = "0.1.1" SciMLOperators = "0.3.13" SparseArrays = "1.10" diff --git a/lib/NonlinearSolveFirstOrder/Project.toml b/lib/NonlinearSolveFirstOrder/Project.toml index bbbef93f8..6584b25e8 100644 --- a/lib/NonlinearSolveFirstOrder/Project.toml +++ b/lib/NonlinearSolveFirstOrder/Project.toml @@ -53,7 +53,7 @@ PrecompileTools = "1.2" Random = "1.10" ReTestItems = "1.24" Reexport = "1" -SciMLBase = "2.68.1" +SciMLBase = "2.69" SciMLJacobianOperators = "0.1.0" Setfield = "1.1.1" SparseArrays = "1.10" diff --git a/lib/NonlinearSolveQuasiNewton/Project.toml b/lib/NonlinearSolveQuasiNewton/Project.toml index ccf6d3550..528299f94 100644 --- a/lib/NonlinearSolveQuasiNewton/Project.toml +++ b/lib/NonlinearSolveQuasiNewton/Project.toml @@ -52,7 +52,7 @@ Pkg = "1.10" PrecompileTools = "1.2" ReTestItems = "1.24" Reexport = "1" -SciMLBase = "2.68.1" +SciMLBase = "2.69" SciMLOperators = "0.3.13" StableRNGs = "1" StaticArrays = "1.9.8" diff --git a/lib/NonlinearSolveSpectralMethods/Project.toml b/lib/NonlinearSolveSpectralMethods/Project.toml index 15dd869d9..e84eda6fc 100644 --- a/lib/NonlinearSolveSpectralMethods/Project.toml +++ b/lib/NonlinearSolveSpectralMethods/Project.toml @@ -41,7 +41,7 @@ Pkg = "1.10" PrecompileTools = "1.2" ReTestItems = "1.24" Reexport = "1" -SciMLBase = "2.68.1" +SciMLBase = "2.69" StableRNGs = "1" StaticArrays = "1.9.8" Test = "1.10" diff --git a/lib/SCCNonlinearSolve/Project.toml b/lib/SCCNonlinearSolve/Project.toml index 2ec8bcfaa..a5ee483d7 100644 --- a/lib/SCCNonlinearSolve/Project.toml +++ b/lib/SCCNonlinearSolve/Project.toml @@ -24,7 +24,7 @@ Pkg = "1.10" PrecompileTools = "1.2" ReTestItems = "1.24" Reexport = "1" -SciMLBase = "2.68.1" +SciMLBase = "2.69" StableRNGs = "1" StaticArrays = "1.9.8" SymbolicIndexingInterface = "0.3.36" diff --git a/lib/SciMLJacobianOperators/Project.toml b/lib/SciMLJacobianOperators/Project.toml index 0ffd2ce2d..6f0d0c0d6 100644 --- a/lib/SciMLJacobianOperators/Project.toml +++ b/lib/SciMLJacobianOperators/Project.toml @@ -29,7 +29,7 @@ ForwardDiff = "0.10.36, 1" InteractiveUtils = "<0.0.1, 1" LinearAlgebra = "1.10" ReverseDiff = "1.15" -SciMLBase = "2.68.1" +SciMLBase = "2.69" SciMLOperators = "0.3.13" Test = "1.10" TestItemRunner = "1" diff --git a/lib/SimpleNonlinearSolve/Project.toml b/lib/SimpleNonlinearSolve/Project.toml index bb727d58b..d22f0d871 100644 --- a/lib/SimpleNonlinearSolve/Project.toml +++ b/lib/SimpleNonlinearSolve/Project.toml @@ -1,7 +1,7 @@ name = "SimpleNonlinearSolve" uuid = "727e6d20-b764-4bd8-a329-72de5adea6c7" authors = ["SciML"] -version = "2.2.1" +version = "2.2.2" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" @@ -66,7 +66,7 @@ PrecompileTools = "1.2" Random = "1.10" Reexport = "1.2" ReverseDiff = "1.15" -SciMLBase = "2.68.1" +SciMLBase = "2.69" Setfield = "1.1.1" StaticArrays = "1.9" StaticArraysCore = "1.4.3" diff --git a/lib/SimpleNonlinearSolve/src/halley.jl b/lib/SimpleNonlinearSolve/src/halley.jl index 773f4b569..8894821f3 100644 --- a/lib/SimpleNonlinearSolve/src/halley.jl +++ b/lib/SimpleNonlinearSolve/src/halley.jl @@ -74,7 +74,8 @@ function SciMLBase.__solve( end aᵢ = J_fact \ NLBUtils.safe_vec(fx) - hvvp = Utils.compute_hvvp(prob, autodiff, fx_cache, x, aᵢ) + hvvp = Utils.compute_hvvp( + prob, autodiff, fx_cache, x, NLBUtils.restructure(x, aᵢ)) bᵢ = J_fact \ NLBUtils.safe_vec(hvvp) cᵢ_ = NLBUtils.safe_vec(cᵢ) diff --git a/lib/SimpleNonlinearSolve/src/lbroyden.jl b/lib/SimpleNonlinearSolve/src/lbroyden.jl index a0d33f942..5f0273c80 100644 --- a/lib/SimpleNonlinearSolve/src/lbroyden.jl +++ b/lib/SimpleNonlinearSolve/src/lbroyden.jl @@ -62,10 +62,11 @@ end # For scalar problems / if the threshold is larger than problem size just use Broyden if x isa Number || length(x) ≤ η - return SciMLBase.__solve( + sol = SciMLBase.__solve( prob, SimpleBroyden(; alg.linesearch), args...; abstol, reltol, maxiters, termination_condition, kwargs... ) + return Utils.nonlinear_solution_new_alg(sol, alg) end fx = NLBUtils.evaluate_f(prob, x) diff --git a/lib/SimpleNonlinearSolve/src/utils.jl b/lib/SimpleNonlinearSolve/src/utils.jl index 1090ac5f1..eae1fab55 100644 --- a/lib/SimpleNonlinearSolve/src/utils.jl +++ b/lib/SimpleNonlinearSolve/src/utils.jl @@ -171,7 +171,16 @@ function compute_hvvp(prob, autodiff, fx, x, dir) else @closure (u, p) -> only(DI.pushforward(prob.f, autodiff, u, (dir,), Constant(p))) end - only(DI.pushforward(jvp_fn, autodiff, x, (dir,), Constant(prob.p))) + return only(DI.pushforward(jvp_fn, autodiff, x, (dir,), Constant(prob.p))) +end + +function nonlinear_solution_new_alg( + sol::SciMLBase.NonlinearSolution{T, N, uType, R, P, A, O, uType2, S, Tr}, alg +) where {T, N, uType, R, P, A, O, uType2, S, Tr} + return SciMLBase.NonlinearSolution{T, N, uType, R, P, typeof(alg), O, uType2, S, Tr}( + sol.u, sol.resid, sol.prob, alg, sol.retcode, sol.original, sol.left, sol.right, + sol.stats, sol.trace + ) end end diff --git a/lib/SimpleNonlinearSolve/test/core/rootfind_tests.jl b/lib/SimpleNonlinearSolve/test/core/rootfind_tests.jl index 4481645c7..468e04916 100644 --- a/lib/SimpleNonlinearSolve/test/core/rootfind_tests.jl +++ b/lib/SimpleNonlinearSolve/test/core/rootfind_tests.jl @@ -27,16 +27,22 @@ AbsNormSafeBestTerminationMode(Base.Fix1(maximum, abs)) ] - function run_nlsolve_oop(f::F, u0, p = 2.0; solver) where {F} - return @inferred solve(NonlinearProblem{false}(f, u0, p), solver; abstol = 1e-9) + function run_nlsolve_oop(f::F, u0, p = 2.0; solver, broken_inferred = false) where {F} + prob = NonlinearProblem{false}(f, u0, p) + @test @inferred(solve(prob, solver; abstol = 1e-9)) isa + SciMLBase.AbstractNonlinearSolution broken=broken_inferred + return solve(prob, solver; abstol = 1e-9) end - function run_nlsolve_iip(f!::F, u0, p = 2.0; solver) where {F} - return @inferred solve(NonlinearProblem{true}(f!, u0, p), solver; abstol = 1e-9) + function run_nlsolve_iip(f!::F, u0, p = 2.0; solver, broken_inferred = false) where {F} + prob = NonlinearProblem{true}(f!, u0, p) + @test @inferred(solve(prob, solver; abstol = 1e-9)) isa + SciMLBase.AbstractNonlinearSolution broken=broken_inferred + return solve(prob, solver; abstol = 1e-9) end end @testitem "First Order Methods" setup=[RootfindTestSnippet] tags=[:core] begin - for alg in ( + @testset for alg in ( SimpleNewtonRaphson, SimpleTrustRegion, (; kwargs...) -> SimpleTrustRegion(; kwargs..., nlsolve_update_rule = Val(true)) @@ -50,7 +56,10 @@ end ) @testset "[OOP] u0: $(typeof(u0))" for u0 in ( [1.0, 1.0], @SVector[1.0, 1.0], 1.0) - sol = run_nlsolve_oop(quadratic_f, u0; solver = alg(; autodiff)) + broken_inferred = u0 isa StaticArray && (autodiff isa AutoFiniteDiff || + (autodiff isa AutoReverseDiff && VERSION < v"1.11")) + sol = run_nlsolve_oop(quadratic_f, u0; solver = alg(; autodiff), + broken_inferred) @test SciMLBase.successful_retcode(sol) @test maximum(abs, quadratic_f(sol.u, 2.0)) < 1e-9 end @@ -85,7 +94,10 @@ end ) @testset "[OOP] u0: $(typeof(u0))" for u0 in ( [1.0, 1.0], @SVector[1.0, 1.0], 1.0) - sol = run_nlsolve_oop(quadratic_f, u0; solver = alg(; autodiff)) + broken_inferred = u0 isa StaticArray && (autodiff isa AutoFiniteDiff || + (autodiff isa AutoReverseDiff && VERSION < v"1.11")) + sol = run_nlsolve_oop(quadratic_f, u0; solver = alg(; autodiff), + broken_inferred) @test SciMLBase.successful_retcode(sol) @test maximum(abs, quadratic_f(sol.u, 2.0)) < 1e-9 end