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
......@@ -15,7 +15,7 @@ function PackedConditionalVarianceDecomposition = conditional_variance_decomposi
%
% [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.
%
......@@ -31,6 +31,7 @@ function PackedConditionalVarianceDecomposition = conditional_variance_decomposi
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
number_of_state_innovations = ...
StateSpaceModel.number_of_state_innovations;
transition_matrix = StateSpaceModel.transition_matrix;
......@@ -68,6 +69,6 @@ NumberOfVariables = length(SubsetOfVariables);
PackedConditionalVarianceDecomposition = zeros(NumberOfVariables*(NumberOfVariables+1)/2,length(Steps),StateSpaceModel.number_of_state_innovations);
for i=1:number_of_state_innovations
for h = 1:length(Steps)
PackedConditionalVarianceDecomposition(:,h,i) = vech(ConditionalVariance(:,:,h,i));
PackedConditionalVarianceDecomposition(:,h,i) = dyn_vech(ConditionalVariance(:,:,h,i));
end
end
\ No newline at end of file
......@@ -16,7 +16,7 @@ function oo_ = display_conditional_variance_decomposition(Steps, SubsetOfVariabl
% [1] The covariance matrix of the state innovations needs to be diagonal.
% [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.
%
......@@ -58,7 +58,7 @@ for i=1:length(Steps)
disp(['Period ' int2str(Steps(i)) ':'])
for j=1:exo_nbr
vardec_i(:,j) = diag_vech(conditional_decomposition_array(:, ...
vardec_i(:,j) = dyn_diag_vech(conditional_decomposition_array(:, ...
i,j));
end
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
% stored in vech form
%
......@@ -8,7 +8,7 @@ function d = diag_vech(Vector)
% OUTPUTS
% 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.
%
......
function Matrix = unvech(Vector)
function Matrix = dyn_unvech(Vector)
% This function implements the unvech operator.
%
% INPUTS
......@@ -7,7 +7,7 @@ function Matrix = unvech(Vector)
% OUTPUTS
% 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.
%
......@@ -23,6 +23,7 @@ function Matrix = unvech(Vector)
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
m = length(Vector);
n = (sqrt(1+8*m)-1)/2;
b = 0;
......
function Vector = vech(Matrix)
function Vector = dyn_vech(Matrix)
% This function implements the vech operator.
%
% INPUTS
......@@ -7,7 +7,7 @@ function Vector = vech(Matrix)
% OUTPUTS
% Vector [double] a n*(n+1)/2 vector.
% Copyright (C) 2009 Dynare Team
% Copyright (C) 2010 Dynare Team
%
% This file is part of Dynare.
%
......@@ -23,6 +23,7 @@ function Vector = vech(Matrix)
%
% 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(Matrix);
b = 0;
Vector = NaN(n*(n+1)/2,1);
......
......@@ -2,7 +2,7 @@ function [pdraws, TAU, GAM, LRE, gp, H, JJ] = dynare_identification(options_iden
% main
%
% Copyright (C) 2008 Dynare Team
% Copyright (C) 2010 Dynare Team
%
% This file is part of Dynare.
%
......@@ -100,8 +100,8 @@ if iload <=0,
% bayestopt_.restrict_var_list, ...
% bayestopt_.restrict_columns, ...
% bayestopt_.restrict_aux, M_.exo_nbr);
% tau=[vec(Aa); vech(Bb*M_.Sigma_e*Bb')];
tau=[oo_.dr.ys(oo_.dr.order_var); vec(A); vech(B*M_.Sigma_e*B')];
% tau=[vec(Aa); dyn_vech(Bb*M_.Sigma_e*Bb')];
tau=[oo_.dr.ys(oo_.dr.order_var); vec(A); dyn_vech(B*M_.Sigma_e*B')];
yy0=oo_.dr.ys(I);
[residual, g1 ] = feval([M_.fname,'_dynamic'],yy0, oo_.exo_steady_state', M_.params,1);
......@@ -121,7 +121,7 @@ if iload <=0,
gam{j+1}=gam{j+1}.*sy;
end
end
dum = vech(gam{1});
dum = dyn_vech(gam{1});
for j=1:nlags,
dum = [dum; vec(gam{j+1})];
end
......@@ -277,7 +277,7 @@ end
% GAM0=GAM;
% end
% 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));
% % siJmean(idiag,:) = siJmean(idiag,:)./(sGAM(idiag)'*ones(1,nparam));
% % 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)
% 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.
%
......@@ -279,7 +279,7 @@ else % generalized sylvester equation
dSig(indexo(j),indexo(j)) = 2*sqrt(M_.Sigma_e(indexo(j),indexo(j)));
y = B*dSig*B';
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,
dOm(:,:,j) = y;
end
......@@ -296,7 +296,7 @@ else % generalized sylvester equation
dA(:,:,j+length(indexo)) = x;
dOm(:,:,j+length(indexo)) = y;
end
H(:,j+length(indexo)) = [x(:); vech(y)];
H(:,j+length(indexo)) = [x(:); dyn_vech(y)];
end
% for j=1: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
% y = y*B'+B*y';
% x = x(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
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)
% Copyright (C) 2009 Dynare Team
% Copyright (C) 2010 Dynare Team
%
% This file is part of Dynare.
%
......@@ -68,9 +68,9 @@ else
dum1=dum;
dum1 = (dum1.*sy-dsy.*GAM)./(sy.*sy);
dum1 = dum1-diag(diag(dum1))+diag(diag(dum));
dumm = vech(dum1(mf,mf));
dumm = dyn_vech(dum1(mf,mf));
else
dumm = vech(dum(mf,mf));
dumm = dyn_vech(dum(mf,mf));
end
for i=1:nlags,
dum1 = A^i*dum;
......@@ -93,9 +93,9 @@ else
dum1=dum;
dum1 = (dum1.*sy-dsy.*GAM)./(sy.*sy);
dum1 = dum1-diag(diag(dum1))+diag(diag(dum));
dumm = vech(dum1(mf,mf));
dumm = dyn_vech(dum1(mf,mf));
else
dumm = vech(dum(mf,mf));
dumm = dyn_vech(dum(mf,mf));
end
for i=1:nlags,
dum1 = A^i*dum;
......@@ -126,7 +126,7 @@ else
GAM{j+1}=GAM{j+1}.*sy;
end
end
gam = vech(GAM{1});
gam = dyn_vech(GAM{1});
for j=1:nlags,
gam = [gam; vec(GAM{j+1})];
end
......
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