Skip to content

Commit

Permalink
Fix bug in Levenberg
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Oct 3, 2023
1 parent fd4ae4b commit 9569535
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NonlinearSolve"
uuid = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
authors = ["SciML"]
version = "2.0.1"
version = "2.0.2"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
4 changes: 2 additions & 2 deletions src/levenberg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function perform_step!(cache::LevenbergMarquardtCache{true})
# The following lines do: cache.a = -J \ cache.fu_tmp
mul!(cache.du, J, v)
@. cache.fu_tmp = (2 / h) * ((cache.fu_tmp - fu1) / h - cache.du)
linres = dolinsolve(alg.precs, linsolve; A = J, b = _vec(cache.fu_tmp),
linres = dolinsolve(alg.precs, linsolve; A = cache.mat_tmp, b = _vec(cache.fu_tmp),
linu = _vec(cache.du), p = p, reltol = cache.abstol)
cache.linsolve = linres.cache
@. cache.a = -cache.du
Expand All @@ -225,7 +225,7 @@ function perform_step!(cache::LevenbergMarquardtCache{true})

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

0 comments on commit 9569535

Please sign in to comment.