From d441ff059a57d3020b055a31ab45ac72668f782b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Thu, 19 Dec 2019 16:58:26 +0100 Subject: [PATCH] =?UTF-8?q?Fill=20the=20=E2=80=9CM=5F.aux=5Fvars(:).orig?= =?UTF-8?q?=5Fexpr=E2=80=9D=20field=20for=20all=20auxiliary=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This field contains a string representation of the expression that the auxiliary variable replaces. It is non-empty for all auxiliary variables, except for Lagrange multipliers. Ref. dynare#773 --- src/SymbolTable.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/SymbolTable.cc b/src/SymbolTable.cc index dfcf7d9a..fbb2f157 100644 --- a/src/SymbolTable.cc +++ b/src/SymbolTable.cc @@ -378,11 +378,6 @@ SymbolTable::writeOutput(ostream &output) const noexcept(false) output << "M_.aux_vars(" << i+1 << ").orig_index = " << getTypeSpecificID(aux_vars[i].get_orig_symb_id())+1 << ";" << endl; break; case AuxVarType::expectation: - output << "M_.aux_vars(" << i+1 << R"().orig_expr = '\mathbb{E}_{t)" - << (aux_vars[i].get_information_set() < 0 ? "" : "+") - << aux_vars[i].get_information_set() << "}("; - aux_vars[i].get_expr_node()->writeOutput(output, ExprNodeOutputType::latexDynamicModel); - output << ")';" << endl; break; case AuxVarType::diff: case AuxVarType::diffLag: @@ -392,6 +387,14 @@ SymbolTable::writeOutput(ostream &output) const noexcept(false) << "M_.aux_vars(" << i+1 << ").orig_lead_lag = " << aux_vars[i].get_orig_lead_lag() << ";" << endl; break; } + + if (expr_t orig_expr = aux_vars[i].get_expr_node(); + orig_expr) + { + output << "M_.aux_vars(" << i+1 << ").orig_expr = '"; + orig_expr->writeJsonOutput(output, {}, {}); + output << "';" << endl; + } } if (predeterminedNbr() > 0) -- GitLab