function x = lbi_sol ( lvec, b )

%  LBI_SOL solves a unit lower bidiagonal linear system.
%
%  function x = lbi_sol ( lvec, b )
%
%  real LVEC(2:N) is the subdiagonal entries.
%  real B(N) is the right hand side.
%
%  real X(N) is the solution.
%
%  Reference:
%
%    Charles Van Loan,
%    Introduction to Scientific Computing,
%    Prentice Hall, 1997.
%
  n = length ( b ); 
  x = zeros ( n, 1 );

  x(1) = b(1);
  for i = 2 : n
    x(i) = b(i) - lvec(i) * x(i-1);
  end
