* Allow the use of a *_steadystate.m file with options block and bytecode.
* Added the possibility to use resid when the the options block *and* bytecode are used. git-svn-id: https://www.dynare.org/svn/dynare/trunk@2986 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
033c321b58
commit
bc83fbd808
|
@ -30,22 +30,25 @@ function resid(period)
|
|||
|
||||
global M_ options_ oo_ it_ z
|
||||
|
||||
if options_.block && ~options_.bytecode
|
||||
error('CHECK: incompatibility with "block" without "bytecode" option')
|
||||
elseif options_.block && options_.bytecode
|
||||
[z,check] = bytecode('evaluate','static');
|
||||
else
|
||||
if M_.exo_nbr > 0
|
||||
oo_.exo_simul = ones(M_.maximum_lag+M_.maximum_lead+period,1)* ...
|
||||
oo_.exo_steady_state';
|
||||
end
|
||||
n = size(M_.lead_lag_incidence,2);
|
||||
% if ~ options_.initval_file | size(oo_.endo_simul,2) ~= period+M_.maximum_lag+M_.maximum_lead
|
||||
% if ~ options_.initval_file | size(oo_.endo_simul,2) ~= period+M_.maximum_lag+M_.maximum_lead
|
||||
if ~ options_.initval_file
|
||||
if size(oo_.steady_state,1) == 1 & oo_.steady_state == 0
|
||||
oo_.steady_state = zeros(size(oo_.steady_state,1),1) ;
|
||||
end
|
||||
oo_.endo_simul = oo_.steady_state*ones(1,period+M_.maximum_lag+M_.maximum_lead) ;
|
||||
end
|
||||
|
||||
i = M_.lead_lag_incidence';
|
||||
iyr0 = find(i(:));
|
||||
|
||||
y =oo_.endo_simul(:);
|
||||
z = zeros(n,period);
|
||||
fh = str2func([M_.fname '_dynamic']);
|
||||
|
@ -53,6 +56,7 @@ function resid(period)
|
|||
z(:,it_-M_.maximum_lag) = feval(fh,y(iyr0),oo_.exo_simul, M_.params, it_);
|
||||
iyr0 = iyr0 + n;
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1:4
|
||||
disp(' ')
|
||||
|
|
|
@ -41,22 +41,45 @@ function steady_()
|
|||
oo_.steady_state,...
|
||||
[oo_.exo_steady_state; ...
|
||||
oo_.exo_det_steady_state]);
|
||||
% Check if the steady state obtained from the _steadystate file is a
|
||||
% steady state.
|
||||
% Check if the steady state obtained from the _steadystate file is a steady state.
|
||||
check1 = 0;
|
||||
if isfield(options_,'unit_root_vars')
|
||||
if isempty(options_.unit_root_vars)
|
||||
if options_.block && ~options_.bytecode
|
||||
check2 = zeros(size(M_.blocksMFS,1),1);
|
||||
for b = 1:size(M_.blocksMFS,1)
|
||||
n = size(M_.blocksMFS{b}, 1);
|
||||
ss = oo_.steady_state;
|
||||
if n
|
||||
check2(b) = max(abs(feval([M_.fname '_static'], b, ss, ...
|
||||
[oo_.exo_steady_state; oo_.exo_det_steady_state], M_.params))) > options_.dynatol;
|
||||
else
|
||||
[r, g1, ssss] = feval([M_.fname '_static'], b, ss, ...
|
||||
[oo_.exo_steady_state; oo_.exo_det_steady_state], M_.params);
|
||||
end
|
||||
end
|
||||
check1 = any(check2);
|
||||
idx = find(abs(ssss-oo_.steady_state)>10*options_.dynatol);
|
||||
if ~isempty(idx)
|
||||
check1 = 1;
|
||||
end
|
||||
elseif options_.block && options_.bytecode
|
||||
residuals = bytecode('evaluate','static');
|
||||
check1 = 1;
|
||||
else
|
||||
check1 = 0;
|
||||
check1 = max(abs(feval([M_.fname '_static'],...
|
||||
oo_.steady_state,...
|
||||
[oo_.exo_steady_state; ...
|
||||
oo_.exo_det_steady_state], M_.params))) > options_.dynatol ;
|
||||
end
|
||||
end
|
||||
if check1
|
||||
if ~options_.block && ~options_.bytecode
|
||||
resid(1);
|
||||
end
|
||||
error(['The seadystate values returned by ' M_.fname ...
|
||||
'_steadystate.m don''t solve the static model!' ])
|
||||
end
|
||||
end
|
||||
end
|
||||
if ~isempty(options_.steadystate_partial)
|
||||
ssvar = options_.steadystate_partial.ssvar;
|
||||
nov = length(ssvar);
|
||||
|
|
Loading…
Reference in New Issue