From fb3b1c301f0d24416d42ca322ec49acd8dda3ab7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 6 May 2022 12:56:24 +0200
Subject: [PATCH] =?UTF-8?q?endval(learnt=5Fin=3D=E2=80=A6)=20block:=20fix?=
 =?UTF-8?q?=20treatment=20of=20unused=20endogenous=20variables?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/NumericalInitialization.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/NumericalInitialization.cc b/src/NumericalInitialization.cc
index c7c97416..466daaf3 100644
--- a/src/NumericalInitialization.cc
+++ b/src/NumericalInitialization.cc
@@ -333,6 +333,8 @@ EndValLearntInStatement::writeOutput(ostream &output, const string &basename, bo
   output << "M_.learnt_endval = [ M_.learnt_endval;" << endl;
   for (auto [type, symb_id, value] : learnt_end_values)
     {
+      if (symbol_table.getType(symb_id) == SymbolType::unusedEndogenous) // See #82
+        continue;
       output << "struct('learnt_in'," << learnt_in_period
              << ",'exo_id'," << symbol_table.getTypeSpecificID(symb_id)+1
              << ",'type','" << typeToString(type) << "'"
@@ -352,6 +354,8 @@ EndValLearntInStatement::writeJsonOutput(ostream &output) const
        it != learnt_end_values.end(); ++it)
     {
       auto [type, symb_id, value] = *it;
+      if (symbol_table.getType(symb_id) == SymbolType::unusedEndogenous) // See #82
+        continue;
       if (it != learnt_end_values.begin())
         output << ", ";
       output << R"({"name": ")" << symbol_table.getName(symb_id) << R"(", )"
-- 
GitLab