From 107727c9b534f8049aae3b62465957253a63afd9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Thu, 16 Mar 2023 16:02:10 +0100
Subject: [PATCH] model_diagnostics: remove workaround for Octave

The rank() and null() functions accept a tolerance argument since at least
Octave 3.8.
---
 matlab/model_diagnostics.m | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/matlab/model_diagnostics.m b/matlab/model_diagnostics.m
index b8ded6404f..752d1416a8 100644
--- a/matlab/model_diagnostics.m
+++ b/matlab/model_diagnostics.m
@@ -183,7 +183,7 @@ for b=1:nb
         display_problematic_vars_Jacobian(imagrow,imagcol,M,dr.ys,'static','MODEL_DIAGNOSTICS: ')
     end
     try
-        if isoctave || matlab_ver_less_than('9.12') || isempty(options.jacobian_tolerance)
+        if (~isoctave && matlab_ver_less_than('9.12')) || isempty(options.jacobian_tolerance)
             rank_jacob = rank(jacob); %can sometimes fail
         else
             rank_jacob = rank(jacob,options.jacobian_tolerance); %can sometimes fail
@@ -198,7 +198,7 @@ for b=1:nb
               'singular'])
         disp(['MODEL_DIAGNOSTICS:  there is ' num2str(n_vars_jacob-rank_jacob) ...
               ' collinear relationships between the variables and the equations'])
-        if isoctave || matlab_ver_less_than('9.12') || isempty(options.jacobian_tolerance)
+        if (~isoctave && matlab_ver_less_than('9.12')) || isempty(options.jacobian_tolerance)
             ncol = null(jacob);
         else
             ncol = null(jacob,options.jacobian_tolerance); %can sometimes fail
@@ -221,7 +221,7 @@ for b=1:nb
                 fprintf('%s\n',endo_names{k})
             end
         end
-        if isoctave || matlab_ver_less_than('9.12') || isempty(options.jacobian_tolerance)
+        if (~isoctave && matlab_ver_less_than('9.12')) || isempty(options.jacobian_tolerance)
             neq = null(jacob'); %can sometimes fail
         else
             neq = null(jacob',options.jacobian_tolerance); %can sometimes fail
-- 
GitLab