Home > matlab > dyn_diag_vech.m

dyn_diag_vech

PURPOSE ^

This function returns the diagonal elements of a symmetric matrix

SYNOPSIS ^

function d = dyn_diag_vech(Vector)

DESCRIPTION ^

 This function returns the diagonal elements of a symmetric matrix
 stored in vech form
 
 INPUTS 
   Vector             [double]   a m*1 vector.
    
 OUTPUTS 
   d                  [double]   a n*1 vector, where n solves n*(n+1)/2=m.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function d = dyn_diag_vech(Vector)
0002 % This function returns the diagonal elements of a symmetric matrix
0003 % stored in vech form
0004 %
0005 % INPUTS
0006 %   Vector             [double]   a m*1 vector.
0007 %
0008 % OUTPUTS
0009 %   d                  [double]   a n*1 vector, where n solves n*(n+1)/2=m.
0010 
0011 % Copyright (C) 2010 Dynare Team
0012 %
0013 % This file is part of Dynare.
0014 %
0015 % Dynare is free software: you can redistribute it and/or modify
0016 % it under the terms of the GNU General Public License as published by
0017 % the Free Software Foundation, either version 3 of the License, or
0018 % (at your option) any later version.
0019 %
0020 % Dynare is distributed in the hope that it will be useful,
0021 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0022 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0023 % GNU General Public License for more details.
0024 %
0025 % You should have received a copy of the GNU General Public License
0026 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0027 
0028 m = length(Vector);
0029 n = (sqrt(1+8*m)-1)/2;
0030 k = cumsum(1:n);
0031 d = Vector(k);

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005