preprocessor: add relative_irf option to irf_calibration block. closes #720

issue#70
Houtan Bastani 2015-09-07 11:39:33 +02:00
parent 998db5c144
commit 6c4f7c0898
5 changed files with 13 additions and 5 deletions

View File

@ -2524,6 +2524,8 @@ moment_calibration_item : symbol COMMA symbol COMMA calibration_range ';'
irf_calibration : IRF_CALIBRATION ';' irf_calibration_list END ';'
{ driver.end_irf_calibration(); }
| IRF_CALIBRATION '(' o_relative_irf ')' ';' irf_calibration_list END ';'
{ driver.end_irf_calibration(); }
;
irf_calibration_list : irf_calibration_item

View File

@ -303,7 +303,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
<DYNARE_STATEMENT>posterior_max_subsample_draws {return token::POSTERIOR_MAX_SUBSAMPLE_DRAWS;}
<DYNARE_STATEMENT>filtered_vars {return token::FILTERED_VARS;}
<DYNARE_STATEMENT>filter_step_ahead {return token::FILTER_STEP_AHEAD;}
<DYNARE_STATEMENT>relative_irf {return token::RELATIVE_IRF;}
<DYNARE_STATEMENT,DYNARE_BLOCK>relative_irf {return token::RELATIVE_IRF;}
<DYNARE_STATEMENT>tex {return token::TEX;}
<DYNARE_STATEMENT>nomoments {return token::NOMOMENTS;}
<DYNARE_STATEMENT>std {return token::STD;}

View File

@ -2763,7 +2763,8 @@ ParsingDriver::add_irf_calibration_item(string *endo, string *periods, string *e
void ParsingDriver::end_irf_calibration()
{
mod_file->addStatement(new IrfCalibration(irf_calibration_constraints,
mod_file->symbol_table));
mod_file->symbol_table,
options_list));
irf_calibration_constraints.clear();
}

View File

@ -436,14 +436,17 @@ MomentCalibration::writeOutput(ostream &output, const string &basename, bool min
}
IrfCalibration::IrfCalibration(const constraints_t &constraints_arg,
const SymbolTable &symbol_table_arg)
: constraints(constraints_arg), symbol_table(symbol_table_arg)
const SymbolTable &symbol_table_arg,
const OptionsList &options_list_arg)
: constraints(constraints_arg), symbol_table(symbol_table_arg), options_list(options_list_arg)
{
}
void
IrfCalibration::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{
options_list.writeOutput(output);
output << "options_.endogenous_prior_restrictions.irf = {" << endl;
for (size_t i = 0; i < constraints.size(); i++)
{

View File

@ -133,9 +133,11 @@ public:
private:
constraints_t constraints;
const SymbolTable &symbol_table;
const OptionsList options_list;
public:
IrfCalibration(const constraints_t &constraints_arg,
const SymbolTable &symbol_table_arg);
const SymbolTable &symbol_table_arg,
const OptionsList &options_list_arg);
virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
};