Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 594100e

Browse files
committed
Change the norm
1 parent 49f8904 commit 594100e

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/SimpleNonlinearSolve.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import PrecompileTools: @compile_workload, @setup_workload, @recompile_invalidat
88

99
import DiffEqBase: AbstractNonlinearTerminationMode,
1010
AbstractSafeNonlinearTerminationMode, AbstractSafeBestNonlinearTerminationMode,
11-
NonlinearSafeTerminationReturnCode, get_termination_mode
11+
NonlinearSafeTerminationReturnCode, get_termination_mode,
12+
NONLINEARSOLVE_DEFAULT_NORM
1213
using FiniteDiff, ForwardDiff
1314
import ForwardDiff: Dual
1415
import MaybeInplace: @bb, setindex_trait, CanSetindex, CannotSetindex

src/nlsolve/dfsane.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleDFSane, args...;
6969
abstol, reltol, tc_cache = init_termination_cache(abstol, reltol, fx, x,
7070
termination_condition)
7171

72-
fx_norm = norm(fx)^nexp
72+
fx_norm = NONLINEARSOLVE_DEFAULT_NORM(fx)^nexp
7373
α_1 = one(T)
7474
f_1 = fx_norm
7575

@@ -99,7 +99,7 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleDFSane, args...;
9999
@bb @. x += α_p * d
100100

101101
fx = __eval_f(prob, fx, x)
102-
fx_norm_new = norm(fx)^nexp
102+
fx_norm_new = NONLINEARSOLVE_DEFAULT_NORM(fx)^nexp
103103

104104
while k < maxiters
105105
fx_norm_new (f_bar + η - γ * α_p^2 * fx_norm) && break
@@ -108,7 +108,7 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleDFSane, args...;
108108
@bb @. x -= α_m * d
109109

110110
fx = __eval_f(prob, fx, x)
111-
fx_norm_new = norm(fx)^nexp
111+
fx_norm_new = NONLINEARSOLVE_DEFAULT_NORM(fx)^nexp
112112

113113
fx_norm_new (f_bar + η - γ * α_m^2 * fx_norm) && break
114114

@@ -118,7 +118,7 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleDFSane, args...;
118118
@bb @. x += α_p * d
119119

120120
fx = __eval_f(prob, fx, x)
121-
fx_norm_new = norm(fx)^nexp
121+
fx_norm_new = NONLINEARSOLVE_DEFAULT_NORM(fx)^nexp
122122

123123
k += 1
124124
end

test/basictests.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,9 @@ end
258258
# --- Allocation Checks ---
259259

260260
## SimpleDFSane needs to allocate a history vector
261-
@testset "Allocation Checks: $(_nameof(alg))" for alg in ( SimpleNewtonRaphson(),
262-
SimpleHalley(), SimpleBroyden(), SimpleKlement(), SimpleLimitedMemoryBroyden(),
263-
SimpleTrustRegion())
261+
@testset "Allocation Checks: $(_nameof(alg))" for alg in (SimpleNewtonRaphson(),
262+
SimpleHalley(), SimpleBroyden(), SimpleKlement(), SimpleLimitedMemoryBroyden(),
263+
SimpleTrustRegion())
264264
@check_allocs nlsolve(prob, alg) = DiffEqBase.__solve(prob, alg; abstol = 1e-9)
265265

266266
nlprob_scalar = NonlinearProblem{false}(quadratic_f, 1.0, 2.0)

0 commit comments

Comments
 (0)