From 595171a02bcc82bc8c3a4021592357ad2e132e12 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Wed, 20 Apr 2011 12:13:30 +0200 Subject: [PATCH] identification: added advanced and max_dim_cova_group to the preprocessor --- preprocessor/ComputingTasks.cc | 13 +++++++++++-- preprocessor/ComputingTasks.hh | 2 +- preprocessor/DynareBison.yy | 6 +++++- preprocessor/DynareFlex.ll | 3 ++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index 0b12ef763..ed1454ed7 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/ComputingTasks.cc @@ -939,9 +939,18 @@ MS_SBVARStatement::writeOutput(ostream &output, const string &basename) const output << "ms_sbvar(1,M_,options_);" << endl; } -IdentificationStatement::IdentificationStatement(const OptionsList &options_list_arg) : - options_list(options_list_arg) +IdentificationStatement::IdentificationStatement(const OptionsList &options_list_arg) { + options_list = options_list_arg; + if (options_list.num_options.find("advanced") == options_list.num_options.end()) + options_list.num_options["advanced"] = "0"; + + if (options_list.num_options.find("max_dim_cova_group") != options_list.num_options.end()) + if (atoi(options_list.num_options["max_dim_cova_group"].c_str()) == 0) + { + cerr << "ERROR: The max_dim_cova_group option to identification only accepts integers > 0." << endl; + exit(EXIT_FAILURE); + } } void diff --git a/preprocessor/ComputingTasks.hh b/preprocessor/ComputingTasks.hh index 055ffc4fe..4c22c1400 100644 --- a/preprocessor/ComputingTasks.hh +++ b/preprocessor/ComputingTasks.hh @@ -391,7 +391,7 @@ public: class IdentificationStatement : public Statement { private: - const OptionsList options_list; + OptionsList options_list; public: IdentificationStatement(const OptionsList &options_list_arg); virtual void checkPass(ModFileStructure &mod_file_struct); diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy index f35184527..ef9d5193f 100644 --- a/preprocessor/DynareBison.yy +++ b/preprocessor/DynareBison.yy @@ -113,7 +113,7 @@ class ParsingDriver; %token NAME %token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NOCORR NODIAGNOSTIC NOFUNCTIONS %token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF -%token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS +%token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS MAX_DIM_COVA_GROUP ADVANCED %token PARAMETERS PARAMETER_SET PARTIAL_INFORMATION PERIODS PLANNER_OBJECTIVE PLOT_CONDITIONAL_FORECAST PLOT_PRIORS PREFILTER PRESAMPLE %token PRINT PRIOR_MC PRIOR_TRUNC PRIOR_MODE PRIOR_MEAN POSTERIOR_MODE POSTERIOR_MEAN POSTERIOR_MEDIAN PRUNING %token QUOTED_STRING @@ -1265,6 +1265,8 @@ identification_option : o_ar | o_useautocorr | o_load_ident_files | o_prior_mc + | o_advanced + | o_max_dim_cova_group ; model_comparison : MODEL_COMPARISON mc_filename_list ';' @@ -1820,6 +1822,8 @@ o_gsa_trans_ident : TRANS_IDENT EQUAL INT_NUMBER { driver.option_num("trans_iden o_load_ident_files : LOAD_IDENT_FILES EQUAL INT_NUMBER { driver.option_num("load_ident_files", $3); } o_useautocorr : USEAUTOCORR EQUAL INT_NUMBER { driver.option_num("useautocorr", $3); } o_prior_mc : PRIOR_MC EQUAL INT_NUMBER { driver.option_num("prior_mc", $3); } +o_advanced : ADVANCED EQUAL signed_integer { driver.option_num("advanced", $3); } +o_max_dim_cova_group : MAX_DIM_COVA_GROUP EQUAL INT_NUMBER { driver.option_num("max_dim_cova_group", $3); } o_homotopy_mode : HOMOTOPY_MODE EQUAL INT_NUMBER {driver.option_num("homotopy_mode",$3); }; o_homotopy_steps : HOMOTOPY_STEPS EQUAL INT_NUMBER {driver.option_num("homotopy_steps",$3); }; diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll index 0f15b24b4..5861e64da 100644 --- a/preprocessor/DynareFlex.ll +++ b/preprocessor/DynareFlex.ll @@ -530,7 +530,8 @@ string eofbuff; /* For identification() statement */ prior_mc {return token::PRIOR_MC;} - +advanced {return token::ADVANCED;} +max_dim_cova_group {return token::MAX_DIM_COVA_GROUP;} [A-Za-z_][A-Za-z0-9_]* { yylval->string_val = new string(yytext);