From 72325e2392745945c5e19310c05172a387095bea Mon Sep 17 00:00:00 2001
From: Michel Juillard <michel.juillard@mjui.fr>
Date: Thu, 1 Sep 2011 11:37:40 +0200
Subject: [PATCH] added error for near 0/0 on diagonal of Real Generalized
 Schur decomposition (info=7) and corrected error in test for singular w1
 submatrix, introduced in Sept. 2010. (cherry picked from commit
 3c0ebb4cc544cd11f467f6b4985011c116d81b0e)

---
 matlab/dr1.m        | 7 ++++++-
 matlab/print_info.m | 8 ++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/matlab/dr1.m b/matlab/dr1.m
index ddeecda09..f92d6fb72 100644
--- a/matlab/dr1.m
+++ b/matlab/dr1.m
@@ -368,6 +368,11 @@ else  % use original Dynare solver
         if ~exist('OCTAVE_VERSION')
             dr.eigval = eig(e,d);
         end
+        for i=1:nd
+            if abs(ss(i,i)) < 1e-6 && abs(tt(i,i)) < 1e-6
+                info(7) = 1;
+            end
+        end
         return
     end
 
@@ -402,7 +407,7 @@ else  % use original Dynare solver
     % derivatives with respect to dynamic state variables
     % forward variables
     w1 =w(1:n3,n2:nd);
-    if ~isfloat(w1) && (condest(w1) > 1e9)
+    if ~isscalar(w1) && (condest(w1) > 1e9)
         % condest() fails on a scalar under Octave
         info(1) = 5;
         info(2) = condest(w1);
diff --git a/matlab/print_info.m b/matlab/print_info.m
index 7c1a3bd16..a509aff50 100644
--- a/matlab/print_info.m
+++ b/matlab/print_info.m
@@ -45,7 +45,11 @@ if ~noprint
         error(['Blanchard Kahn conditions are not satisfied:' ...
                ' indeterminacy due to rank failure'])
       case 6
-        error('The jacobian matrix evaluated at the steady state is complex')
+        error(['The Jacobian matrix evaluated at the steady state contains elements ' ...
+               'that are not real or are infinite'])
+      case 7
+        error(['One of the eigenvalue is is close to 0/0 (the absolute ' ...
+               'value of numerator and denominator is smaller than 1e-6).'])
       case 19
         error('The steadystate file did not compute the steady state (inconsistent deep parameters).')
       case 20
@@ -89,4 +93,4 @@ if ~noprint
       otherwise
         error('This case shouldn''t happen. Contact the authors of Dynare')
     end
-end
\ No newline at end of file
+end
-- 
GitLab