  function G = CholSax(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);
   s = zeros(n,1);
   for j=1:n
      s(j:n) = A(j:n,j);
	  for k=1:j-1
	     s(j:n) = s(j:n) - G(j:n,k)*G(j,k);
	  end
	  G(j:n,j) = s(j:n)/sqrt(s(j));
   end
