1 function [res, precond] = fv_two_phase_hess_fun(params, jac, HessTemp, arg)
3 Plength = params.Slength;
5 HessTemp = jac(1:end-1,:)'*jac(1:end-1,:);
10 Pscale = jac(end,end-Plength+1:end);
11 PscaleP = Pscale(:) .* arg(end-Plength+1:end);
13 res(end-Plength+1:end) = res(end-Plength+1:end) + Pscale(:) .* PscaleP;
15 resref = (jac'*jac) * arg;
16 if norm(res - resref) > 1e-12
22 [precond.L, precond.U] = ilu(HessTemp, struct('type', 'crout'));