%
%  Function to restore a vector in upper triangular part of 
%  a matrix X of size nx x nx, Stores zero in all remaining 
%  elements.
%
function X = rtri(vx,nx)
   X = zeros(nx,nx);
   k = 1;
   for i=1:nx
      for j = i:nx
         X(i,j) = vx(k);
	 k = k + 1;
      end
   end
end
