dynare_solve.m: return with valid solution even if Jacobian is ill-behaved

In pathological cases, the Jacobian at the initial but true steady state value is ill-behaved. In this case we should return with the valid steady state instead of trying random starting values
time-shift
Johannes Pfeifer 2019-12-12 18:50:46 +01:00
parent 9036fae16f
commit 1b56a56e78
1 changed files with 4 additions and 0 deletions

View File

@ -78,6 +78,10 @@ if jacobian_flag
wrong_initial_guess_flag = false;
if ~all(isfinite(fvec)) || any(isinf(fjac(:))) || any(isnan((fjac(:)))) ...
|| any(~isreal(fvec)) || any(~isreal(fjac(:)))
if max(abs(fvec)) < tolf %return if initial value solves problem
info = 0;
return;
end
disp('Randomize initial guess...')
% Let's try random numbers for the variables initialized with the default value.
wrong_initial_guess_flag = true;