Skip to content
Snippets Groups Projects
Commit ce7af538 authored by michel's avatar michel
Browse files

v4.2: changed vech functions names to avoid conflict with other toolboxes

      vech.m      -> dyn_vech.m
      unvech.m    -> dyn_unvech.m
      diag_vech.m -> dyn_diag_vech.m


git-svn-id: https://www.dynare.org/svn/dynare/trunk@3375 ac1d8469-bf42-47a9-8791-bf33cf982152
parent b5727e06
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ function PackedConditionalVarianceDecomposition = conditional_variance_decomposi ...@@ -15,7 +15,7 @@ function PackedConditionalVarianceDecomposition = conditional_variance_decomposi
% %
% [1] In this version, absence of measurement errors is assumed... % [1] In this version, absence of measurement errors is assumed...
% Copyright (C) 2009 Dynare Team % Copyright (C) 2010 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -31,6 +31,7 @@ function PackedConditionalVarianceDecomposition = conditional_variance_decomposi ...@@ -31,6 +31,7 @@ function PackedConditionalVarianceDecomposition = conditional_variance_decomposi
% %
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
number_of_state_innovations = ... number_of_state_innovations = ...
StateSpaceModel.number_of_state_innovations; StateSpaceModel.number_of_state_innovations;
transition_matrix = StateSpaceModel.transition_matrix; transition_matrix = StateSpaceModel.transition_matrix;
...@@ -68,6 +69,6 @@ NumberOfVariables = length(SubsetOfVariables); ...@@ -68,6 +69,6 @@ NumberOfVariables = length(SubsetOfVariables);
PackedConditionalVarianceDecomposition = zeros(NumberOfVariables*(NumberOfVariables+1)/2,length(Steps),StateSpaceModel.number_of_state_innovations); PackedConditionalVarianceDecomposition = zeros(NumberOfVariables*(NumberOfVariables+1)/2,length(Steps),StateSpaceModel.number_of_state_innovations);
for i=1:number_of_state_innovations for i=1:number_of_state_innovations
for h = 1:length(Steps) for h = 1:length(Steps)
PackedConditionalVarianceDecomposition(:,h,i) = vech(ConditionalVariance(:,:,h,i)); PackedConditionalVarianceDecomposition(:,h,i) = dyn_vech(ConditionalVariance(:,:,h,i));
end end
end end
\ No newline at end of file
...@@ -16,7 +16,7 @@ function oo_ = display_conditional_variance_decomposition(Steps, SubsetOfVariabl ...@@ -16,7 +16,7 @@ function oo_ = display_conditional_variance_decomposition(Steps, SubsetOfVariabl
% [1] The covariance matrix of the state innovations needs to be diagonal. % [1] The covariance matrix of the state innovations needs to be diagonal.
% [2] In this version, absence of measurement errors is assumed... % [2] In this version, absence of measurement errors is assumed...
% Copyright (C) 2009 Dynare Team % Copyright (C) 2010 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -58,7 +58,7 @@ for i=1:length(Steps) ...@@ -58,7 +58,7 @@ for i=1:length(Steps)
disp(['Period ' int2str(Steps(i)) ':']) disp(['Period ' int2str(Steps(i)) ':'])
for j=1:exo_nbr for j=1:exo_nbr
vardec_i(:,j) = diag_vech(conditional_decomposition_array(:, ... vardec_i(:,j) = dyn_diag_vech(conditional_decomposition_array(:, ...
i,j)); i,j));
end end
vardec_i = 100*vardec_i./repmat(sum(vardec_i,2),1,exo_nbr); vardec_i = 100*vardec_i./repmat(sum(vardec_i,2),1,exo_nbr);
......
function d = diag_vech(Vector) function d = dyn_diag_vech(Vector)
% This function returns the diagonal elements of a symmetric matrix % This function returns the diagonal elements of a symmetric matrix
% stored in vech form % stored in vech form
% %
...@@ -8,7 +8,7 @@ function d = diag_vech(Vector) ...@@ -8,7 +8,7 @@ function d = diag_vech(Vector)
% OUTPUTS % OUTPUTS
% d [double] a n*1 vector, where n solves n*(n+1)/2=m. % d [double] a n*1 vector, where n solves n*(n+1)/2=m.
% Copyright (C) 2009 Dynare Team % Copyright (C) 2010 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
......
function Matrix = unvech(Vector) function Matrix = dyn_unvech(Vector)
% This function implements the unvech operator. % This function implements the unvech operator.
% %
% INPUTS % INPUTS
...@@ -7,7 +7,7 @@ function Matrix = unvech(Vector) ...@@ -7,7 +7,7 @@ function Matrix = unvech(Vector)
% OUTPUTS % OUTPUTS
% Matrix [double] a n*n symetric matrix, where n solves n*(n+1)/2=m. % Matrix [double] a n*n symetric matrix, where n solves n*(n+1)/2=m.
% Copyright (C) 2009 Dynare Team % Copyright (C) 2010 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -23,6 +23,7 @@ function Matrix = unvech(Vector) ...@@ -23,6 +23,7 @@ function Matrix = unvech(Vector)
% %
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
m = length(Vector); m = length(Vector);
n = (sqrt(1+8*m)-1)/2; n = (sqrt(1+8*m)-1)/2;
b = 0; b = 0;
......
function Vector = vech(Matrix) function Vector = dyn_vech(Matrix)
% This function implements the vech operator. % This function implements the vech operator.
% %
% INPUTS % INPUTS
...@@ -7,7 +7,7 @@ function Vector = vech(Matrix) ...@@ -7,7 +7,7 @@ function Vector = vech(Matrix)
% OUTPUTS % OUTPUTS
% Vector [double] a n*(n+1)/2 vector. % Vector [double] a n*(n+1)/2 vector.
% Copyright (C) 2009 Dynare Team % Copyright (C) 2010 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -23,6 +23,7 @@ function Vector = vech(Matrix) ...@@ -23,6 +23,7 @@ function Vector = vech(Matrix)
% %
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
n = length(Matrix); n = length(Matrix);
b = 0; b = 0;
Vector = NaN(n*(n+1)/2,1); Vector = NaN(n*(n+1)/2,1);
......
...@@ -2,7 +2,7 @@ function [pdraws, TAU, GAM, LRE, gp, H, JJ] = dynare_identification(options_iden ...@@ -2,7 +2,7 @@ function [pdraws, TAU, GAM, LRE, gp, H, JJ] = dynare_identification(options_iden
% main % main
% %
% Copyright (C) 2008 Dynare Team % Copyright (C) 2010 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -100,8 +100,8 @@ if iload <=0, ...@@ -100,8 +100,8 @@ if iload <=0,
% bayestopt_.restrict_var_list, ... % bayestopt_.restrict_var_list, ...
% bayestopt_.restrict_columns, ... % bayestopt_.restrict_columns, ...
% bayestopt_.restrict_aux, M_.exo_nbr); % bayestopt_.restrict_aux, M_.exo_nbr);
% tau=[vec(Aa); vech(Bb*M_.Sigma_e*Bb')]; % tau=[vec(Aa); dyn_vech(Bb*M_.Sigma_e*Bb')];
tau=[oo_.dr.ys(oo_.dr.order_var); vec(A); vech(B*M_.Sigma_e*B')]; tau=[oo_.dr.ys(oo_.dr.order_var); vec(A); dyn_vech(B*M_.Sigma_e*B')];
yy0=oo_.dr.ys(I); yy0=oo_.dr.ys(I);
[residual, g1 ] = feval([M_.fname,'_dynamic'],yy0, oo_.exo_steady_state', M_.params,1); [residual, g1 ] = feval([M_.fname,'_dynamic'],yy0, oo_.exo_steady_state', M_.params,1);
...@@ -121,7 +121,7 @@ if iload <=0, ...@@ -121,7 +121,7 @@ if iload <=0,
gam{j+1}=gam{j+1}.*sy; gam{j+1}=gam{j+1}.*sy;
end end
end end
dum = vech(gam{1}); dum = dyn_vech(gam{1});
for j=1:nlags, for j=1:nlags,
dum = [dum; vec(gam{j+1})]; dum = [dum; vec(gam{j+1})];
end end
...@@ -277,7 +277,7 @@ end ...@@ -277,7 +277,7 @@ end
% GAM0=GAM; % GAM0=GAM;
% end % end
% if useautocorr, % if useautocorr,
% idiag = find(vech(eye(size(options_.varobs,1)))); % idiag = find(dyn_vech(eye(size(options_.varobs,1))));
% GAM(idiag,:) = GAM(idiag,:)./(sGAM(idiag)'*ones(1,SampleSize)); % GAM(idiag,:) = GAM(idiag,:)./(sGAM(idiag)'*ones(1,SampleSize));
% % siJmean(idiag,:) = siJmean(idiag,:)./(sGAM(idiag)'*ones(1,nparam)); % % siJmean(idiag,:) = siJmean(idiag,:)./(sGAM(idiag)'*ones(1,nparam));
% % siJmean = siJmean./(max(siJmean')'*ones(size(params))); % % siJmean = siJmean./(max(siJmean')'*ones(size(params)));
......
...@@ -2,7 +2,7 @@ function [H, dA, dOm, Hss, gp, info] = getH(A, B, M_,oo_,kronflag,indx,indexo) ...@@ -2,7 +2,7 @@ function [H, dA, dOm, Hss, gp, info] = getH(A, B, M_,oo_,kronflag,indx,indexo)
% computes derivative of reduced form linear model w.r.t. deep params % computes derivative of reduced form linear model w.r.t. deep params
% %
% Copyright (C) 2008 Dynare Team % Copyright (C) 2010 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -279,7 +279,7 @@ else % generalized sylvester equation ...@@ -279,7 +279,7 @@ else % generalized sylvester equation
dSig(indexo(j),indexo(j)) = 2*sqrt(M_.Sigma_e(indexo(j),indexo(j))); dSig(indexo(j),indexo(j)) = 2*sqrt(M_.Sigma_e(indexo(j),indexo(j)));
y = B*dSig*B'; y = B*dSig*B';
y = y(nauxe+1:end,nauxe+1:end); y = y(nauxe+1:end,nauxe+1:end);
H(:,j) = [zeros((m-nauxe)^2,1); vech(y)]; H(:,j) = [zeros((m-nauxe)^2,1); dyn_vech(y)];
if nargout>1, if nargout>1,
dOm(:,:,j) = y; dOm(:,:,j) = y;
end end
...@@ -296,7 +296,7 @@ else % generalized sylvester equation ...@@ -296,7 +296,7 @@ else % generalized sylvester equation
dA(:,:,j+length(indexo)) = x; dA(:,:,j+length(indexo)) = x;
dOm(:,:,j+length(indexo)) = y; dOm(:,:,j+length(indexo)) = y;
end end
H(:,j+length(indexo)) = [x(:); vech(y)]; H(:,j+length(indexo)) = [x(:); dyn_vech(y)];
end end
% for j=1:param_nbr, % for j=1:param_nbr,
% disp(['Derivatives w.r.t. ',M_.param_names(indx(j),:),', ',int2str(j),'/',int2str(param_nbr)]) % disp(['Derivatives w.r.t. ',M_.param_names(indx(j),:),', ',int2str(j),'/',int2str(param_nbr)])
...@@ -308,7 +308,7 @@ else % generalized sylvester equation ...@@ -308,7 +308,7 @@ else % generalized sylvester equation
% y = y*B'+B*y'; % y = y*B'+B*y';
% x = x(nauxe+1:end,nauxe+1:end); % x = x(nauxe+1:end,nauxe+1:end);
% y = y(nauxe+1:end,nauxe+1:end); % y = y(nauxe+1:end,nauxe+1:end);
% H(:,j) = [x(:); vech(y)]; % H(:,j) = [x(:); dyn_vech(y)];
% end % end
H = [[zeros(M_.endo_nbr,length(indexo)) Hss]; H]; H = [[zeros(M_.endo_nbr,length(indexo)) Hss]; H];
......
function [JJ, H, gam, gp] = getJJ(A, B, M_,oo_,options_,kronflag,indx,indexo,mf,nlags,useautocorr) function [JJ, H, gam, gp] = getJJ(A, B, M_,oo_,options_,kronflag,indx,indexo,mf,nlags,useautocorr)
% Copyright (C) 2009 Dynare Team % Copyright (C) 2010 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -68,9 +68,9 @@ else ...@@ -68,9 +68,9 @@ else
dum1=dum; dum1=dum;
dum1 = (dum1.*sy-dsy.*GAM)./(sy.*sy); dum1 = (dum1.*sy-dsy.*GAM)./(sy.*sy);
dum1 = dum1-diag(diag(dum1))+diag(diag(dum)); dum1 = dum1-diag(diag(dum1))+diag(diag(dum));
dumm = vech(dum1(mf,mf)); dumm = dyn_vech(dum1(mf,mf));
else else
dumm = vech(dum(mf,mf)); dumm = dyn_vech(dum(mf,mf));
end end
for i=1:nlags, for i=1:nlags,
dum1 = A^i*dum; dum1 = A^i*dum;
...@@ -93,9 +93,9 @@ else ...@@ -93,9 +93,9 @@ else
dum1=dum; dum1=dum;
dum1 = (dum1.*sy-dsy.*GAM)./(sy.*sy); dum1 = (dum1.*sy-dsy.*GAM)./(sy.*sy);
dum1 = dum1-diag(diag(dum1))+diag(diag(dum)); dum1 = dum1-diag(diag(dum1))+diag(diag(dum));
dumm = vech(dum1(mf,mf)); dumm = dyn_vech(dum1(mf,mf));
else else
dumm = vech(dum(mf,mf)); dumm = dyn_vech(dum(mf,mf));
end end
for i=1:nlags, for i=1:nlags,
dum1 = A^i*dum; dum1 = A^i*dum;
...@@ -126,7 +126,7 @@ else ...@@ -126,7 +126,7 @@ else
GAM{j+1}=GAM{j+1}.*sy; GAM{j+1}=GAM{j+1}.*sy;
end end
end end
gam = vech(GAM{1}); gam = dyn_vech(GAM{1});
for j=1:nlags, for j=1:nlags,
gam = [gam; vec(GAM{j+1})]; gam = [gam; vec(GAM{j+1})];
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment