From 389a2647d3b1067d3af54596ad3bd076fab8a4b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 25 Jan 2023 18:37:37 +0100
Subject: [PATCH] Block decomposition: make mfs=1 the default
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

NB: mfs=3 is nevertheless used when “block” option has not been used, and the
model is purely backward/forward or static, for solve_algo={12,14}.
---
 src/DynamicModel.cc | 5 ++++-
 src/ModelTree.hh    | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 459810de..e6cfa82d 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -2137,10 +2137,13 @@ DynamicModel::computingPass(int derivsOrder, int paramsDerivsOrder, const eval_c
   if (paramsDerivsOrder > 0 && !no_tmp_terms)
     computeParamsDerivativesTemporaryTerms();
 
+  /* Change block decomposition settings when the “block” keyword has not been
+     used and the model is purely backward/forward or static. This is meant to
+     be used with solve_algo={12,14}. */
   if (!block && (max_endo_lag == 0 || max_endo_lead == 0))
     {
       time_recursive_block_decomposition = true;
-      mfs = 3; // FIXME: remove this line when mfs=3 becomes the global default
+      mfs = 3; // Typically useful for equations of the form log(x)=RHS
     }
   computingPassBlock(eval_context, no_tmp_terms);
   if (block_decomposed)
diff --git a/src/ModelTree.hh b/src/ModelTree.hh
index f7f3394b..551ab744 100644
--- a/src/ModelTree.hh
+++ b/src/ModelTree.hh
@@ -599,7 +599,7 @@ public:
   //! Absolute value under which a number is considered to be zero
   double cutoff{1e-15};
   // Setting for minimum feedback set computation (see the reference manual)
-  int mfs{0};
+  int mfs{1};
   //! Declare a node as an equation of the model; also give its line number
   void addEquation(expr_t eq, optional<int> lineno);
   //! Declare a node as an equation of the model, also giving its tags
-- 
GitLab