function G = CholDot(A);
%
% Pre:  A is a symmetric and positive definite matrix.
% Post: G is lower triangular and A = G*G'.

   [n,n] = size(A);
   G = zeros(n,n);
   for i=1:n
      % Compute G(i,1:i)
      for j=1:i
	     if j==1
	        s = A(j,i);
	     else
		    s = A(j,i) - G(j,1:j-1)*G(i,1:j-1)';
		 end
		 if j<i
		    G(i,j) = s/G(j,j);
	     else
	        G(i,i) = sqrt(s);
		 end
	  end
   end

