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

Commit 04d164d

Browse files
committed
revert the norm change
1 parent 8c77efe commit 04d164d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/nlsolve/trustRegion.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleTrustRegion, args.
7171
termination_condition)
7272

7373
# Set default trust region radius if not specified by user.
74-
Δₘₐₓ == 0 && (Δₘₐₓ = max(NONLINEARSOLVE_DEFAULT_NORM(fx), maximum(x) - minimum(x)))
74+
Δₘₐₓ == 0 && (Δₘₐₓ = max(norm(fx), maximum(x) - minimum(x)))
7575
Δ == 0 &&= Δₘₐₓ / 11)
7676

77-
fₖ = 0.5 * NONLINEARSOLVE_DEFAULT_NORM(fx)^2
77+
fₖ = 0.5 * norm(fx)^2
7878
H = ∇f' * ∇f
7979
g = _restructure(x, ∇f' * _vec(fx))
8080
shrink_counter = 0
@@ -93,7 +93,7 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleTrustRegion, args.
9393

9494
fx = __eval_f(prob, fx, x)
9595

96-
fₖ₊₁ = NONLINEARSOLVE_DEFAULT_NORM(fx)^2 / T(2)
96+
fₖ₊₁ = norm(fx)^2 / T(2)
9797

9898
# Compute the ratio of the actual to predicted reduction.
9999
@bb= H × vec(δ)
@@ -120,7 +120,7 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleTrustRegion, args.
120120
fx, ∇f = value_and_jacobian(alg.autodiff, prob.f, fx, x, prob.p, jac_cache; J)
121121

122122
# Update the trust region radius.
123-
(r > η₃) && (NONLINEARSOLVE_DEFAULT_NORM(δ) Δ) &&= min(t₂ * Δ, Δₘₐₓ))
123+
(r > η₃) && (norm(δ) Δ) &&= min(t₂ * Δ, Δₘₐₓ))
124124
fₖ = fₖ₊₁
125125

126126
@bb H = transpose(∇f) × ∇f
@@ -138,12 +138,12 @@ function dogleg_method!!(cache, J, f, g, Δ)
138138
@bb δN .= _restructure(δN, J \ _vec(f))
139139
@bb δN .*= -1
140140
# Test if the full step is within the trust region.
141-
(NONLINEARSOLVE_DEFAULT_NORM(δN) Δ) && return δN
141+
(norm(δN) Δ) && return δN
142142

143143
# Calcualte Cauchy point, optimum along the steepest descent direction.
144144
@bb δsd .= g
145145
@bb @. δsd *= -1
146-
norm_δsd = NONLINEARSOLVE_DEFAULT_NORM(δsd)
146+
norm_δsd = norm(δsd)
147147
if (norm_δsd Δ)
148148
@bb @. δsd *= Δ / norm_δsd
149149
return δsd

0 commit comments

Comments
 (0)