


This function implements the unvech operator.
INPUTS
Vector [double] a m*1 vector.
OUTPUTS
Matrix [double] a n*n symetric matrix, where n solves n*(n+1)/2=m.

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