Skip to content

Commit 33af9b8

Browse files
Update src/rules.jl
Co-authored-by: Brian Chen <ToucheSir@users.noreply.github.com>
1 parent b926d00 commit 33af9b8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/rules.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ function apply!(o::Rprop, state, x, dx)
166166
ℓ, Γ = o.ell, o.gamma
167167
g, η = state
168168

169-
signs = map(s-> s > 0 ? ℓ[2] :
170-
s < 0 ? ℓ[1] : one(eltype(dx)),
171-
sign.(g .* dx))
169+
signs = map(g, dx) do g, dx
170+
s = sign(g * dx)
171+
s > 0 ? ℓ[2] : s < 0 ? ℓ[1] : one(eltype(dx))
172+
end
172173

173174
@.. η = clamp* signs, Γ[1], Γ[2])
174175
@.. g = (signs !== ℓ[1]) * dx

0 commit comments

Comments
 (0)