simk.m: minor cleanups
parent
b4d11d399c
commit
f30d6858e6
|
@ -3,6 +3,8 @@ function simk
|
||||||
% performs deterministic simulations with lead or lag on more than one
|
% performs deterministic simulations with lead or lag on more than one
|
||||||
% period
|
% period
|
||||||
%
|
%
|
||||||
|
% Currently used only for purely forward models.
|
||||||
|
%
|
||||||
% INPUTS
|
% INPUTS
|
||||||
% ...
|
% ...
|
||||||
% OUTPUTS
|
% OUTPUTS
|
||||||
|
@ -17,7 +19,7 @@ function simk
|
||||||
% None.
|
% None.
|
||||||
%
|
%
|
||||||
|
|
||||||
% Copyright (C) 1996-2009 Dynare Team
|
% Copyright (C) 1996-2010 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -35,9 +37,7 @@ function simk
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
global M_ options_ oo_
|
global M_ options_ oo_
|
||||||
global it_ iyr0 broyden_
|
|
||||||
|
|
||||||
%func_name = [M_.fname '_static'];
|
|
||||||
nk = M_.maximum_endo_lag + M_.maximum_endo_lead + 1 ;
|
nk = M_.maximum_endo_lag + M_.maximum_endo_lead + 1 ;
|
||||||
ny = size(M_.lead_lag_incidence,2) ;
|
ny = size(M_.lead_lag_incidence,2) ;
|
||||||
icc1 = M_.lead_lag_incidence(nk,:) > 0;
|
icc1 = M_.lead_lag_incidence(nk,:) > 0;
|
||||||
|
@ -139,14 +139,8 @@ for iter = 1:options_.maxit_
|
||||||
i = M_.maximum_endo_lag+1 ;
|
i = M_.maximum_endo_lag+1 ;
|
||||||
while (i>1) & (it_<=options_.periods+M_.maximum_endo_lag)
|
while (i>1) & (it_<=options_.periods+M_.maximum_endo_lag)
|
||||||
h3 = clock ;
|
h3 = clock ;
|
||||||
if broyden_ & iter > 1
|
[d1,jacobian] = feval([M_.fname '_dynamic'],oo_.endo_simul(iyr),oo_.exo_simul, M_.params, it_);
|
||||||
%d1_ = -feval(fh,oo_.endo_simul(iyr));
|
d1 = -d1 ;
|
||||||
d1 = -feval([M_.fname '_dynamic'],oo_.endo_simul(iyr),z,oo_.exo_simul, M_.params, it_);
|
|
||||||
else
|
|
||||||
%jacob(func_name,oo_.endo_simul(iyr)) ;
|
|
||||||
[d1,jacobian] = feval([M_.fname '_dynamic'],oo_.endo_simul(iyr),oo_.exo_simul, M_.params, it_);
|
|
||||||
d1 = -d1 ;
|
|
||||||
end
|
|
||||||
err_f = max(err_f,max(abs(d1)));
|
err_f = max(err_f,max(abs(d1)));
|
||||||
if lky(i) ~= 0
|
if lky(i) ~= 0
|
||||||
j1i = ky(1:lky(i),i) ;
|
j1i = ky(1:lky(i),i) ;
|
||||||
|
@ -232,14 +226,8 @@ for iter = 1:options_.maxit_
|
||||||
end
|
end
|
||||||
icr0 = (it_-M_.maximum_lag-M_.maximum_endo_lag -1)*ny ;
|
icr0 = (it_-M_.maximum_lag-M_.maximum_endo_lag -1)*ny ;
|
||||||
while it_ <= options_.periods+M_.maximum_lag
|
while it_ <= options_.periods+M_.maximum_lag
|
||||||
if broyden_
|
[d1,jacobian] = feval([M_.fname '_dynamic'],oo_.endo_simul(iyr),oo_.exo_simul, M_.params, it_);
|
||||||
%d1_ = -feval(fh,oo_.endo_simul(iyr));
|
d1 = -d1 ;
|
||||||
d1 = -feval([M_.fname '_dynamic'],oo_.endo_simul(iyr),z,oo_.exo_simul, M_.params, it_);
|
|
||||||
else
|
|
||||||
%jacob(func_name,oo_.endo_simul(iyr)) ;
|
|
||||||
[d1,jacobian] = feval([M_.fname '_dynamic'],oo_.endo_simul(iyr),oo_.exo_simul, M_.params, it_);
|
|
||||||
d1 = -d1 ;
|
|
||||||
end
|
|
||||||
err_f = max(err_f,max(abs(d1)));
|
err_f = max(err_f,max(abs(d1)));
|
||||||
w0 = jacobian(:,1:isc(1)) ;
|
w0 = jacobian(:,1:isc(1)) ;
|
||||||
w = jacobian(:,isc(1)+1:isc(1+M_.maximum_endo_lead)) ;
|
w = jacobian(:,isc(1)+1:isc(1+M_.maximum_endo_lead)) ;
|
||||||
|
@ -344,12 +332,3 @@ end
|
||||||
disp(['WARNING : the maximum number of iterations is reached.']) ;
|
disp(['WARNING : the maximum number of iterations is reached.']) ;
|
||||||
fprintf ('\n') ;
|
fprintf ('\n') ;
|
||||||
disp (['-----------------------------------------------------']) ;
|
disp (['-----------------------------------------------------']) ;
|
||||||
return ;
|
|
||||||
|
|
||||||
% 2/11/99 MJ took out reshapel
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue