From 89d76b06e5efa5f0cdfe05ff2167d4bb2368f53d Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Mon, 21 Oct 2024 20:06:35 -0400 Subject: [PATCH] chore: fix QA testing --- lib/BracketingNonlinearSolve/test/qa_tests.jl | 3 ++- src/NonlinearSolve.jl | 6 +++--- src/abstract_types.jl | 3 ++- test/core/rootfind_tests.jl | 17 ++++++++++++----- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/lib/BracketingNonlinearSolve/test/qa_tests.jl b/lib/BracketingNonlinearSolve/test/qa_tests.jl index de27e33a4..c01c493f4 100644 --- a/lib/BracketingNonlinearSolve/test/qa_tests.jl +++ b/lib/BracketingNonlinearSolve/test/qa_tests.jl @@ -10,7 +10,8 @@ end import ForwardDiff using ExplicitImports, BracketingNonlinearSolve - @test check_no_implicit_imports(BracketingNonlinearSolve; skip = (Base, Core)) === nothing + @test check_no_implicit_imports(BracketingNonlinearSolve; skip = (Base, Core)) === + nothing @test check_no_stale_explicit_imports(BracketingNonlinearSolve) === nothing @test check_all_qualified_accesses_via_owners(BracketingNonlinearSolve) === nothing end diff --git a/src/NonlinearSolve.jl b/src/NonlinearSolve.jl index fd2c0bc3d..5f21936a1 100644 --- a/src/NonlinearSolve.jl +++ b/src/NonlinearSolve.jl @@ -13,14 +13,14 @@ using LinearAlgebra: LinearAlgebra, ColumnNorm, Diagonal, I, LowerTriangular, Sy UpperTriangular, axpy!, cond, diag, diagind, dot, issuccess, istril, istriu, lu, mul!, norm, pinv, tril!, triu! using LineSearch: LineSearch, AbstractLineSearchCache, LineSearchesJL, NoLineSearch, - RobustNonMonotoneLineSearch, BackTracking, LiFukushimaLineSearch + RobustNonMonotoneLineSearch, BackTracking, LiFukushimaLineSearch using LinearSolve: LinearSolve, QRFactorization, needs_concrete_A, AbstractFactorization, DefaultAlgorithmChoice, DefaultLinearSolver using MaybeInplace: @bb using NonlinearSolveBase: NonlinearSolveBase, nonlinearsolve_forwarddiff_solve, nonlinearsolve_dual_solution, nonlinearsolve_∂f_∂p, - nonlinearsolve_∂f_∂u, L2_NORM, AbstractNonlinearTerminationMode, - AbstractSafeNonlinearTerminationMode, + nonlinearsolve_∂f_∂u, L2_NORM, AbsNormTerminationMode, + AbstractNonlinearTerminationMode, AbstractSafeBestNonlinearTerminationMode using Printf: @printf using Preferences: Preferences, @load_preference, @set_preferences! diff --git a/src/abstract_types.jl b/src/abstract_types.jl index 415dc5797..255c5e541 100644 --- a/src/abstract_types.jl +++ b/src/abstract_types.jl @@ -382,7 +382,8 @@ Abstract Type for all Approximate Jacobian Update Rules used in NonlinearSolve.j ```julia __internal_init( prob::AbstractNonlinearProblem, alg::AbstractApproximateJacobianUpdateRule, J, fu, u, - du, args...; internalnorm::F = L2_NORM, kwargs...) where {F} --> AbstractApproximateJacobianUpdateRuleCache{INV} + du, args...; internalnorm::F = L2_NORM, kwargs...) where {F} --> +AbstractApproximateJacobianUpdateRuleCache{INV} ``` """ abstract type AbstractApproximateJacobianUpdateRule{INV} end diff --git a/test/core/rootfind_tests.jl b/test/core/rootfind_tests.jl index e3f92fd26..2d1662570 100644 --- a/test/core/rootfind_tests.jl +++ b/test/core/rootfind_tests.jl @@ -1,8 +1,8 @@ @testsetup module CoreRootfindTesting using Reexport @reexport using BenchmarkTools, LinearSolve, NonlinearSolve, StaticArrays, Random, - LinearAlgebra, ForwardDiff, Zygote, Enzyme, DiffEqBase, - SparseConnectivityTracer + LinearAlgebra, ForwardDiff, Zygote, Enzyme, SparseConnectivityTracer, + NonlinearSolveBase using LineSearches: LineSearches _nameof(x) = applicable(nameof, x) ? nameof(x) : _nameof(typeof(x)) @@ -22,9 +22,16 @@ function newton_fails(u, p) end const TERMINATION_CONDITIONS = [ - NormTerminationMode(), RelTerminationMode(), RelNormTerminationMode(), - AbsTerminationMode(), AbsNormTerminationMode(), RelSafeTerminationMode(), - AbsSafeTerminationMode(), RelSafeBestTerminationMode(), AbsSafeBestTerminationMode()] + NormTerminationMode(Base.Fix1(maximum, abs)), + RelTerminationMode(), + RelNormTerminationMode(Base.Fix1(maximum, abs)), + RelNormSafeTerminationMode(Base.Fix1(maximum, abs)), + RelNormSafeBestTerminationMode(Base.Fix1(maximum, abs)), + AbsTerminationMode(), + AbsNormTerminationMode(Base.Fix1(maximum, abs)), + AbsNormSafeTerminationMode(Base.Fix1(maximum, abs)), + AbsNormSafeBestTerminationMode(Base.Fix1(maximum, abs)) +] function benchmark_nlsolve_oop(f, u0, p = 2.0; solver, kwargs...) prob = NonlinearProblem{false}(f, u0, p)