Skip to content

Commit

Permalink
Update the function for the lagrangian
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Dec 3, 2024
1 parent deda5fa commit b6a1e3e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/enzyme.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,12 @@ function SparseEnzymeADHessian(
cx = similar(x0, ncon)
grad = similar(x0)
function (x, y, obj_weight, cx)
c!(cx, x)
obj_weight * f(x) + sum(cx[i] * y[i] for i = 1:ncon)
res = obj_weight * f(x)
if ncon == 0
c!(cx, x)
res += sum(cx[i] * y[i] for i = 1:ncon)
end
return res
end

return SparseEnzymeADHessian(
Expand Down

0 comments on commit b6a1e3e

Please sign in to comment.