Skip to content

Commit e9679e3

Browse files
tmigotabelsiqueira
authored andcommitted
implement jth-hess
1 parent 732985d commit e9679e3

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

src/nlp.jl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,7 @@ function NLPModels.jth_hess_coord!(
327327
@lencheck nlp.meta.nvar x
328328
@rangecheck 1 nlp.meta.ncon j
329329
increment!(nlp, :neval_jhess)
330-
Hx = hessian(nlp.adbackend, x -> nlp.c(x)[j], x)
331-
k = 1
332-
for j = 1:(nlp.meta.nvar)
333-
for i = j:(nlp.meta.nvar)
334-
vals[k] = Hx[i, j]
335-
k += 1
336-
end
337-
end
338-
return vals
330+
return hess_coord!(nlp.adbackend, nlp, x, x -> nlp.c(x)[j], vals)
339331
end
340332

341333
function NLPModels.jth_hprod!(

src/nls.jl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -456,15 +456,7 @@ function NLPModels.jth_hess_coord!(
456456
@lencheck nls.meta.nvar x
457457
@rangecheck 1 nls.meta.ncon j
458458
increment!(nls, :neval_jhess)
459-
Hx = hessian(nls.adbackend, x -> nls.c(x)[j], x)
460-
k = 1
461-
for j = 1:(nls.meta.nvar)
462-
for i = j:(nls.meta.nvar)
463-
vals[k] = Hx[i, j]
464-
k += 1
465-
end
466-
end
467-
return vals
459+
return hess_coord!(nls.adbackend, nls, x, x -> nls.c(x)[j], vals)
468460
end
469461

470462
function NLPModels.jth_hprod!(

0 commit comments

Comments
 (0)