From a153f811566faeab4e6c0f660341fa7658fb74f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien.villemot@ens.fr>
Date: Tue, 22 Feb 2011 14:46:24 +0100
Subject: [PATCH] Partial information: - fix various bugs - do not fallback on
 full information in case of error, this is confusing

---
 matlab/partial_information/PI_gensys.m | 6 ++++--
 matlab/partial_information/dr1_PI.m    | 7 +++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/matlab/partial_information/PI_gensys.m b/matlab/partial_information/PI_gensys.m
index b1144cf0e7..c392cc6596 100644
--- a/matlab/partial_information/PI_gensys.m
+++ b/matlab/partial_information/PI_gensys.m
@@ -90,7 +90,7 @@ try
     end
     warning('on','MATLAB:singularMatrix');
     warning('on','MATLAB:nearlySingularMatrix');
-    if (isinf(UAVinv) || isnan(UAVinv)) 
+    if (any(any(isinf(UAVinv))) || any(any(isnan(UAVinv))))
         if(options_.useACES==1)
             disp('ERROR! saving PI_gensys_data_dump');
             save PI_gensys_data_dump
@@ -102,7 +102,9 @@ try
         end
     end
 catch
-    [errmsg, errcode]=lasterror;
+    lerror = lasterror;
+    errmsg = lerror.message;
+    disp(errmsg)
     warning(['error callig PI_gensys_singularC: ' errmsg ],'errcode');
     error('errcode',['error callig PI_gensys_singularC: ' errmsg ]);
 end
diff --git a/matlab/partial_information/dr1_PI.m b/matlab/partial_information/dr1_PI.m
index afc9b0605c..b90112dce1 100644
--- a/matlab/partial_information/dr1_PI.m
+++ b/matlab/partial_information/dr1_PI.m
@@ -353,7 +353,7 @@ end % end if useAIM and...
         end
 
         % reuse some of the bypassed code and tests that may be needed 
-        if eu ~=[1; 1] && options_.ACES_solver==0
+        if (eu(1) ~= 1 || eu(2) ~= 1) && options_.ACES_solver==0
             info(1) = abs(eu(1)+eu(2));
             info(2) = 1.0e+8;
             %     return
@@ -448,9 +448,8 @@ end % end if useAIM and...
             disp('Problem with using Part Info ACES solver:');
             error(lerror.message);
         else
-            disp('Problem with using Part Info solver - Using Dynare solver instead');
-            disp (lerror.message);
-            options_.partial_information = 0; % and then try mjdgges instead
+            disp('Problem with using Part Info solver');
+            error(lerror.message);
         end
     end
 
-- 
GitLab