Commit c850f03b authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Added the possibility to use the logarithmic reduction algorithm (mainly for testing purpose).

parent 0d5dff2b
......@@ -3172,13 +3172,17 @@ Determines the method used to compute the decision rule. Possible values for @co
@table @code
@item default
Uses the default method to compute the decision rule based on the generalized Schur decomposition
Uses the default method to compute the decision rule based on the generalized Schur decomposition
(see @cite{Villemot (2011)} for more information).
@item cycle_reduction
Uses the cycle reduction algorithm to solve the polynomial equation for retrieving the coefficients
Uses the cycle reduction algorithm to solve the polynomial equation for retrieving the coefficients
associated to the endogenous variables in the decision rule. This method is faster than the @code{default} one for large scale models.
@item logarithmic_reduction
Uses the logarithmic reduction algorithm to solve the polynomial equation for retrieving the coefficients
associated to the endogenous variables in the decision rule. This method is in general slower than the @code{cycle_reduction}.
@end table
@noindent
......@@ -3186,7 +3190,16 @@ Default value is @code{default}
@item dr_cycle_reduction_tol = @var{DOUBLE}
@anchor{dr_cycle_reduction_tol}
It is the convergence criterion used in the cycle reduction algorithm. Its default value is 1e-7.
The convergence criterion used in the cycle reduction algorithm. Its default value is 1e-7.
@item dr_logarithmic_reduction_tol = @var{DOUBLE}
@anchor{dr_logarithmic_reduction_tol}
The convergence criterion used in the logarithmic reduction algorithm. Its default value is 1e-12.
@item dr_logarithmic_reduction_maxiter = @var{INTEGER}
@anchor{dr_logarithmic_reduction_maxiter}
The maximum number of iterations used in the logarithmic reduction algorithm. Its default value is 100.
@end table
......
......@@ -149,11 +149,15 @@ A = aa(:,index_m); % Jacobain matrix for lagged endogeneous variables
B = aa(:,index_c); % Jacobian matrix for contemporaneous endogeneous variables
C = aa(:,index_p); % Jacobain matrix for led endogeneous variables
if task ~= 1 && DynareOptions.dr_cycle_reduction == 1
if task ~= 1 && (DynareOptions.dr_cycle_reduction || DynareOptions.dr_logarithmic_reduction)
A1 = [aa(row_indx,index_m ) zeros(ndynamic,nfwrd)];
B1 = [aa(row_indx,index_0m) aa(row_indx,index_0p) ];
C1 = [zeros(ndynamic,npred) aa(row_indx,index_p)];
[ghx, info] = cycle_reduction(A1, B1, C1, DynareOptions.dr_cycle_reduction_tol);
if DynareOptions.dr_cycle_reduction == 1
[ghx, info] = cycle_reduction(A1, B1, C1, DynareOptions.dr_cycle_reduction_tol);
else
[ghx, info] = logarithmic_reduction(C1, B1, A1, DynareOptions.dr_logarithmic_reduction_tol, DynareOptions.dr_logarithmic_reduction_maxiter);
end
ghx = ghx(:,index_m);
hx = ghx(1:npred+nboth,:);
gx = ghx(1+npred:end,:);
......
......@@ -28,8 +28,7 @@ function global_initialization()
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global oo_ M_ options_ estim_params_ bayestopt_ estimation_info ex0_ ys0_ ...
ex_det0_
global oo_ M_ options_ estim_params_ bayestopt_ estimation_info ex0_ ys0_ ex_det0_
estim_params_ = [];
bayestopt_ = [];
......@@ -450,6 +449,14 @@ options_.dr_cycle_reduction = 0;
% convergence criterion for iteratives methods to solve the decision rule
options_.dr_cycle_reduction_tol = 1e-7;
% if equal to 1 use a logarithmic reduction method to compute the decision rule (for large scale models)
options_.dr_logarithmic_reduction = 0;
% convergence criterion for iteratives methods to solve the decision rule
options_.dr_logarithmic_reduction_tol = 1e-12;
% convergence criterion for iteratives methods to solve the decision rule
options_.dr_logarithmic_reduction_maxiter = 100;
% dates for historical time series
options_.initial_date.freq = 1;
......
......@@ -95,8 +95,8 @@ class ParsingDriver;
%token BVAR_PRIOR_DECAY BVAR_PRIOR_FLAT BVAR_PRIOR_LAMBDA
%token BVAR_PRIOR_MU BVAR_PRIOR_OMEGA BVAR_PRIOR_TAU BVAR_PRIOR_TRAIN
%token BVAR_REPLIC BYTECODE
%token CALIB_SMOOTHER CHANGE_TYPE CHECK CONDITIONAL_FORECAST CONDITIONAL_FORECAST_PATHS CONF_SIG CONSTANT CONTROLLED_VAREXO CORR COVAR CUTOFF CYCLE_REDUCTION
%token DATAFILE FILE DOUBLING DR_CYCLE_REDUCTION_TOL DR_ALGO DROP DSAMPLE DYNASAVE DYNATYPE CALIBRATION
%token CALIB_SMOOTHER CHANGE_TYPE CHECK CONDITIONAL_FORECAST CONDITIONAL_FORECAST_PATHS CONF_SIG CONSTANT CONTROLLED_VAREXO CORR COVAR CUTOFF CYCLE_REDUCTION LOGARITHMIC_REDUCTION
%token DATAFILE FILE DOUBLING DR_CYCLE_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_MAXITER DR_ALGO DROP DSAMPLE DYNASAVE DYNATYPE CALIBRATION
%token END ENDVAL EQUAL ESTIMATION ESTIMATED_PARAMS ESTIMATED_PARAMS_BOUNDS ESTIMATED_PARAMS_INIT EXTENDED_PATH
%token FILENAME FILTER_STEP_AHEAD FILTERED_VARS FIRST_OBS LAST_OBS SET_TIME
%token <string_val> FLOAT_NUMBER
......@@ -939,6 +939,8 @@ stoch_simul_options : o_dr_algo
| o_sylvester_fixed_point_tol
| o_dr
| o_dr_cycle_reduction_tol
| o_dr_logarithmic_reduction_tol
| o_dr_logarithmic_reduction_maxiter
;
symbol_list : symbol_list symbol
......@@ -1508,6 +1510,8 @@ estimation_options : o_datafile
| o_lyapunov_doubling_tol
| o_dr
| o_dr_cycle_reduction_tol
| o_dr_logarithmic_reduction_tol
| o_dr_logarithmic_reduction_maxiter
| o_analytic_derivation
;
......@@ -2318,8 +2322,11 @@ o_lyapunov : LYAPUNOV EQUAL FIXED_POINT {driver.option_num("lyapunov_fp", "1");
o_lyapunov_fixed_point_tol : LYAPUNOV_FIXED_POINT_TOL EQUAL non_negative_number {driver.option_num("lyapunov_fixed_point_tol",$3);};
o_lyapunov_doubling_tol : LYAPUNOV_DOUBLING_TOL EQUAL non_negative_number {driver.option_num("lyapunov_doubling_tol",$3);};
o_dr : DR EQUAL CYCLE_REDUCTION {driver.option_num("dr_cycle_reduction", "1"); }
| DR EQUAL DEFAULT {driver.option_num("dr_cycle_reduction", "0"); };
| DR EQUAL LOGARITHMIC_REDUCTION {driver.option_num("dr_logarithmic_reduction", "1"); }
| DR EQUAL DEFAULT {driver.option_num("dr_cycle_reduction", "0"); driver.option_num("dr_logarithmic_reduction", "0");};
o_dr_cycle_reduction_tol : DR_CYCLE_REDUCTION_TOL EQUAL non_negative_number {driver.option_num("dr_cycle_reduction_tol",$3);};
o_dr_logarithmic_reduction_tol : DR_LOGARITHMIC_REDUCTION_TOL EQUAL non_negative_number {driver.option_num("dr_logarithmic_reduction_tol",$3);};
o_dr_logarithmic_reduction_maxiter : DR_LOGARITHMIC_REDUCTION_MAXITER EQUAL INT_NUMBER {driver.option_num("dr_logarithmic_reduction_maxiter",$3);};
o_bvar_prior_tau : BVAR_PRIOR_TAU EQUAL signed_number { driver.option_num("bvar_prior_tau", $3); };
o_bvar_prior_decay : BVAR_PRIOR_DECAY EQUAL non_negative_number { driver.option_num("bvar_prior_decay", $3); };
......
......@@ -303,6 +303,7 @@ string eofbuff;
<DYNARE_STATEMENT>doubling {return token::DOUBLING;}
<DYNARE_STATEMENT>square_root_solver {return token::SQUARE_ROOT_SOLVER;}
<DYNARE_STATEMENT>cycle_reduction {return token::CYCLE_REDUCTION;}
<DYNARE_STATEMENT>logarithmic_reduction {return token::LOGARITHMIC_REDUCTION;}
<DYNARE_STATEMENT>default {return token::DEFAULT;}
<DYNARE_STATEMENT>alpha {
yylval->string_val = new string(yytext);
......@@ -514,6 +515,8 @@ string eofbuff;
<DYNARE_STATEMENT>lyapunov_fixed_point_tol {return token::LYAPUNOV_FIXED_POINT_TOL;}
<DYNARE_STATEMENT>lyapunov_doubling_tol {return token::LYAPUNOV_DOUBLING_TOL;}
<DYNARE_STATEMENT>dr_cycle_reduction_tol {return token::DR_CYCLE_REDUCTION_TOL;}
<DYNARE_STATEMENT>dr_logarithmic_reduction_tol {return token::DR_LOGARITHMIC_REDUCTION_TOL;}
<DYNARE_STATEMENT>dr_logarithmic_reduction_maxiter {return token::DR_LOGARITHMIC_REDUCTION_MAXITER;}
<DYNARE_STATEMENT>replic {return token::REPLIC;}
<DYNARE_STATEMENT>ar {return token::AR;}
<DYNARE_STATEMENT>nofunctions {return token::NOFUNCTIONS;}
......
Supports Markdown
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