From 7468b4d8d7457cb11beae557d2fd8a9f2ce3e246 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Mon, 25 Jan 2021 18:13:35 +0100
Subject: [PATCH] Remove more stuff related to unfinished decomposition in
 linear and nonlinear blocks

Ref. #39, dynare!1626
---
 src/ModelTree.cc | 30 ------------------------------
 src/ModelTree.hh |  5 -----
 2 files changed, 35 deletions(-)

diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index 58def010..487d871c 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -144,7 +144,6 @@ ModelTree::ModelTree(const ModelTree &m) :
   blocks{m.blocks},
   endo2block{m.endo2block},
   eq2block{m.eq2block},
-  is_equation_linear{m.is_equation_linear},
   endo2eq{m.endo2eq},
   cutoff{m.cutoff},
   mfs{m.mfs}
@@ -186,7 +185,6 @@ ModelTree::operator=(const ModelTree &m)
   eq2block = m.eq2block;
   blocks_temporary_terms.clear();
   blocks_temporary_terms_idxs.clear();
-  is_equation_linear = m.is_equation_linear;
   endo2eq = m.endo2eq;
   cutoff = m.cutoff;
   mfs = m.mfs;
@@ -351,34 +349,6 @@ ModelTree::evaluateAndReduceJacobian(const eval_context_t &eval_context) const
   return contemporaneous_jacobian;
 }
 
-bool
-ModelTree::computeNaturalNormalization()
-{
-  bool bool_result = true;
-  set<pair<int, int>> result;
-  endo2eq.resize(equations.size());
-  for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
-    if (!is_equation_linear[eq])
-      {
-        BinaryOpNode *eq_node = equations[eq];
-        expr_t lhs = eq_node->arg1;
-        result.clear();
-        lhs->collectDynamicVariables(SymbolType::endogenous, result);
-        if (result.size() == 1 && result.begin()->second == 0)
-          {
-            //check if the endogenous variable has not been already used in an other match !
-            if (find(endo2eq.begin(), endo2eq.end(), result.begin()->first) == endo2eq.end())
-              endo2eq[result.begin()->first] = eq;
-            else
-              {
-                bool_result = false;
-                break;
-              }
-          }
-      }
-  return bool_result;
-}
-
 pair<int, int>
 ModelTree::computePrologueAndEpilogue()
 {
diff --git a/src/ModelTree.hh b/src/ModelTree.hh
index c65a8c3c..e075e612 100644
--- a/src/ModelTree.hh
+++ b/src/ModelTree.hh
@@ -210,9 +210,6 @@ protected:
      the vector of all temporary terms */
   temporary_terms_idxs_t blocks_temporary_terms_idxs;
 
-  //! Vector indicating if the equation is linear in endogenous variable (true) or not (false)
-  vector<bool> is_equation_linear;
-
   //! Computes derivatives
   /*! \param order the derivation order
       \param vars the derivation IDs w.r.t. which compute the derivatives */
@@ -296,8 +293,6 @@ protected:
     The resulting normalization is stored in endo2eq.
   */
   void computeNonSingularNormalization(const jacob_map_t &contemporaneous_jacobian);
-  //! Try to find a natural normalization if all equations are matched to an endogenous variable on the LHS
-  bool computeNaturalNormalization();
   //! Evaluate the jacobian (w.r.t. endogenous) and suppress all the elements below the cutoff
   /*! Returns the contemporaneous_jacobian.
       Elements below the cutoff are discarded. External functions are evaluated to 1. */
-- 
GitLab