Skip to content

Commit

Permalink
fix incorrect gradient and Gauss-Newton Hessian proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
FHoltorf committed Sep 26, 2023
1 parent d1e0762 commit 081f3b1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/trustRegion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ isinplace(::TrustRegionCache{iip}) where {iip} = iip
function perform_step!(cache::TrustRegionCache{true})
@unpack make_new_J, J, fu, f, u, p, u_tmp, alg, linsolve = cache
if cache.make_new_J
jacobian!!(J, cache)
mul!(cache.H, J, J)
mul!(cache.g, J, fu)
jacobian!(J, cache)
mul!(cache.H, J', J)
mul!(cache.g, J', fu)
cache.stats.njacs += 1
end

Expand All @@ -330,9 +330,9 @@ function perform_step!(cache::TrustRegionCache{false})
@unpack make_new_J, fu, f, u, p = cache

if make_new_J
J = jacobian!!(cache.J, cache)
cache.H = J * J
cache.g = J * fu
J = jacobian(cache, f)
cache.H = J' * J
cache.g = J' * fu
cache.stats.njacs += 1
end

Expand Down

0 comments on commit 081f3b1

Please sign in to comment.