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
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
......
......@@ -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
......
......@@ -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,...
......
......@@ -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);
......
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