  function x = CholTridSol(g,h,b)
%
% Pre:
%    g    n-vector with nonzero entries
%    h    n-vector
%    b    n-vector
%
% Post:
%    x    column n-vector that solves GG'x = b where
%         G = diag(g) + diag(h(2:n),-1).
%
   n = length(g);
   y = zeros(n,1);
   %Solve Gy = b
   y(1) = b(1)/g(1);
   for k=2:n
      y(k) = (b(k) - h(k)*y(k-1))/g(k);
   end
   %Solve G'x = y
   x = zeros(n,1);
   x(n) = y(n)/g(n);
   for k=n-1:-1:1
      x(k) = (y(k) - h(k+1)*x(k+1))/g(k);
   end
