From fae00ea7292dd00ad5543c6adfa94715d58f75fc Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Tue, 19 Nov 2013 12:53:15 +0100
Subject: [PATCH] fix bug introduced by
 ee812f38816294450a307ccb8f2fb2a27fc032f0

---
 DynamicModel.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/DynamicModel.cc b/DynamicModel.cc
index bc90d42f..f776c88e 100644
--- a/DynamicModel.cc
+++ b/DynamicModel.cc
@@ -218,6 +218,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
   int nze, nze_exo, nze_exo_det, nze_other_endo;
   vector<int> feedback_variables;
   ExprNodeOutputType local_output_type;
+  Ufoss.str("");
 
   local_output_type = oMatlabDynamicModelSparse;
   if (global_temporary_terms)
@@ -538,7 +539,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
               output << "    % equation " << equation_ID+1 << " variable : " << sModel
                      << " (" << variable_ID+1 << ") " << c_Equation_Type(equ_type) << " symb_id=" << symbol_table.getID(eEndogenous, variable_ID) << endl;
               Ufoss << "    b(" << i+1-block_recursive << "+Per_J_) = -residual(" << i+1-block_recursive << ", it_)";
-              Uf[equation_ID] = Ufoss.str();
+              Uf[equation_ID] += Ufoss.str();
               Ufoss.str("");
               output << "    residual(" << i+1-block_recursive << ", it_) = (";
               goto end;
@@ -726,7 +727,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
                     Ufoss << "+g1(" << eq+1-block_recursive
                           << "+Per_J_, " << var+1-block_recursive
                           << "+y_size*(it_" << lag-1 << "))*y(it_" << lag << ", " << varr+1 << ")";
-                  Uf[eqr] = Ufoss.str();
+                  Uf[eqr] += Ufoss.str();
                   Ufoss.str("");
 
                   if (lag == 0)
-- 
GitLab