From 30853e7360ce3922c71df976443a3c9c68b89e78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 25 Oct 2022 16:38:53 +0200
Subject: [PATCH] Block decomposition: improve debugging information for
 normalization
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

– print the information only for the final matching (and not the intermediary
  ones that may have failed);
– print the equation name next to its number.
---
 src/ModelTree.cc | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index 4c13693d..99163df0 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -238,12 +238,6 @@ ModelTree::computeNormalization(const jacob_map_t &contemporaneous_jacobian, boo
 
   assert(check);
 
-#ifdef DEBUG
-  for (int i = 0; i < n; i++)
-    cout << "Endogenous " << symbol_table.getName(symbol_table.getID(eEndogenous, i))
-         << " matched with equation " << (mate_map[i]-n+1) << endl;
-#endif
-
   // Create the resulting map, by copying the n first elements of mate_map, and substracting n to them
   endo2eq.resize(equations.size());
   transform(mate_map.begin(), mate_map.begin() + n, endo2eq.begin(), [=](int i) { return i-n; });
@@ -325,6 +319,12 @@ ModelTree::computeNonSingularNormalization(const jacob_map_t &contemporaneous_ja
       found_normalization = computeNormalization(symbolic_jacobian, true);
     }
 
+#ifdef DEBUG
+  for (size_t i {0}; i < equations.size(); i++)
+    cout << "Variable " << symbol_table.getName(symbol_table.getID(SymbolType::endogenous, i))
+         << " associated to equation " << endo2eq[i] << " (" << equation_tags.getTagValueByEqnAndKey(endo2eq[i], "name") << ")" << endl;
+#endif
+
   /* NB: If normalization failed, an explanatory message has been printed by the last call
      to computeNormalization(), which has verbose=true */
   return found_normalization;
-- 
GitLab