Correctly distinguish tolerance between steady and perfect foresight

steady uses options_.solve_tolf as a termination criterion, so subsequent checks should do the same. Similarly, solve_tolx was never used.
time-shift
Johannes Pfeifer 2020-07-06 13:11:23 +02:00
parent 4913cfb3f0
commit 607a273bb0
4 changed files with 9 additions and 7 deletions

View File

@ -48,8 +48,10 @@ else
end
if strcmp(caller_file_name,'solve_stacked_problem.m')
tolf = options.dynatol.f;
tolx = options.dynatol.x;
else
tolf = options.solve_tolf;
tolx = options.solve_tolx;
end
if strcmp(caller_file_name,'dyn_ramsey_static.m')
@ -216,11 +218,11 @@ if options.solve_algo == 0
end
elseif options.solve_algo == 1
[x,info]=solve1(func,x,1:nn,1:nn,jacobian_flag,options.gstep, ...
tolf,options.solve_tolx, ...
tolf,tolx, ...
maxit,options.debug,varargin{:});
elseif options.solve_algo == 9
[x,info]=trust_region(func,x,1:nn,1:nn,jacobian_flag,options.gstep, ...
tolf,options.solve_tolx, ...
tolf,tolx, ...
maxit,options.debug,varargin{:});
elseif options.solve_algo == 2 || options.solve_algo == 4
@ -252,7 +254,7 @@ elseif options.solve_algo == 2 || options.solve_algo == 4
end
[x,info]=solver(func,x,j1(r(i):r(i+1)-1),j2(r(i):r(i+1)-1),jacobian_flag, ...
options.gstep, ...
tolf,options.solve_tolx, ...
tolf,tolx, ...
maxit,options.debug,varargin{:});
if info
return
@ -261,7 +263,7 @@ elseif options.solve_algo == 2 || options.solve_algo == 4
fvec = feval(func,x,varargin{:});
if max(abs(fvec)) > tolf
[x,info]=solver(func,x,1:nn,1:nn,jacobian_flag, ...
options.gstep, tolf,options.solve_tolx, ...
options.gstep, tolf,tolx, ...
maxit,options.debug,varargin{:});
end
elseif options.solve_algo == 3

View File

@ -111,7 +111,7 @@ if steady_state_checkflag
info(2) = check; % to be improved
return
end
if max(abs(residuals)) > options.dynatol.f
if max(abs(residuals)) > options.solve_tolf
info(1) = 19;
info(2) = residuals'*residuals;
return

View File

@ -88,7 +88,7 @@ else
if options_.linear == 0
% nonlinear models
if max(abs(feval(fh,dr.ys,[oo_.exo_steady_state; ...
oo_.exo_det_steady_state], M_.params))) > options_.dynatol.f
oo_.exo_det_steady_state], M_.params))) > options_.solve_tolf
opt = options_;
opt.jacobian_flag = false;
[dr.ys,check1] = dynare_solve(fh,dr.ys,opt,...

View File

@ -103,7 +103,7 @@ if nargout == 0
disp('Residuals of the static equations:')
skipline()
for i=1:M_.orig_endo_nbr
if abs(z(i)) < options_.dynatol.f/100
if abs(z(i)) < options_.solve_tolf/100
tmp = 0;
else
tmp = z(i);