Skip to content

Commit b25eb74

Browse files
committed
Remove special iszero handling
1 parent af3e026 commit b25eb74

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

src/gaussnewton.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ function perform_step!(cache::GaussNewtonCache{false})
132132
cache.u = @. u - cache.du # `u` might not support mutation
133133
cache.fu_new = f(cache.u, p)
134134

135-
(cache.internalnorm(cache.fu_new .- cache.fu1) < cache.abstol ||
136-
cache.internalnorm(cache.fu_new) < cache.abstol) &&
137-
(cache.force_stop = true)
135+
(cache.internalnorm(cache.fu_new) < cache.abstol) && (cache.force_stop = true)
138136
cache.fu1 = cache.fu_new
139137
cache.stats.nf += 1
140138
cache.stats.njacs += 1

src/levenberg.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ end
185185

186186
function perform_step!(cache::LevenbergMarquardtCache{true})
187187
@unpack fu1, f, make_new_J = cache
188-
if _iszero(fu1)
188+
if iszero(fu1)
189189
cache.force_stop = true
190190
return nothing
191191
end
@@ -256,7 +256,7 @@ end
256256

257257
function perform_step!(cache::LevenbergMarquardtCache{false})
258258
@unpack fu1, f, make_new_J = cache
259-
if _iszero(fu1)
259+
if iszero(fu1)
260260
cache.force_stop = true
261261
return nothing
262262
end

src/utils.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ end
129129
concrete_jac(_) = nothing
130130
concrete_jac(::AbstractNewtonAlgorithm{CJ}) where {CJ} = CJ
131131

132-
# Circumventing https://github.com/SciML/RecursiveArrayTools.jl/issues/277
133-
_iszero(x) = iszero(x)
134-
_iszero(x::ArrayPartition) = all(_iszero, x.x)
135-
136132
_mutable_zero(x) = zero(x)
137133
_mutable_zero(x::SArray) = MArray(x)
138134

0 commit comments

Comments
 (0)