function a_ut = r8ge_to_r8ut ( m, n, a_ge )

%*****************************************************************************80
%
%% r8ge_to_r8ut() copies an R8GE matrix to an R8UT matrix.
%
%  Discussion:
%
%    The R8GE storage format is used for a general M by N matrix.  A storage 
%    space is made for each entry.  The two dimensional logical
%    array can be thought of as a vector of M*N entries, starting with
%    the M entries in the column 1, then the M entries in column 2
%    and so on.  Considered as a vector, the entry A(I,J) is then stored
%    in vector location I+(J-1)*M.
%
%    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.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 August 2015
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, N, the order of the matrix.
%
%    real A_GE(M,N), the R8GE matrix.
%
%  Output:
%
%    real A_UT(M,N), the R8UT matrix.
%
  a_ut = zeros ( m, n );

  for j = 1 : n
    for i = 1 : min ( j, m )
      a_ut(i,j) = a_ge(i,j);
    end
  end

  return
end
