epilogue: replace `dseries__` with `ds` making the file easier to read

issue#70
Houtan Bastani 2019-12-12 14:46:45 +01:00
parent dfcd381d20
commit 44adcbb488
No known key found for this signature in database
GPG Key ID: 000094FB955BE169
2 changed files with 11 additions and 11 deletions

View File

@ -1075,7 +1075,7 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
output << LEFT_ARRAY_SUBSCRIPT(output_type) << lag << RIGHT_ARRAY_SUBSCRIPT(output_type); output << LEFT_ARRAY_SUBSCRIPT(output_type) << lag << RIGHT_ARRAY_SUBSCRIPT(output_type);
break; break;
case ExprNodeOutputType::epilogueFile: 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"; output << LEFT_ARRAY_SUBSCRIPT(output_type) << "t";
if (lag != 0) if (lag != 0)
output << lag; 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); output << LEFT_ARRAY_SUBSCRIPT(output_type) << lag << RIGHT_ARRAY_SUBSCRIPT(output_type);
break; break;
case ExprNodeOutputType::epilogueFile: 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"; output << LEFT_ARRAY_SUBSCRIPT(output_type) << "t";
if (lag != 0) if (lag != 0)
output << lag; 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); output << LEFT_ARRAY_SUBSCRIPT(output_type) << lag << RIGHT_ARRAY_SUBSCRIPT(output_type);
break; break;
case ExprNodeOutputType::epilogueFile: 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"; output << LEFT_ARRAY_SUBSCRIPT(output_type) << "t";
if (lag != 0) if (lag != 0)
output << lag; output << lag;
@ -1209,7 +1209,7 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
case SymbolType::epilogue: case SymbolType::epilogue:
if (output_type == ExprNodeOutputType::epilogueFile) 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"; output << LEFT_ARRAY_SUBSCRIPT(output_type) << "t";
if (lag != 0) if (lag != 0)
output << lag; output << lag;

View File

@ -389,10 +389,10 @@ Epilogue::writeEpilogueFile(const string & basename, bool dynamic_file) const
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
output << "function dseries__ = epilogue_" << (dynamic_file ? "dynamic" : "static") << "(params, dseries__)" << endl output << "function ds = epilogue_" << (dynamic_file ? "dynamic" : "static") << "(params, ds)" << endl
<< "% function dseries__ = epilogue_" << (dynamic_file ? "dynamic" : "static") << "(params, dseries__)" << endl << "% function ds = epilogue_" << (dynamic_file ? "dynamic" : "static") << "(params, ds)" << endl
<< "% Epilogue file generated by Dynare preprocessor" << endl << 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; int def_table_idx = 0;
deriv_node_temp_terms_t tef_terms; 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::exogenous, used_symbols);
expr->collectVariables(SymbolType::epilogue, 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++) for (auto it1 = used_symbols.begin(); it1 != used_symbols.end(); it1++)
{ {
if (it1 != used_symbols.begin()) if (it1 != used_symbols.begin())
@ -417,11 +417,11 @@ Epilogue::writeEpilogueFile(const string & basename, bool dynamic_file) const
output << "}) + " << max_lag << " + 1;" << endl; output << "}) + " << max_lag << " + 1;" << endl;
else else
output << "});" << endl; output << "});" << endl;
output << "if ~dseries__.exist('" << symbol_table.getName(symb_id) << "')" << endl output << "if ~ds.exist('" << symbol_table.getName(symb_id) << "')" << endl
<< " dseries__ = [dseries__ dseries(NaN(dseries__.nobs,1), dseries__.firstdate, '" << symbol_table.getName(symb_id)<< "')];" << endl << " ds = [ds dseries(NaN(ds.nobs,1), ds.firstdate, '" << symbol_table.getName(symb_id)<< "')];" << endl
<< "end" << endl << "end" << endl
<< "from simul_begin_date to simul_end_date do " << "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) if (dynamic_file)
expr->writeOutput(output, ExprNodeOutputType::epilogueFile, temporary_terms, temporary_terms_idxs, tef_terms); expr->writeOutput(output, ExprNodeOutputType::epilogueFile, temporary_terms, temporary_terms_idxs, tef_terms);
else else