From 21f8b832ae0d61206ee044625186407f369e3468 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Thu, 11 Oct 2018 15:54:11 +0200 Subject: [PATCH] =?UTF-8?q?do=20not=20substitute=20unary=20ops=20in=20equa?= =?UTF-8?q?tions=20that=20don=E2=80=99t=20need=20it=20(non=20var=5Fmodel?= =?UTF-8?q?=20and=20non=20trend=5Fcomponent=5Fmodel)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DynamicModel.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc index d6989d37..06dc7a5b 100644 --- a/src/DynamicModel.cc +++ b/src/DynamicModel.cc @@ -5874,13 +5874,13 @@ DynamicModel::substituteUnaryOps(StaticModel &static_model, vector<int> &eqnumbe for (auto & it : local_variables_table) it.second = it.second->substituteUnaryOpNodes(static_model, nodes, subst_table, neweqs); - // Substitute in equations - for (auto & equation : equations) + // Substitute only in equations requested + for (int eqnumber : eqnumbers) { - auto *substeq = dynamic_cast<BinaryOpNode *>(equation-> + auto *substeq = dynamic_cast<BinaryOpNode *>(equations[eqnumber]-> substituteUnaryOpNodes(static_model, nodes, subst_table, neweqs)); assert(substeq != nullptr); - equation = substeq; + equations[eqnumber] = substeq; } // Add new equations -- GitLab