Commit dc6e3406 authored by Sébastien Villemot's avatar Sébastien Villemot

Merge branch 'tolerance' into 'master'

Correctly distinguish tolerance between steady and perfect foresight

See merge request Dynare/dynare!1746
parents 6a627122 607a273b
...@@ -48,8 +48,10 @@ else ...@@ -48,8 +48,10 @@ else
end end
if strcmp(caller_file_name,'solve_stacked_problem.m') if strcmp(caller_file_name,'solve_stacked_problem.m')
tolf = options.dynatol.f; tolf = options.dynatol.f;
tolx = options.dynatol.x;
else else
tolf = options.solve_tolf; tolf = options.solve_tolf;
tolx = options.solve_tolx;
end end
if strcmp(caller_file_name,'dyn_ramsey_static.m') if strcmp(caller_file_name,'dyn_ramsey_static.m')
...@@ -216,11 +218,11 @@ if options.solve_algo == 0 ...@@ -216,11 +218,11 @@ if options.solve_algo == 0
end end
elseif options.solve_algo == 1 elseif options.solve_algo == 1
[x,info]=solve1(func,x,1:nn,1:nn,jacobian_flag,options.gstep, ... [x,info]=solve1(func,x,1:nn,1:nn,jacobian_flag,options.gstep, ...
tolf,options.solve_tolx, ... tolf,tolx, ...
maxit,options.debug,varargin{:}); maxit,options.debug,varargin{:});
elseif options.solve_algo == 9 elseif options.solve_algo == 9
[x,info]=trust_region(func,x,1:nn,1:nn,jacobian_flag,options.gstep, ... [x,info]=trust_region(func,x,1:nn,1:nn,jacobian_flag,options.gstep, ...
tolf,options.solve_tolx, ... tolf,tolx, ...
maxit,options.debug,varargin{:}); maxit,options.debug,varargin{:});
elseif options.solve_algo == 2 || options.solve_algo == 4 elseif options.solve_algo == 2 || options.solve_algo == 4
...@@ -252,7 +254,7 @@ elseif options.solve_algo == 2 || options.solve_algo == 4 ...@@ -252,7 +254,7 @@ elseif options.solve_algo == 2 || options.solve_algo == 4
end end
[x,info]=solver(func,x,j1(r(i):r(i+1)-1),j2(r(i):r(i+1)-1),jacobian_flag, ... [x,info]=solver(func,x,j1(r(i):r(i+1)-1),j2(r(i):r(i+1)-1),jacobian_flag, ...
options.gstep, ... options.gstep, ...
tolf,options.solve_tolx, ... tolf,tolx, ...
maxit,options.debug,varargin{:}); maxit,options.debug,varargin{:});
if info if info
return return
...@@ -261,7 +263,7 @@ elseif options.solve_algo == 2 || options.solve_algo == 4 ...@@ -261,7 +263,7 @@ elseif options.solve_algo == 2 || options.solve_algo == 4
fvec = feval(func,x,varargin{:}); fvec = feval(func,x,varargin{:});
if max(abs(fvec)) > tolf if max(abs(fvec)) > tolf
[x,info]=solver(func,x,1:nn,1:nn,jacobian_flag, ... [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{:}); maxit,options.debug,varargin{:});
end end
elseif options.solve_algo == 3 elseif options.solve_algo == 3
......
...@@ -111,7 +111,7 @@ if steady_state_checkflag ...@@ -111,7 +111,7 @@ if steady_state_checkflag
info(2) = check; % to be improved info(2) = check; % to be improved
return return
end end
if max(abs(residuals)) > options.dynatol.f if max(abs(residuals)) > options.solve_tolf
info(1) = 19; info(1) = 19;
info(2) = residuals'*residuals; info(2) = residuals'*residuals;
return return
......
...@@ -88,7 +88,7 @@ else ...@@ -88,7 +88,7 @@ else
if options_.linear == 0 if options_.linear == 0
% nonlinear models % nonlinear models
if max(abs(feval(fh,dr.ys,[oo_.exo_steady_state; ... 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 = options_;
opt.jacobian_flag = false; opt.jacobian_flag = false;
[dr.ys,check1] = dynare_solve(fh,dr.ys,opt,... [dr.ys,check1] = dynare_solve(fh,dr.ys,opt,...
......
...@@ -103,7 +103,7 @@ if nargout == 0 ...@@ -103,7 +103,7 @@ if nargout == 0
disp('Residuals of the static equations:') disp('Residuals of the static equations:')
skipline() skipline()
for i=1:M_.orig_endo_nbr 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; tmp = 0;
else else
tmp = z(i); tmp = z(i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment