Skip to content

Commit 948ae4f

Browse files
MaxenceGollierdpo
authored andcommitted
implicit jacobian update
1 parent c1a427c commit 948ae4f

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/LMTR_alg.jl

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,8 @@ function LMTRSolver(
6767
has_bnds ? shifted(reg_nls.h, xk, max.(-one(T), l_bound_m_x), min.(one(T), u_bound_m_x), reg_nls.selected) :
6868
shifted(reg_nls.h, xk, one(T), χ)
6969

70-
jprod! = let nls = reg_nls.model
71-
(x, v, Jv) -> jprod_residual!(nls, x, v, Jv)
72-
end
73-
jt_prod! = let nls = reg_nls.model
74-
(x, v, Jtv) -> jtprod_residual!(nls, x, v, Jtv)
75-
end
76-
77-
sub_nlp = LMModel(jprod!, jt_prod!, Fk, T(0), xk)
70+
Jk = jac_op_residual(reg_nls.model, xk)
71+
sub_nlp = LMModel(Jk, Fk, T(0), xk)
7872
subpb = RegularizedNLPModel(sub_nlp, ψ)
7973
substats = RegularizedExecutionStats(subpb)
8074
subsolver = subsolver(subpb)
@@ -300,7 +294,7 @@ function SolverCore.solve!(
300294
jtprod_residual!(nls, xk, Fk, ∇fk)
301295
fk = dot(Fk, Fk) / 2
302296

303-
σmax, found_σ = opnorm(jac_op_residual!(nls, xk, Jv, Jtv))
297+
σmax, found_σ = opnorm(solver.subpb.model.J)
304298
found_σ || error("operator norm computation failed")
305299
ν = α * Δk / (1 + σmax^2 ** Δk + 1))
306300
@. mν∇fk = -∇fk * ν
@@ -447,7 +441,7 @@ function SolverCore.solve!(
447441
shift!(ψ, xk)
448442
jtprod_residual!(nls, xk, Fk, ∇fk)
449443

450-
σmax, found_σ = opnorm(jac_op_residual!(nls, xk, Jv, Jtv))
444+
σmax, found_σ = opnorm(solver.subpb.model.J)
451445
found_σ || error("operator norm computation failed")
452446
end
453447

0 commit comments

Comments
 (0)