Move BVAR to +bvar folder

master
Johannes Pfeifer 2023-09-08 15:35:43 +02:00 committed by Sébastien Villemot
parent 978789d02a
commit 27a3a559e4
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
6 changed files with 55 additions and 3 deletions

View File

@ -2461,7 +2461,7 @@ BVARDensityStatement::writeOutput(ostream &output, [[maybe_unused]] const string
[[maybe_unused]] bool minimal_workspace) const
{
options_list.writeOutput(output);
output << "bvar_density(" << maxnlags << ");" << endl;
output << "bvar.density(" << maxnlags << ");" << endl;
}
void
@ -2494,7 +2494,7 @@ BVARForecastStatement::writeOutput(ostream &output, [[maybe_unused]] const strin
[[maybe_unused]] bool minimal_workspace) const
{
options_list.writeOutput(output);
output << "bvar_forecast(" << nlags << ");" << endl;
output << "bvar.forecast(" << nlags << ");" << endl;
}
void
@ -2509,6 +2509,33 @@ BVARForecastStatement::writeJsonOutput(ostream &output) const
output << "}";
}
BVARIRFStatement::BVARIRFStatement(int nirf_arg, string identificationname_arg) :
nirf{nirf_arg},
identificationname{move(identificationname_arg)}
{
}
void
BVARIRFStatement::checkPass(ModFileStructure &mod_file_struct,
[[maybe_unused]] WarningConsolidation &warnings)
{
mod_file_struct.bvar_present = true;
}
void
BVARIRFStatement::writeOutput(ostream &output, [[maybe_unused]] const string &basename,
[[maybe_unused]] bool minimal_workspace) const
{
output << "bvar.irf(" << nirf << ",'" << identificationname << "');" << endl;
}
void
BVARIRFStatement::writeJsonOutput(ostream &output) const
{
output << R"({"statementName": "bvar_irf")";
output << "}";
}
SBVARStatement::SBVARStatement(OptionsList options_list_arg) :
options_list{move(options_list_arg)}
{

View File

@ -609,6 +609,18 @@ public:
void writeJsonOutput(ostream &output) const override;
};
class BVARIRFStatement : public Statement
{
private:
const int nirf;
const string identificationname;
public:
BVARIRFStatement(int nirf_arg, string identificationname_arg);
void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) override;
void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
void writeJsonOutput(ostream &output) const override;
};
class SBVARStatement : public Statement
{
private:

View File

@ -75,7 +75,7 @@ class ParsingDriver;
%token AIM_SOLVER ANALYTIC_DERIVATION ANALYTIC_DERIVATION_MODE AR POSTERIOR_SAMPLING_METHOD
%token BALANCED_GROWTH_TEST_TOL BAYESIAN_IRF BETA_PDF BLOCK USE_CALIBRATION SILENT_OPTIMIZER
%token BVAR_DENSITY BVAR_FORECAST NODECOMPOSITION DR_DISPLAY_TOL HUGE_NUMBER FIG_NAME WRITE_XLS
%token BVAR_DENSITY BVAR_FORECAST BVAR_IRF NODECOMPOSITION DR_DISPLAY_TOL HUGE_NUMBER FIG_NAME WRITE_XLS
%token BVAR_PRIOR_DECAY BVAR_PRIOR_FLAT BVAR_PRIOR_LAMBDA INTERACTIVE SCREEN_SHOCKS STEADYSTATE
%token BVAR_PRIOR_MU BVAR_PRIOR_OMEGA BVAR_PRIOR_TAU BVAR_PRIOR_TRAIN DETAIL_PLOT TYPE
%token BVAR_REPLIC BYTECODE ALL_VALUES_REQUIRED PROPOSAL_DISTRIBUTION REALTIME VINTAGE
@ -298,6 +298,7 @@ statement : parameters
| discretionary_policy
| bvar_density
| bvar_forecast
| bvar_irf
| sbvar
| dynare_sensitivity
| homotopy_setup
@ -2769,6 +2770,9 @@ bvar_forecast : BVAR_FORECAST INT_NUMBER ';'
{ driver.bvar_forecast($5); }
;
bvar_irf : BVAR_IRF '(' INT_NUMBER COMMA QUOTED_STRING ')' ';'
{ driver.bvar_irf($3, $5); }
sbvar_option : o_datafile
| o_freq
| o_initial_year

View File

@ -151,6 +151,7 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4])
<INITIAL>bvar_density {BEGIN DYNARE_STATEMENT; return token::BVAR_DENSITY; }
<INITIAL>bvar_forecast {BEGIN DYNARE_STATEMENT; return token::BVAR_FORECAST; }
<INITIAL>bvar_irf {BEGIN DYNARE_STATEMENT; return token::BVAR_IRF; }
<INITIAL>dynare_sensitivity {BEGIN DYNARE_STATEMENT; return token::DYNARE_SENSITIVITY;}
<INITIAL>initval_file {BEGIN DYNARE_STATEMENT; return token::INITVAL_FILE;}
<INITIAL>histval_file {BEGIN DYNARE_STATEMENT; return token::HISTVAL_FILE;}

View File

@ -2334,6 +2334,12 @@ ParsingDriver::bvar_forecast(const string &nlags)
options_list.clear();
}
void
ParsingDriver::bvar_irf(const string &nirf, string identificationname)
{
mod_file->addStatement(make_unique<BVARIRFStatement>(stoi(nirf), move(identificationname)));
}
void
ParsingDriver::sbvar()
{

View File

@ -678,6 +678,8 @@ public:
void bvar_density(const string &maxnlags);
//! BVAR forecast
void bvar_forecast(const string &nlags);
//! BVAR IRF
void bvar_irf(const string &nirf, string identificationname);
//! SBVAR statement
void sbvar();
//! Markov Switching Statement: Estimation