Skip to content

Commit 9569535

Browse files
committed
Fix bug in Levenberg
1 parent fd4ae4b commit 9569535

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NonlinearSolve"
22
uuid = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
33
authors = ["SciML"]
4-
version = "2.0.1"
4+
version = "2.0.2"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"

src/levenberg.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ function perform_step!(cache::LevenbergMarquardtCache{true})
216216
# The following lines do: cache.a = -J \ cache.fu_tmp
217217
mul!(cache.du, J, v)
218218
@. cache.fu_tmp = (2 / h) * ((cache.fu_tmp - fu1) / h - cache.du)
219-
linres = dolinsolve(alg.precs, linsolve; A = J, b = _vec(cache.fu_tmp),
219+
linres = dolinsolve(alg.precs, linsolve; A = cache.mat_tmp, b = _vec(cache.fu_tmp),
220220
linu = _vec(cache.du), p = p, reltol = cache.abstol)
221221
cache.linsolve = linres.cache
222222
@. cache.a = -cache.du
@@ -225,7 +225,7 @@ function perform_step!(cache::LevenbergMarquardtCache{true})
225225

226226
# Require acceptable steps to satisfy the following condition.
227227
norm_v = norm(v)
228-
if (2 * norm(cache.a) / norm_v) < α_geodesic
228+
if 1 + log2(norm(cache.a)) - log2(norm_v) log2(α_geodesic)
229229
@. cache.δ = v + cache.a / 2
230230
@unpack δ, loss_old, norm_v_old, v_old, b_uphill = cache
231231
f(cache.fu_tmp, u .+ δ, p)

0 commit comments

Comments
 (0)