From 44adcbb488cab87e791f3e5cdb58cc2608320322 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Thu, 12 Dec 2019 14:46:45 +0100 Subject: [PATCH] epilogue: replace `dseries__` with `ds` making the file easier to read --- src/ExprNode.cc | 8 ++++---- src/ModelEquationBlock.cc | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ExprNode.cc b/src/ExprNode.cc index 31690247..38c7cec6 100644 --- a/src/ExprNode.cc +++ b/src/ExprNode.cc @@ -1075,7 +1075,7 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type, output << LEFT_ARRAY_SUBSCRIPT(output_type) << lag << RIGHT_ARRAY_SUBSCRIPT(output_type); break; case ExprNodeOutputType::epilogueFile: - output << "dseries__." << datatree.symbol_table.getName(symb_id); + output << "ds." << datatree.symbol_table.getName(symb_id); output << LEFT_ARRAY_SUBSCRIPT(output_type) << "t"; if (lag != 0) output << lag; @@ -1135,7 +1135,7 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type, output << LEFT_ARRAY_SUBSCRIPT(output_type) << lag << RIGHT_ARRAY_SUBSCRIPT(output_type); break; case ExprNodeOutputType::epilogueFile: - output << "dseries__." << datatree.symbol_table.getName(symb_id); + output << "ds." << datatree.symbol_table.getName(symb_id); output << LEFT_ARRAY_SUBSCRIPT(output_type) << "t"; if (lag != 0) output << lag; @@ -1195,7 +1195,7 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type, output << LEFT_ARRAY_SUBSCRIPT(output_type) << lag << RIGHT_ARRAY_SUBSCRIPT(output_type); break; case ExprNodeOutputType::epilogueFile: - output << "dseries__." << datatree.symbol_table.getName(symb_id); + output << "ds." << datatree.symbol_table.getName(symb_id); output << LEFT_ARRAY_SUBSCRIPT(output_type) << "t"; if (lag != 0) output << lag; @@ -1209,7 +1209,7 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type, case SymbolType::epilogue: if (output_type == ExprNodeOutputType::epilogueFile) { - output << "dseries__." << datatree.symbol_table.getName(symb_id); + output << "ds." << datatree.symbol_table.getName(symb_id); output << LEFT_ARRAY_SUBSCRIPT(output_type) << "t"; if (lag != 0) output << lag; diff --git a/src/ModelEquationBlock.cc b/src/ModelEquationBlock.cc index 07cc7880..32867240 100644 --- a/src/ModelEquationBlock.cc +++ b/src/ModelEquationBlock.cc @@ -389,10 +389,10 @@ Epilogue::writeEpilogueFile(const string & basename, bool dynamic_file) const exit(EXIT_FAILURE); } - output << "function dseries__ = epilogue_" << (dynamic_file ? "dynamic" : "static") << "(params, dseries__)" << endl - << "% function dseries__ = epilogue_" << (dynamic_file ? "dynamic" : "static") << "(params, dseries__)" << endl + output << "function ds = epilogue_" << (dynamic_file ? "dynamic" : "static") << "(params, ds)" << endl + << "% function ds = epilogue_" << (dynamic_file ? "dynamic" : "static") << "(params, ds)" << endl << "% Epilogue file generated by Dynare preprocessor" << endl << endl - << "simul_end_date = lastdate(dseries__);" << endl; + << "simul_end_date = lastdate(ds);" << endl; int def_table_idx = 0; deriv_node_temp_terms_t tef_terms; @@ -406,7 +406,7 @@ Epilogue::writeEpilogueFile(const string & basename, bool dynamic_file) const expr->collectVariables(SymbolType::exogenous, used_symbols); expr->collectVariables(SymbolType::epilogue, used_symbols); - output << "simul_begin_date = firstobservedperiod(dseries__{"; + output << "simul_begin_date = firstobservedperiod(ds{"; for (auto it1 = used_symbols.begin(); it1 != used_symbols.end(); it1++) { if (it1 != used_symbols.begin()) @@ -417,11 +417,11 @@ Epilogue::writeEpilogueFile(const string & basename, bool dynamic_file) const output << "}) + " << max_lag << " + 1;" << endl; else output << "});" << endl; - output << "if ~dseries__.exist('" << symbol_table.getName(symb_id) << "')" << endl - << " dseries__ = [dseries__ dseries(NaN(dseries__.nobs,1), dseries__.firstdate, '" << symbol_table.getName(symb_id)<< "')];" << endl + output << "if ~ds.exist('" << symbol_table.getName(symb_id) << "')" << endl + << " ds = [ds dseries(NaN(ds.nobs,1), ds.firstdate, '" << symbol_table.getName(symb_id)<< "')];" << endl << "end" << endl << "from simul_begin_date to simul_end_date do " - << "dseries__." << symbol_table.getName(symb_id) << "(t) = "; + << "ds." << symbol_table.getName(symb_id) << "(t) = "; if (dynamic_file) expr->writeOutput(output, ExprNodeOutputType::epilogueFile, temporary_terms, temporary_terms_idxs, tef_terms); else -- GitLab