From bb3475d548fb13b6830590fe4360b0aae8950876 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 30 Nov 2022 14:43:44 +0100
Subject: [PATCH] Remove call to setup_solvers.m

It is no longer used in the new implementation of solve_algo={12,14}.

However, the M_.lhs field that was created by setup_solvers.m is used from
other places, so reimplement it at the preprocessor level.
---
 src/DynamicModel.cc | 10 ++++++++++
 src/ModFile.cc      |  3 ---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index a6d8f2fe..1a2def69 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -1811,6 +1811,16 @@ DynamicModel::writeDriverOutput(ostream &output, const string &basename, bool es
   output << "];" << endl;
 
   writeDriverSparseIndicesHelper<true>(output);
+
+  // Write LHS of each equation in text form
+  output << "M_.lhs = {" << endl;
+  for (auto eq : equations)
+    {
+      output << "'";
+      eq->arg1->writeJsonOutput(output, {}, {});
+      output << "'; " << endl;
+    }
+  output << "};" << endl;
 }
 
 void
diff --git a/src/ModFile.cc b/src/ModFile.cc
index 84c3f7bf..a582b966 100644
--- a/src/ModFile.cc
+++ b/src/ModFile.cc
@@ -887,9 +887,6 @@ ModFile::writeMOutput(const string &basename, bool clear_all, bool clear_global,
 
   symbol_table.writeOutput(mOutputFile);
 
-  // Fill the fields related to solve_algo={12,14} if possible.
-  mOutputFile << "M_ = setup_solvers(M_);" << endl;
-
   var_model_table.writeOutput(basename, mOutputFile);
   trend_component_model_table.writeOutput(basename, mOutputFile);
   var_expectation_model_table.writeOutput(mOutputFile);
-- 
GitLab