From 2358f4558b01899fa160108d8519e0172936f015 Mon Sep 17 00:00:00 2001 From: Michel Juillard <michel.juillard@mjui.fr> Date: Thu, 29 Sep 2011 21:22:27 +0200 Subject: [PATCH] fixing bug for computation of expectation auxiliary variables steadystate value when *_steadystate.m is provided without setting auxiliary variables (cherry picked by hand from commit f51a8edf50f0c60f6355ac77a579900153f22993) --- .../add_auxiliary_variables_to_steadystate.m | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/matlab/add_auxiliary_variables_to_steadystate.m b/matlab/add_auxiliary_variables_to_steadystate.m index c62c07db9..d99e36ebb 100644 --- a/matlab/add_auxiliary_variables_to_steadystate.m +++ b/matlab/add_auxiliary_variables_to_steadystate.m @@ -20,18 +20,8 @@ function ys1 = add_auxiliary_variables_to_steadystate(ys,aux_vars,fname, ... % along with Dynare. If not, see <http://www.gnu.org/licenses/>. n = length(aux_vars); ys1 = [ys;zeros(n,1)]; -k = size(ys,1)+1; -aux_lead_nbr = 0; -for i=1:n - if aux_vars(i).type == 1 - ys1(k) = ys(aux_vars(i).orig_index); - elseif aux_vars(i).type == 0 - aux_lead_nbr = aux_lead_nbr + 1; - end - k = k+1; -end -for i=1:aux_lead_nbr+1; +for i=1:n+1; if byte_code [info, res] = bytecode('static','evaluate',ys1,... [exo_steady_state; ... @@ -42,9 +32,7 @@ for i=1:aux_lead_nbr+1; exo_det_steady_state],params); end; for j=1:n - if aux_vars(j).type == 0 - el = aux_vars(j).endo_index; - ys1(el) = ys1(el)-res(el); - end + el = aux_vars(j).endo_index; + ys1(el) = ys1(el)-res(el); end end -- GitLab