Commit b356c5e5 authored by Ferhat Mihoubi's avatar Ferhat Mihoubi Committed by Sébastien Villemot
Browse files

add_auxiliary_variables_to_steadystate is compatible with bytecode option

+ minor corrections in steady_.m
parent 48eb2a83
function ys1 = add_auxiliary_variables_to_steadystate(ys,aux_vars,fname, ...
exo_steady_state, exo_det_steady_state,params)
exo_steady_state, exo_det_steady_state,params, byte_code)
% Add auxiliary variables to the steady state vector
% Copyright (C) 2009 Dynare Team
......@@ -18,7 +18,6 @@ function ys1 = add_auxiliary_variables_to_steadystate(ys,aux_vars,fname, ...
%
% You should have received a copy of the GNU General Public License
% 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;
......@@ -33,9 +32,15 @@ for i=1:n
end
for i=1:aux_lead_nbr+1;
res = feval([fname '_static'],ys1,...
[exo_steady_state; ...
exo_det_steady_state],params);
if byte_code
[info, res] = bytecode('static','evaluate',ys1,...
[exo_steady_state; ...
exo_det_steady_state],params);
else
res = feval([fname '_static'],ys1,...
[exo_steady_state; ...
exo_det_steady_state],params);
end;
for j=1:n
if aux_vars(j).type == 0
el = aux_vars(j).endo_index;
......
......@@ -111,7 +111,8 @@ if options_.ramsey_policy
M_.fname,...
oo_.exo_steady_state,...
oo_.exo_det_steady_state,...
M_.params);
M_.params,...
options_.bytecode);
else
error([M_.fname '_steadystate.m doesn''t match the model']);
end
......@@ -167,9 +168,9 @@ else
end;
if options_.order == 1
if (options_.bytecode)
jacobia_ = [];
[chck, junk, jacobia_] = bytecode('dynamic','evaluate', z,[oo_.exo_simul ...
oo_.exo_det_simul], M_.params, 1, jacobia_);
[chck, junk, loc_dr] = bytecode('dynamic','evaluate', z,[oo_.exo_simul ...
oo_.exo_det_simul], M_.params, 1);
jacobia_ = [loc_dr.g1 loc_dr.g1_x];
else
[junk,jacobia_] = feval([M_.fname '_dynamic'],z,[oo_.exo_simul ...
oo_.exo_det_simul], M_.params, it_);
......
......@@ -67,7 +67,8 @@ if options_.steadystate_flag
M.fname,...
oo.exo_steady_state,...
oo.exo_det_steady_state,...
M_.params);
M_.params,...
options_.bytecode);
else
error([M.fname '_steadystate.m doesn''t match the model']);
end
......
......@@ -313,7 +313,8 @@ if options_.steadystate_flag% if the *_steadystate.m file is provided.
M_.fname,...
zeros(M_.exo_nbr,1),...
oo_.exo_det_steady_state,...
M_.params);
M_.params,...
options_.bytecode);
else
error([M_.fname '_steadystate.m doesn''t match the model']);
end
......
......@@ -115,7 +115,8 @@ if isempty(load_data)
M_.fname,...
zeros(M_.exo_nbr,1),...
oo_.exo_det_steady_state,...
M_.params);
M_.params,...
options_.bytecode);
else
error([M_.fname '_steadystate.m doesn''t match the model']);
end
......
......@@ -73,7 +73,8 @@ if options_.steadystate_flag
M_.fname,...
oo_.exo_steady_state,...
oo_.exo_det_steady_state,...
M_.params);
M_.params,...
options_.bytecode);
else
error([M_.fname '_steadystate.m doesn''t match the model']);
end
......@@ -84,10 +85,17 @@ if options_.steadystate_flag
check1 = 0;
if isfield(options_,'unit_root_vars') & options_.diffuse_filter == 0
if isempty(options_.unit_root_vars)
check1 = max(abs(feval([M_.fname '_static'],...
oo_.steady_state,...
[oo_.exo_steady_state; ...
oo_.exo_det_steady_state], M_.params))) > options_.dynatol ;
if ~options_.bytecode
check1 = max(abs(feval([M_.fname '_static'],...
oo_.steady_state,...
[oo_.exo_steady_state; ...
oo_.exo_det_steady_state], M_.params))) > options_.dynatol ;
else
[info, res] = bytecode('static','evaluate',oo_.steady_state,...
[oo_.exo_steady_state; ...
oo_.exo_det_steady_state], M_.params);
check1 = max(abs(res)) > options_.dynatol;
end
if check1
error(['The seadystate values returned by ' M_.fname ...
'_steadystate.m don''t solve the static model!' ])
......
......@@ -84,7 +84,8 @@ if options_.steadystate_flag
ys = add_auxiliary_variables_to_steadystate(ys,M_.aux_vars,...
M_.fname,...
oo_.exo_steady_state,...
oo_.exo_det_steady_state);
oo_.exo_det_steady_state,...
options_.bytecode);
else
error([M_.fname '_steadystate.m doesn''t match the model']);
end
......
......@@ -51,7 +51,8 @@ if exist([M_.fname '_steadystate'])
ys = add_auxiliary_variables_to_steadystate(ys,M_.aux_vars,...
M_.fname,...
oo_.exo_steady_state,...
oo_.exo_det_steady_state,M_.params);
oo_.exo_det_steady_state,M_.params,...
options_.bytecode);
else
error([M_.fname '_steadystate.m doesn''t match the model']);
end
......
......@@ -45,7 +45,8 @@ if options_.steadystate_flag
M_.fname, ...
oo_.exo_steady_state, ...
oo_.exo_det_steady_state, ...
M_.params);
M_.params,...
options_.bytecode);
else
error([M_.fname '_steadystate.m doesn''t match the model']);
end
......
......@@ -80,7 +80,8 @@ if options_.steadystate_flag
M_.fname,...
oo_.exo_steady_state,...
oo_.exo_det_steady_state,...
M_.params);
M_.params,...
options_.bytecode);
else
error([M_.fname '_steadystate.m doesn''t match the model']);
end
......
......@@ -57,7 +57,8 @@ if options_.steadystate_flag
M_.fname,...
oo_.exo_steady_state,...
oo_.exo_det_steady_state,...
M_.params);
M_.params,...
options_.bytecode);
else
error([M_.fname '_steadystate.m doesn''t match the model']);
end
......@@ -84,11 +85,12 @@ if options_.steadystate_flag
if ~isempty(idx)
check1 = 1;
end
elseif options_.block && options_.bytecode
elseif options_.bytecode
[check1, residuals] = bytecode('evaluate','static',oo_.steady_state,...
[oo_.exo_steady_state; ...
oo_.exo_det_steady_state], M_.params, 1);
mexErrCheck('bytecode', check1);
check1 = max(abs(residuals)) > options_.dynatol ;
else
check1 = 0;
check1 = max(abs(feval([M_.fname '_static'],...
......
Supports Markdown
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