function x = r8ut_sl ( n, a, b )

%*****************************************************************************80
%
%% r8ut_sl() solves a linear system A*x=b with an R8UT matrix.
%
%  Discussion:
%
%    The R8UT storage format is used for an M by N upper triangular 
%    matrix.  The format stores all M*N entries, even those which are zero.
%
%    No factorization of the upper triangular matrix is required.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    24 January 2018
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the order of the matrix.
%
%    real A(N,N), the R8UT matrix.
%
%    real B(N,1), the right hand side.
%
%  Output:
%
%    real X(N,1), the solution vector.
%
  b = b(:);

  x(1:n,1) = b(1:n,1);

  for j = n : -1 : 1
    x(j,1) = x(j,1) / a(j,j);
    for i = 1 : j-1
      x(i,1) = x(i,1) - a(i,j) * x(j,1);
    end
  end

  return
end
