diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m index 9fe808c7e..456d0a996 100644 --- a/matlab/global_initialization.m +++ b/matlab/global_initialization.m @@ -164,6 +164,9 @@ options_.SpectralDensity.cutoff = 150; options_.SpectralDensity.sdl = 0.01; options_.nofunctions = false; +options_.bandpass.indicator = 0; +options_.bandpass.passband = [6; 32]; + % Extended path options % % Set debug flag diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index 2b4063af5..7174e2cba 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/ComputingTasks.cc @@ -167,6 +167,12 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli || mod_file_struct.order_option >= 3) mod_file_struct.k_order_solver = true; + if (options_list.num_options.find("hp_filter") != options_list.num_options.end() && + options_list.num_options.find("bandpass.indicator") != options_list.num_options.end()) + { + cerr << "ERROR: stoch_simul: can only use one of hp and bandpass filters" << endl; + exit(EXIT_FAILURE); + } } void diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy index 1ce89fbda..58246993d 100644 --- a/preprocessor/DynareBison.yy +++ b/preprocessor/DynareBison.yy @@ -127,7 +127,7 @@ class ParsingDriver; %token UNIFORM_PDF UNIT_ROOT_VARS USE_DLL USEAUTOCORR GSA_SAMPLE_FILE USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED %token VALUES VAR VAREXO VAREXO_DET VAROBS PREDETERMINED_VARIABLES %token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL WRITE_LATEX_ORIGINAL_MODEL -%token XLS_SHEET XLS_RANGE LONG_NAME LMMCP OCCBIN +%token XLS_SHEET XLS_RANGE LONG_NAME LMMCP OCCBIN BANDPASS_FILTER %left COMMA %left EQUAL_EQUAL EXCLAMATION_EQUAL %left LESS GREATER LESS_EQUAL GREATER_EQUAL @@ -1106,6 +1106,7 @@ stoch_simul_options : stoch_simul_primary_options | o_loglinear | o_nodecomposition | o_spectral_density + | o_bandpass_filter ; symbol_list : symbol_list symbol @@ -2578,6 +2579,13 @@ o_extended_path_order : ORDER EQUAL INT_NUMBER { driver.option_num("ep.stochasti o_hybrid : HYBRID { driver.option_num("ep.stochastic.hybrid_order", "2"); }; o_steady_maxit : MAXIT EQUAL INT_NUMBER { driver.option_num("steady.maxit", $3); }; o_simul_maxit : MAXIT EQUAL INT_NUMBER { driver.option_num("simul.maxit", $3); }; +o_bandpass_filter : BANDPASS_FILTER { driver.option_num("bandpass.indicator", "1"); } + | BANDPASS_FILTER EQUAL vec_int + { + driver.option_num("bandpass.indicator", "1"); + driver.option_vec_int("bandpass.passband", $3); + } + ; o_dp_maxit : MAXIT EQUAL INT_NUMBER { driver.option_num("dp.maxit", $3); }; o_osr_maxit : MAXIT EQUAL INT_NUMBER { driver.option_num("osr.maxit", $3); }; o_osr_tolf : TOLF EQUAL non_negative_number { driver.option_num("osr.tolf", $3); }; diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll index f7b053b63..3ab5af757 100644 --- a/preprocessor/DynareFlex.ll +++ b/preprocessor/DynareFlex.ll @@ -637,6 +637,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2 irf {return token::IRF;} irf_shocks {return token::IRF_SHOCKS;} hp_filter {return token::HP_FILTER;} +bandpass_filter {return token::BANDPASS_FILTER;} hp_ngrid {return token::HP_NGRID;} simul_seed {return token::SIMUL_SEED;} qz_criterium {return token::QZ_CRITERIUM;}