From 7a2d5d4f0ed03f8e925ef4bfb16a8d201c0b0d7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 8 Mar 2019 15:54:10 +0100
Subject: [PATCH] 1st order approximation: fix for purely-forward models

Closes #1641
---
 matlab/dyn_first_order_solver.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/matlab/dyn_first_order_solver.m b/matlab/dyn_first_order_solver.m
index c7f97e9b5b..861356a632 100644
--- a/matlab/dyn_first_order_solver.m
+++ b/matlab/dyn_first_order_solver.m
@@ -107,7 +107,7 @@ if isempty(reorder_jacobian_columns)
 
     npred0 = nnz(lead_lag_incidence(maximum_lag+1,no_both_lag_id));
     index_0m = indexi_0+nstatic+(1:npred0);
-    nfwrd0 = nnz(lead_lag_incidence(2,lead_id));
+    nfwrd0 = nnz(lead_lag_incidence(maximum_lag+1,lead_id));
     index_0p = indexi_0+nstatic+npred0+(1:nfwrd0);
     index_m  = 1:(npred+nboth);
     index_p  = npred+nboth+n_current+(1:nfwrd+nboth);
-- 
GitLab