From db89e50e2ac4d764d51c94e1deaca3c593e6b7db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Mon, 16 Jun 2025 10:56:59 +0200
Subject: [PATCH] Bump minimal required version of MATLAB to R2020a

Ref. dynare#1961
---
 src/ModelTree.hh | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/ModelTree.hh b/src/ModelTree.hh
index 8d22cbb2..05283657 100644
--- a/src/ModelTree.hh
+++ b/src/ModelTree.hh
@@ -2578,12 +2578,7 @@ ModelTree::writeSparseModelMFiles(const string& basename,
          << ", T_order, T);" << endl
          << "g1_v = NaN(" << jacobian_sparse_column_major_order.size() << ", 1);" << endl
          << d_sparse_output[1].str();
-  // On MATLAB < R2020a, sparse() does not accept int32 indices
-  output << "if ~isoctave && matlab_ver_less_than('9.8')" << endl
-         << "    sparse_rowval = double(sparse_rowval);" << endl
-         << "    sparse_colval = double(sparse_colval);" << endl
-         << "end" << endl
-         << "g1 = sparse(sparse_rowval, sparse_colval, g1_v, " << equations.size() << ", "
+  output << "g1 = sparse(sparse_rowval, sparse_colval, g1_v, " << equations.size() << ", "
          << getJacobianColsNbr(true) << ");" << endl
          << "end" << endl;
   output.close();
@@ -2655,12 +2650,7 @@ ModelTree::writeSparseModelMFiles(const string& basename,
                      << "    g1_v = NaN(" << blocks_jacobian_sparse_column_major_order[blk].size()
                      << ", 1);" << endl;
               writeSparsePerBlockJacobianHelper<output_type>(blk, output, temporary_terms_written);
-              // On MATLAB < R2020a, sparse() does not accept int32 indices
-              output << "    if ~isoctave && matlab_ver_less_than('9.8')" << endl
-                     << "        sparse_rowval = double(sparse_rowval);" << endl
-                     << "        sparse_colval = double(sparse_colval);" << endl
-                     << "    end" << endl
-                     << "    g1 = sparse(sparse_rowval, sparse_colval, g1_v, "
+              output << "    g1 = sparse(sparse_rowval, sparse_colval, g1_v, "
                      << blocks[blk].mfs_size << ", "
                      << (one_boundary ? 1 : 3) * blocks[blk].mfs_size << ");" << endl
                      << "end" << endl;
-- 
GitLab