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

   [n,n] = size(A);
   if n==1
      G = sqrt(A);
   else
      G(1:n-1,1:n-1) = CholRecur(A(1:n-1,1:n-1));
	  G(n,1:n-1)     = LTriSol(G(1:n-1,1:n-1),A(1:n-1,n))';
	  G(n,n)         = sqrt(A(n,n) - G(n,1:n-1)*G(n,1:n-1)');
   end 
