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 valuestime-shift
parent
9036fae16f
commit
1b56a56e78
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue