Add more checks on the initial evaluation.

trustregion
Stéphane Adjemian (Ryûk) 2022-03-03 18:33:34 +01:00
parent 3c85695b99
commit f2193e8ec8
Signed by: stepan
GPG Key ID: 295C1FE89E17EB3C
1 changed files with 17 additions and 0 deletions

View File

@ -54,6 +54,8 @@ fvec = feval(func,x,varargin{:});
fvec = fvec(j1);
idInf = isinf(fvec);
idNan = isnan(fvec);
idCpx = ~isreal(fvec);
if any(idInf)
disp('SOLVE1: during the resolution of the non-linear system, the evaluation of the following equation(s) resulted in a non-finite number:')
@ -62,6 +64,21 @@ if any(idInf)
return
end
if any(idNan)
disp('SOLVE1: during the resolution of the non-linear system, the evaluation of the following equation(s) resulted in a nan:')
disp(j1(idNan)')
check = 1;
return
end
if any(idNan)
disp('SOLVE1: during the resolution of the non-linear system, the evaluation of the following equation(s) resulted in a complex number:')
disp(j1(idCpx)')
check = 1;
return
end
f = 0.5*(fvec'*fvec) ;
if max(abs(fvec)) < tolf*tolf