From dabdda050694b194cdcd1b85d3d1a45ebbeb05cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=28Charybdis=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Tue, 19 Apr 2016 11:34:49 +0200
Subject: [PATCH] Fixed wrong definition of a logical variable.

The second outputr returned by perfect_foresight_solver_core is the
max. abs. residual, not a dummy variable indicating success or failure
of the perfect foresight solver.
---
 matlab/ep/extended_path_core.m | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/matlab/ep/extended_path_core.m b/matlab/ep/extended_path_core.m
index dacaeb9932..a1ffc76bb5 100644
--- a/matlab/ep/extended_path_core.m
+++ b/matlab/ep/extended_path_core.m
@@ -49,7 +49,12 @@ if flag
         options.lmmcp = olmmcp;
         options.solve_algo = solve_algo;
         options.stack_solve_algo = stack_solve_algo;
-        [tmp,flag] = perfect_foresight_solver_core(M,options,oo);
+        [tmp, maxerror] = perfect_foresight_solver_core(M, options, oo);
+        if maxerror>options.dynatol.f
+            flag = false;
+        else
+            flag = true;
+        end
         if ~flag && ~options.no_homotopy
             exo_orig = oo.exo_simul;
             endo_simul = repmat(steady_state,1,periods+1);
-- 
GitLab