From 0c17d656e1ba171cfa9436a18e57ed36953a1ab8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Thu, 20 Apr 2023 13:39:26 +0200
Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Steady=20state=20computation=20c?=
 =?UTF-8?q?ould=20fail=20with=20block+bytecode+mfs>0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The Jacobian used for solving a block was not square if there were recursive
variables.
---
 matlab/evaluate_steady_state.m | 1 +
 1 file changed, 1 insertion(+)

diff --git a/matlab/evaluate_steady_state.m b/matlab/evaluate_steady_state.m
index 3ac5164e83..74a8284b08 100644
--- a/matlab/evaluate_steady_state.m
+++ b/matlab/evaluate_steady_state.m
@@ -508,3 +508,4 @@ function [r, g1] = block_bytecode_mfs_steadystate(y, b, y_all, exo, params, T, M
 mfs_idx = M.block_structure_stat.block(b).variable(end-M.block_structure_stat.block(b).mfs+1:end);
 y_all(mfs_idx) = y;
 [r, g1] = bytecode(y_all, exo, params, y_all, 1, y_all, T, 'evaluate', 'static', 'block_decomposed', ['block = ' int2str(b) ]);
+g1 = g1(:,end-M.block_structure_stat.block(b).mfs+1:end); % Make Jacobian square if mfs>0
-- 
GitLab