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

Commit e828479

Browse files
committed
Don't support Batched TR for correctness reasons
1 parent d8f141b commit e828479

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/nlsolve/dfsane.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleDFSane, args...;
102102
fx_norm_new = NONLINEARSOLVE_DEFAULT_NORM(fx)^nexp
103103

104104
while k < maxiters
105-
fx_norm_new (f_bar + η - γ * α_p^2 * fx_norm) && break
105+
Bool(fx_norm_new (f_bar + η - γ * α_p^2 * fx_norm)) && break
106106

107107
α_p = α_p^2 * fx_norm / (fx_norm_new + (T(2) * α_p - T(1)) * fx_norm)
108108
@bb @. x -= α_m * d
109109

110110
fx = __eval_f(prob, fx, x)
111111
fx_norm_new = NONLINEARSOLVE_DEFAULT_NORM(fx)^nexp
112112

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

115115
α_tm = α_m^2 * fx_norm / (fx_norm_new + (T(2) * α_m - T(1)) * fx_norm)
116116
α_p = clamp(α_p, τ_min * α_p, τ_max * α_p)

src/nlsolve/trustRegion.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleTrustRegion, args.
9999
r = (fₖ₊₁ - fₖ) / (dot(δ, g) + dot(δ, Hδ) / T(2))
100100

101101
# Update the trust region radius.
102-
if Bool(r η₂)
102+
if r η₂
103103
shrink_counter = 0
104104
else
105105
Δ = t₁ * Δ
@@ -108,7 +108,7 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleTrustRegion, args.
108108
retcode = ReturnCode.ConvergenceFailure)
109109
end
110110

111-
if Bool(r η₁)
111+
if r η₁
112112
# Termination Checks
113113
tc_sol = check_termination(tc_cache, fx, x, xo, prob, alg)
114114
tc_sol !== nothing && return tc_sol
@@ -137,14 +137,14 @@ function dogleg_method!!(cache, J, f, g, Δ)
137137
@bb δN .= _restructure(δN, J \ _vec(f))
138138
@bb δN .*= -1
139139
# Test if the full step is within the trust region.
140-
Bool(norm(δN) Δ) && return δN
140+
(norm(δN) Δ) && return δN
141141

142142
# Calcualte Cauchy point, optimum along the steepest descent direction.
143143
@bb δsd .= g
144144
@bb @. δsd *= -1
145145
norm_δsd = norm(δsd)
146146

147-
if Bool(norm_δsd Δ)
147+
if (norm_δsd Δ)
148148
@bb @. δsd *= Δ / norm_δsd
149149
return δsd
150150
end

0 commit comments

Comments
 (0)