Skip to content

Commit

Permalink
Merge pull request #40 from matthieugomez/scalingfix
Browse files Browse the repository at this point in the history
Fix scaling
  • Loading branch information
matthieugomez authored Nov 8, 2024
2 parents 2aea700 + 979e03e commit bcf0126
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/optimizer/levenberg_marquardt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ function optimize!(
need_jacobian = false
end
colsumabs2!(dtd, J)
clamp!(dtd, MIN_DIAGONAL, MAX_DIAGONAL)
# this ensures that the operation in clamp! is scaling irrelevant
dtd_mean = sum(dtd) / length(dtd)
clamp!(dtd, MIN_DIAGONAL * dtd_mean, MAX_DIAGONAL * dtd_mean)
rmul!(dtd, 1/Δ)
δx, lmiter = ldiv!(δx, J, fcur, dtd, anls.solver)
# apply box constraints
Expand Down

0 comments on commit bcf0126

Please sign in to comment.