Merge pull request #449 from JohannesPfeifer/linesearch_info
Provide additional debugging info before lnsrch1 crashes with errortime-shift
commit
d392f97485
|
@ -50,6 +50,24 @@ x = xold;
|
||||||
nn = length(j2);
|
nn = length(j2);
|
||||||
summ = sqrt(sum(p.*p)) ;
|
summ = sqrt(sum(p.*p)) ;
|
||||||
if ~isfinite(summ)
|
if ~isfinite(summ)
|
||||||
|
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();
|
||||||
error(['Some element of Newton direction isn''t finite. Jacobian maybe' ...
|
error(['Some element of Newton direction isn''t finite. Jacobian maybe' ...
|
||||||
' singular or there is a problem with initial values'])
|
' singular or there is a problem with initial values'])
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue