Skip to content
Snippets Groups Projects
Commit a6106f07 authored by MichelJuillard's avatar MichelJuillard
Browse files

making solve1.m robust to sparse Jacobian

parent fad9aa68
Branches
Tags
No related merge requests found
...@@ -90,9 +90,14 @@ for its = 1:maxit ...@@ -90,9 +90,14 @@ for its = 1:maxit
g = (fvec'*fjac)'; g = (fvec'*fjac)';
if debug if debug
disp(['cond(fjac) ' num2str(cond(fjac))]) disp(['cond(fjac) ' num2str(condest(fjac))])
end end
if rcond(fjac) < sqrt(eps) if issparse(fjac)
rcond_fjac = 1/condest(fjac);
else
rcond_fjac = rcond(fjac);
end
if rcond_fjac < sqrt(eps)
fjac2=fjac'*fjac; fjac2=fjac'*fjac;
p=-(fjac2+1e6*sqrt(nn*eps)*max(sum(abs(fjac2)))*eye(nn))\(fjac'*fvec); p=-(fjac2+1e6*sqrt(nn*eps)*max(sum(abs(fjac2)))*eye(nn))\(fjac'*fvec);
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment