Commit 5beea983 authored by Johannes Pfeifer 's avatar Johannes Pfeifer Committed by Sébastien Villemot

evaluate_steady_state.m: consistently use params

Prevents erroneously relying on stale parameters from M.params (thanks to Tom Holden); closes #1627

(manually cherry picked from commit c16c2fb8)
parent 2bcddb03
Pipeline #323 failed with stages
in 56 minutes and 55 seconds
...@@ -49,7 +49,7 @@ exo_ss = [oo.exo_steady_state; oo.exo_det_steady_state]; ...@@ -49,7 +49,7 @@ exo_ss = [oo.exo_steady_state; oo.exo_det_steady_state];
if length(M.aux_vars) > 0 if length(M.aux_vars) > 0
h_set_auxiliary_variables = str2func([M.fname '_set_auxiliary_variables']); h_set_auxiliary_variables = str2func([M.fname '_set_auxiliary_variables']);
if ~steadystate_flag if ~steadystate_flag
ys_init = h_set_auxiliary_variables(ys_init,exo_ss,M.params); ys_init = h_set_auxiliary_variables(ys_init,exo_ss,params);
end end
end end
...@@ -290,7 +290,7 @@ if check ...@@ -290,7 +290,7 @@ if check
info(1)= 20; info(1)= 20;
%make sure ys contains auxiliary variables in case of problem with dynare_solve %make sure ys contains auxiliary variables in case of problem with dynare_solve
if length(M.aux_vars) > 0 && ~steadystate_flag if length(M.aux_vars) > 0 && ~steadystate_flag
ys = h_set_auxiliary_variables(ys,exo_ss,M.params); ys = h_set_auxiliary_variables(ys,exo_ss,params);
end end
resid = evaluate_static_model(ys,exo_ss,params,M,options); resid = evaluate_static_model(ys,exo_ss,params,M,options);
info(2) = resid'*resid ; info(2) = resid'*resid ;
...@@ -307,15 +307,15 @@ if M.static_and_dynamic_models_differ ...@@ -307,15 +307,15 @@ if M.static_and_dynamic_models_differ
z = repmat(ys,1,M.maximum_lead + M.maximum_lag + 1); z = repmat(ys,1,M.maximum_lead + M.maximum_lag + 1);
zx = repmat([exo_ss'], M.maximum_lead + M.maximum_lag + 1, 1); zx = repmat([exo_ss'], M.maximum_lead + M.maximum_lag + 1, 1);
if options.bytecode if options.bytecode
[chck, r, junk]= bytecode('dynamic','evaluate', z, zx, M.params, ys, 1); [chck, r, junk]= bytecode('dynamic','evaluate', z, zx, params, ys, 1);
mexErrCheck('bytecode', chck); mexErrCheck('bytecode', chck);
elseif options.block elseif options.block
[r, oo.dr] = feval([M.fname '_dynamic'], z', zx, M.params, ys, M.maximum_lag+1, oo.dr); [r, oo.dr] = feval([M.fname '_dynamic'], z', zx, params, ys, M.maximum_lag+1, oo.dr);
else else
iyv = M.lead_lag_incidence'; iyv = M.lead_lag_incidence';
iyr0 = find(iyv(:)); iyr0 = find(iyv(:));
xys = z(iyr0); xys = z(iyr0);
r = feval([M.fname '_dynamic'], z(iyr0), zx, M.params, ys, M.maximum_lag + 1); r = feval([M.fname '_dynamic'], z(iyr0), zx, params, ys, M.maximum_lag + 1);
end end
% Fail if residual greater than tolerance % Fail if residual greater than tolerance
if max(abs(r)) > options.solve_tolf if max(abs(r)) > options.solve_tolf
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment