From 46da76c0ce2dbba515da7e2814869a056a152ae7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 20 Oct 2020 17:44:39 +0200
Subject: [PATCH] LMMCP: fix bug when periods=1

The fix in commit 24cc67e585051f8ec6f3351b930397f9ea333ce6 was incorrect.
---
 matlab/perfect-foresight-models/perfect_foresight_mcp_problem.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/matlab/perfect-foresight-models/perfect_foresight_mcp_problem.m b/matlab/perfect-foresight-models/perfect_foresight_mcp_problem.m
index 40e344e136..eea045e1ff 100644
--- a/matlab/perfect-foresight-models/perfect_foresight_mcp_problem.m
+++ b/matlab/perfect-foresight-models/perfect_foresight_mcp_problem.m
@@ -82,7 +82,7 @@ for it = maximum_lag+(1:T)
         [res,jacobian] = dynamic_function(YY(i_cols),exo_simul, params, steady_state,it);
         residuals(i_rows) = res(eq_index);
         if T==1 && it==maximum_lag+1
-            [rows, cols, vals] = find(jacobian(:,i_cols_0));
+            [rows, cols, vals] = find(jacobian(eq_index,i_cols_0));
             if size(jacobian, 1) == 1 % find() will return row vectors in this case
                 rows = rows';
                 cols = cols';
-- 
GitLab