Make options_.dynatol specific to x/f by adding dynatol.x and dynatol.f. By default dynatol.x=dynatol.f= old default value of dynatol.
parent
87052bc243
commit
a36cf30118
|
@ -152,7 +152,7 @@ while (t<sample_size)
|
|||
end
|
||||
end
|
||||
% Test if periods is big enough.
|
||||
if ~increase_periods && max(max(abs(tmp(idx,end-options_.ep.lp:end)./tmp(idx,end-options_.ep.lp-1:end-1)-1)))<options_.dynatol
|
||||
if ~increase_periods && max(max(abs(tmp(idx,end-options_.ep.lp:end)./tmp(idx,end-options_.ep.lp-1:end-1)-1)))<options_.dynatol.x
|
||||
break
|
||||
else
|
||||
options_.periods = options_.periods + options_.ep.step;
|
||||
|
@ -183,7 +183,7 @@ while (t<sample_size)
|
|||
info.time = info.time+ctime;
|
||||
if info.convergence
|
||||
maxdiff = max(max(abs(tmp(:,2:options_.ep.fp)-tmp_old(:,2:options_.ep.fp))));
|
||||
if maxdiff<options_.dynatol
|
||||
if maxdiff<options_.dynatol.x
|
||||
options_.periods = options_.ep.periods;
|
||||
options_.minimal_solving_period = options_.periods;
|
||||
oo_.exo_simul = oo_.exo_simul(1:(options_.periods+2),:);
|
||||
|
|
|
@ -64,7 +64,7 @@ if homotopy_1
|
|||
weight = weight-step_length;
|
||||
step_length=step_length/10;
|
||||
weight = weight+step_length;
|
||||
if 10*step_length<options_.dynatol
|
||||
if 10*step_length<options_.dynatol.x
|
||||
homotopy_1 = 0;
|
||||
homotopy_2 = 0;
|
||||
break
|
||||
|
@ -153,7 +153,7 @@ if homotopy_2
|
|||
disp('I am reducing the step length!')
|
||||
end
|
||||
step_length=step_length/10;
|
||||
if 10*step_length<options_.dynatol
|
||||
if 10*step_length<options_.dynatol.x
|
||||
homotopy_1 = 0;
|
||||
homotopy_2 = 0;
|
||||
break
|
||||
|
|
|
@ -74,7 +74,7 @@ function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadysta
|
|||
info(2) = check; % to be improved
|
||||
return;
|
||||
end
|
||||
if max(abs(residuals)) > options.dynatol
|
||||
if max(abs(residuals)) > options.dynatol.f
|
||||
info(1) = 19;
|
||||
info(2) = residuals'*residuals;
|
||||
return
|
||||
|
|
|
@ -38,7 +38,8 @@ options_.console_mode = 0;
|
|||
options_.terminal_condition = 0;
|
||||
options_.rplottype = 0;
|
||||
options_.smpl = 0;
|
||||
options_.dynatol = 0.00001;
|
||||
options_.dynatol.f = 1e-5;
|
||||
options_.dynatol.x = 1e-5;
|
||||
options_.maxit_ = 10;
|
||||
options_.slowc = 1;
|
||||
options_.timing = 0;
|
||||
|
|
|
@ -98,7 +98,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
|
||||
oo_.exo_det_steady_state], M_.params))) > options_.dynatol.f
|
||||
[ys,check1] = dynare_solve(fh,dr.ys,1,...
|
||||
[oo_.exo_steady_state; ...
|
||||
oo_.exo_det_steady_state], ...
|
||||
|
|
|
@ -89,7 +89,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
|
||||
oo_.exo_det_steady_state], M_.params))) > options_.dynatol.f
|
||||
[dr.ys,check1] = dynare_solve(fh,dr.ys,options_.jacobian_flag,...
|
||||
[oo_.exo_steady_state; ...
|
||||
oo_.exo_det_steady_state], M_.params);
|
||||
|
|
|
@ -159,7 +159,7 @@ for iter = 1:options_.maxit_
|
|||
last_line = iter;
|
||||
break
|
||||
end
|
||||
if err < options_.dynatol
|
||||
if err < options_.dynatol.f
|
||||
stop = 1;
|
||||
info.time = etime(clock,h1);
|
||||
info.error = err;
|
||||
|
|
|
@ -101,7 +101,7 @@ if nargout == 0
|
|||
disp('Residuals of the static equations:')
|
||||
disp(' ')
|
||||
for i=1:M_.orig_endo_nbr
|
||||
if abs(z(i)) < options_.dynatol/100
|
||||
if abs(z(i)) < options_.dynatol.f/100
|
||||
tmp = 0;
|
||||
else
|
||||
tmp = z(i);
|
||||
|
|
|
@ -102,7 +102,7 @@ for iter = 1:options_.maxit_
|
|||
disp([num2str(iter) ' - err = ' num2str(err)]) ;
|
||||
disp([' Time of iteration :' num2str(etime(clock,h2))]) ;
|
||||
|
||||
if err < options_.dynatol
|
||||
if err < options_.dynatol.f
|
||||
stop = 1 ;
|
||||
fprintf('\n') ;
|
||||
disp([' Total time of simulation :' num2str(etime(clock,h1))]) ;
|
||||
|
|
|
@ -318,7 +318,7 @@ for iter = 1:options_.maxit_
|
|||
if options_.timing
|
||||
disp ([' Back substitution : ' num2str(hbacsup)]) ;
|
||||
end
|
||||
if err < options_.dynatol
|
||||
if err < options_.dynatol.f
|
||||
h1 = etime(clock,h1) ;
|
||||
fprintf ('\n') ;
|
||||
disp ([' Total time of simulation : ' num2str(h1)]) ;
|
||||
|
|
|
@ -302,7 +302,8 @@ main(int nrhs, const char *prhs[])
|
|||
else
|
||||
{
|
||||
solve_algo = stack_solve_algo;
|
||||
solve_tolf = *(mxGetPr(mxGetFieldByNumber(options_, 0, mxGetFieldNumber(options_, "dynatol"))));
|
||||
mxArray *dynatol = mxGetFieldByNumber(options_, 0, mxGetFieldNumber(options_, "dynatol"));
|
||||
solve_tolf= *mxGetPr((mxGetFieldByNumber(dynatol, 0, mxGetFieldNumber(dynatol, "f"))));
|
||||
}
|
||||
|
||||
mxArray *mxa = mxGetFieldByNumber(M_, 0, mxGetFieldNumber(M_, "fname"));
|
||||
|
|
|
@ -7,7 +7,7 @@ end;
|
|||
fprintf(fid,'%d\n',options_.maxit_);
|
||||
fprintf(fid,'%6.20f\n',options_.slowc);
|
||||
fprintf(fid,'%6.20f\n',options_.markowitz);
|
||||
fprintf(fid,'%6.20f\n',options_.dynatol);
|
||||
fprintf(fid,'%6.20f\n',options_.dynatol.f);
|
||||
fprintf(fid,'%d\n',options_.minimal_solving_periods);
|
||||
fclose(fid);
|
||||
|
||||
|
|
|
@ -59,12 +59,12 @@ k=k+0.000001;
|
|||
|
||||
end;
|
||||
|
||||
options_.dynatol=1e-12;
|
||||
options_.dynatol.f=1e-12;
|
||||
options_.maxit_=5;
|
||||
options_.slowc=1;
|
||||
steady(solve_algo=2);
|
||||
|
||||
options_.dynatol=4e-5;
|
||||
options_.dynatol.f=4e-5;
|
||||
|
||||
shocks;
|
||||
var e;
|
||||
|
|
|
@ -119,7 +119,7 @@ for blockFlag = 0:1
|
|||
% Test against the reference simulation path
|
||||
load('test.mat','y_ref');
|
||||
diff = oo_.endo_simul - y_ref;
|
||||
if(abs(diff) > options_.dynatol)
|
||||
if(abs(diff) > options_.dynatol.x)
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')'];
|
||||
exception = MException('ERROR: simulation path differs from the reference path');
|
||||
printMakeCheckMatlabErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')'], exception);
|
||||
|
@ -145,7 +145,7 @@ for blockFlag = 0:1
|
|||
% Test against the reference simulation path
|
||||
load('test.mat','y_ref');
|
||||
diff = oo_.endo_simul - y_ref;
|
||||
if(abs(diff) > options_.dynatol)
|
||||
if(abs(diff) > options_.dynatol.x)
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(default_solve_algo) ', ' num2str(stack_solve_algos(i)) ')'];
|
||||
exception = MException('ERROR: simulation path difers from the reference path');
|
||||
printMakeCheckMatlabErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(default_solve_algo) ', ' num2str(stack_solve_algos(i)) ')'], exception);
|
||||
|
|
|
@ -113,7 +113,7 @@ for blockFlag = 0:1
|
|||
## Test against the reference simulation path
|
||||
load('test.mat','y_ref');
|
||||
diff = oo_.endo_simul - y_ref;
|
||||
if(abs(diff) > options_.dynatol)
|
||||
if(abs(diff) > options_.dynatol.x)
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')'];
|
||||
differr.message = ["ERROR: simulation path differs from the reference path" ];
|
||||
printMakeCheckOctaveErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')'], differr);
|
||||
|
@ -137,7 +137,7 @@ for blockFlag = 0:1
|
|||
## Test against the reference simulation path
|
||||
load('test.mat','y_ref');
|
||||
diff = oo_.endo_simul - y_ref;
|
||||
if(abs(diff) > options_.dynatol)
|
||||
if(abs(diff) > options_.dynatol.x)
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(default_solve_algo) ', ' num2str(stack_solve_algos(i)) ')'];
|
||||
differr.message = ["ERROR: simulation path differs from the reference path" ];
|
||||
printMakeCheckOctaveErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(default_solve_algo) ', ' num2str(stack_solve_algos(i)) ')'], differr);
|
||||
|
|
Loading…
Reference in New Issue