Removed duplicate of the same function.

Fixed call removing globals.
global options_ still needed
time-shift
Marco Ratto 2012-06-08 14:03:40 +02:00
parent b7538ad315
commit 45bc5c2459
4 changed files with 7 additions and 69 deletions

View File

@ -338,7 +338,7 @@ if kronflag==1, % kronecker products
elseif kronflag==-1, % perturbation
fun = 'thet2tau';
params0 = M_.params;
H = fjaco(fun,[sqrt(diag(M_.Sigma_e(indexo,indexo))); M_.params(indx)],indx,indexo);
H = fjaco(fun,[sqrt(diag(M_.Sigma_e(indexo,indexo))); M_.params(indx)], M_, oo_, indx, indexo);
assignin('base','M_', M_);
assignin('base','oo_', oo_);

View File

@ -28,10 +28,10 @@ warning('off','MATLAB:divideByZero')
if kronflag == -1,
fun = 'thet2tau';
params0 = M_.params;
JJ = fjaco(fun,[sqrt(diag(M_.Sigma_e(indexo,indexo))); M_.params(indx)],indx,indexo,1,mf,nlags,useautocorr);
JJ = fjaco(fun,[sqrt(diag(M_.Sigma_e(indexo,indexo))); M_.params(indx)],M_, oo_, indx,indexo,1,mf,nlags,useautocorr);
M_.params = params0;
params0 = M_.params;
H = fjaco(fun,[sqrt(diag(M_.Sigma_e(indexo,indexo))); M_.params(indx)],indx,indexo,0,mf,nlags,useautocorr);
H = fjaco(fun,[sqrt(diag(M_.Sigma_e(indexo,indexo))); M_.params(indx)],M_, oo_, indx,indexo,0,mf,nlags,useautocorr);
M_.params = params0;
assignin('base','M_', M_);
assignin('base','oo_', oo_);

View File

@ -1,62 +0,0 @@
function tau = thet2tau(params, indx, indexo, flagmoments,mf,nlags,useautocorr)
% Copyright (C) 2012 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global M_ oo_ options_
if nargin==1,
indx = [1:M_.param_nbr];
indexo = [];
end
if nargin<4,
flagmoments=0;
end
if nargin<7 | isempty(useautocorr),
useautocorr=0;
end
M_.params(indx) = params(length(indexo)+1:end);
if ~isempty(indexo)
M_.Sigma_e(indexo,indexo) = diag(params(1:length(indexo)).^2);
end
[A,B,plouf,plouf,M_,options_,oo_] = dynare_resolve(M_,options_,oo_);
if flagmoments==0,
tau = [oo_.dr.ys(oo_.dr.order_var); A(:); dyn_vech(B*M_.Sigma_e*B')];
else
GAM = lyapunov_symm(A,B*M_.Sigma_e*B',options_.qz_criterium,options_.lyapunov_complex_threshold);
k = find(abs(GAM) < 1e-12);
GAM(k) = 0;
if useautocorr,
sy = sqrt(diag(GAM));
sy = sy*sy';
sy0 = sy-diag(diag(sy))+eye(length(sy));
dum = GAM./sy0;
tau = dyn_vech(dum(mf,mf));
else
tau = dyn_vech(GAM(mf,mf));
end
for ii = 1:nlags
dum = A^(ii)*GAM;
if useautocorr,
dum = dum./sy;
end
tau = [tau;vec(dum(mf,mf))];
end
tau = [ oo_.dr.ys(oo_.dr.order_var(mf)); tau];
end

View File

@ -1,4 +1,4 @@
function tau = thet2tau(params, indx, indexo, flagmoments,mf,nlags,useautocorr)
function tau = thet2tau(params, M_, oo_, indx, indexo, flagmoments,mf,nlags,useautocorr)
%
% Copyright (C) 2011 Dynare Team
@ -18,17 +18,17 @@ function tau = thet2tau(params, indx, indexo, flagmoments,mf,nlags,useautocorr)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global M_ oo_ options_
global options_
if nargin==1,
indx = [1:M_.param_nbr];
indexo = [];
end
if nargin<4,
if nargin<6,
flagmoments=0;
end
if nargin<7 || isempty(useautocorr),
if nargin<9 || isempty(useautocorr),
useautocorr=0;
end