lnsrch1.m: do not display debugging info for perfect_foresight_solver

Necessary info does not exist within function to correctly identify problematic variables, leading to crashes with stack_solve_algo=7
time-shift
Johannes Pfeifer 2016-07-03 12:37:30 +02:00 committed by Stéphane Adjemian (Lupi)
parent 38e1ec6b1e
commit dea930d329
1 changed files with 20 additions and 18 deletions

View File

@ -48,25 +48,27 @@ x = xold;
nn = length(j2);
summ = sqrt(p'*p);
if ~isfinite(summ)
eq_number_string=[];
for ii=1:length(j1)-1
eq_number_string=[eq_number_string, num2str(j1(ii)), ', '];
if ~isfinite(summ)
if ~isequal(func,@perfect_foresight_problem)
eq_number_string=[];
for ii=1:length(j1)-1
eq_number_string=[eq_number_string, num2str(j1(ii)), ', '];
end
eq_number_string=[eq_number_string, num2str(j1(end))];
var_string=[];
Model=evalin('base','M_');
for ii=1:length(j2)-1
var_string=[var_string, deblank(Model.endo_names(j2(ii),:)), ', '];
end
var_string=[var_string, deblank(Model.endo_names(j2(end),:))];
fprintf('\nAn infinite element was encountered when trying to solve equation(s) %s \n',eq_number_string)
fprintf('with respect to the variable(s): %s.\n',var_string)
fprintf('The values of the endogenous variables when the problem was encountered were:\n')
for ii=1:length(xold)
fprintf('%-s % 8.4g \n',Model.endo_names(ii,:),xold(ii));
end
skipline();
end
eq_number_string=[eq_number_string, num2str(j1(end))];
var_string=[];
Model=evalin('base','M_');
for ii=1:length(j2)-1
var_string=[var_string, deblank(Model.endo_names(j2(ii),:)), ', '];
end
var_string=[var_string, deblank(Model.endo_names(j2(end),:))];
fprintf('\nAn infinite element was encountered when trying to solve equation(s) %s \n',eq_number_string)
fprintf('with respect to the variable(s): %s.\n',var_string)
fprintf('The values of the endogenous variables when the problem was encountered were:\n')
for ii=1:length(xold)
fprintf('%-s % 8.4g \n',Model.endo_names(ii,:),xold(ii));
end
skipline();
error(['Some element of Newton direction isn''t finite. Jacobian maybe' ...
' singular or there is a problem with initial values'])
end