New “with_epilogue” option of “shock_decomposition”, “realtime_shock_decomposition” and “initial_condition_decomposition”
Ref. dynare!1688issue#70
parent
ebafd8f3b6
commit
82c2682bb2
|
@ -2761,6 +2761,14 @@ ShockDecompositionStatement::ShockDecompositionStatement(SymbolList symbol_list_
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
ShockDecompositionStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
|
||||
{
|
||||
if (auto it = options_list.num_options.find("shock_decomp.with_epilogue");
|
||||
it != options_list.num_options.end() && it->second == "true")
|
||||
mod_file_struct.with_epilogue_option = true;
|
||||
}
|
||||
|
||||
void
|
||||
ShockDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
|
@ -2793,6 +2801,14 @@ RealtimeShockDecompositionStatement::RealtimeShockDecompositionStatement(SymbolL
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
RealtimeShockDecompositionStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
|
||||
{
|
||||
if (auto it = options_list.num_options.find("shock_decomp.with_epilogue");
|
||||
it != options_list.num_options.end() && it->second == "true")
|
||||
mod_file_struct.with_epilogue_option = true;
|
||||
}
|
||||
|
||||
void
|
||||
RealtimeShockDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
|
@ -2858,6 +2874,14 @@ InitialConditionDecompositionStatement::InitialConditionDecompositionStatement(S
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
InitialConditionDecompositionStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
|
||||
{
|
||||
if (auto it = options_list.num_options.find("initial_condition_decomp.with_epilogue");
|
||||
it != options_list.num_options.end() && it->second == "true")
|
||||
mod_file_struct.with_epilogue_option = true;
|
||||
}
|
||||
|
||||
void
|
||||
InitialConditionDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
|
|
|
@ -720,6 +720,7 @@ private:
|
|||
public:
|
||||
ShockDecompositionStatement(SymbolList symbol_list_arg,
|
||||
OptionsList options_list_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;
|
||||
};
|
||||
|
@ -732,6 +733,7 @@ private:
|
|||
public:
|
||||
RealtimeShockDecompositionStatement(SymbolList symbol_list_arg,
|
||||
OptionsList options_list_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;
|
||||
};
|
||||
|
@ -756,6 +758,7 @@ private:
|
|||
public:
|
||||
InitialConditionDecompositionStatement(SymbolList symbol_list_arg,
|
||||
OptionsList options_list_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;
|
||||
};
|
||||
|
|
|
@ -169,7 +169,7 @@ class ParsingDriver;
|
|||
%token NO_IDENTIFICATION_STRENGTH NO_IDENTIFICATION_REDUCEDFORM NO_IDENTIFICATION_MOMENTS
|
||||
%token NO_IDENTIFICATION_MINIMAL NO_IDENTIFICATION_SPECTRUM NORMALIZE_JACOBIANS GRID_NBR
|
||||
%token TOL_RANK TOL_DERIV TOL_SV CHECKS_VIA_SUBSETS MAX_DIM_SUBSETS_GROUPS
|
||||
%token MAX_NROWS SQUEEZE_SHOCK_DECOMPOSITION
|
||||
%token MAX_NROWS SQUEEZE_SHOCK_DECOMPOSITION WITH_EPILOGUE
|
||||
|
||||
%token <vector<string>> SYMBOL_VEC
|
||||
|
||||
|
@ -2830,6 +2830,7 @@ shock_decomposition_option : o_parameter_set
|
|||
| o_nobs
|
||||
| o_init_state
|
||||
| o_forecast_type
|
||||
| o_shock_decomposition_with_epilogue
|
||||
;
|
||||
|
||||
realtime_shock_decomposition_options_list : realtime_shock_decomposition_option COMMA realtime_shock_decomposition_options_list
|
||||
|
@ -2847,6 +2848,7 @@ realtime_shock_decomposition_option : o_parameter_set
|
|||
| o_shock_decomposition_forecast
|
||||
| o_save_realtime
|
||||
| o_fast_realtime
|
||||
| o_shock_decomposition_with_epilogue
|
||||
;
|
||||
|
||||
plot_shock_decomposition_options_list : plot_shock_decomposition_option COMMA plot_shock_decomposition_options_list
|
||||
|
@ -2892,6 +2894,7 @@ initial_condition_decomposition_option : o_icd_type
|
|||
| o_icd_flip
|
||||
| o_icd_colormap
|
||||
| o_icd_max_nrows
|
||||
| o_icd_with_epilogue
|
||||
;
|
||||
|
||||
homotopy_setup: HOMOTOPY_SETUP ';' homotopy_list END ';'
|
||||
|
@ -3308,6 +3311,8 @@ o_psd_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats
|
|||
| GRAPH_FORMAT EQUAL '(' list_allowed_graph_formats ')'
|
||||
{ driver.plot_shock_decomp_process_graph_format_option(); }
|
||||
;
|
||||
o_shock_decomposition_with_epilogue : WITH_EPILOGUE { driver.option_num("shock_decomp.with_epilogue", "true"); };
|
||||
o_icd_with_epilogue : WITH_EPILOGUE { driver.option_num("initial_condition_decomp.with_epilogue", "true"); };
|
||||
allowed_graph_formats : EPS
|
||||
{ driver.add_graph_format("eps"); }
|
||||
| FIG
|
||||
|
|
|
@ -704,6 +704,7 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4]|w([1-9]{1}|[1-4][0-9]|5[0-2]))
|
|||
<DYNARE_STATEMENT>checks_via_subsets {return token::CHECKS_VIA_SUBSETS;}
|
||||
<DYNARE_STATEMENT>max_dim_subsets_groups {return token::MAX_DIM_SUBSETS_GROUPS;}
|
||||
<DYNARE_STATEMENT>max_nrows {return token::MAX_NROWS;}
|
||||
<DYNARE_STATEMENT>with_epilogue {return token::WITH_EPILOGUE;}
|
||||
|
||||
<DYNARE_STATEMENT>\$[^$]*\$ {
|
||||
strtok(yytext+1, "$");
|
||||
|
|
|
@ -114,7 +114,7 @@ ModFile::checkPass(bool nostrict, bool stochastic)
|
|||
steady_state_model.checkPass(mod_file_struct, warnings);
|
||||
|
||||
// Check epilogue block
|
||||
epilogue.checkPass(warnings);
|
||||
epilogue.checkPass(mod_file_struct, warnings);
|
||||
|
||||
if (mod_file_struct.write_latex_steady_state_model_present &&
|
||||
!mod_file_struct.steady_state_model_present)
|
||||
|
|
|
@ -321,10 +321,17 @@ Epilogue::addDefinition(int symb_id, expr_t expr)
|
|||
}
|
||||
|
||||
void
|
||||
Epilogue::checkPass(WarningConsolidation &warnings) const
|
||||
Epilogue::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) const
|
||||
{
|
||||
if (dynamic_def_table.size() == 0)
|
||||
return;
|
||||
{
|
||||
if (mod_file_struct.with_epilogue_option)
|
||||
{
|
||||
cerr << "ERROR: the 'with_epilogue' option cannot be specified when there is no 'epilogue' block" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
vector<int> so_far_defined;
|
||||
for (const auto & it : dynamic_def_table)
|
||||
|
|
|
@ -86,8 +86,8 @@ public:
|
|||
//! Add an expression of the form "var = expr;"
|
||||
void addDefinition(int symb_id, expr_t expr);
|
||||
|
||||
//! Checks that no variable is declared twice
|
||||
void checkPass(WarningConsolidation &warnings) const;
|
||||
//! Checks that no variable is declared twice, and that “with_epilogue” is not misused
|
||||
void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) const;
|
||||
|
||||
//! Creates static epilogue equations
|
||||
void toStatic();
|
||||
|
|
|
@ -131,6 +131,9 @@ public:
|
|||
set<int> pac_params;
|
||||
//! Instruments if ramsey_model, ramsey_policy or discretionary_policy is present
|
||||
SymbolList instruments;
|
||||
/* Whether any of shock_decomposition, realtime_shock_decomposition and
|
||||
initial_condition_decomposition has the “with_epilogue” option */
|
||||
bool with_epilogue_option{false};
|
||||
};
|
||||
|
||||
class Statement
|
||||
|
|
Loading…
Reference in New Issue