function a_ge = r8utp_to_r8ge ( m, n, a_utp )

%*****************************************************************************80
%
%% r8utp_to_r8ge() copies an R8UTP matrix to an R8GE matrix.
%
%  Discussion:
%
%    The R8UTP storage format is appropriate for an upper triangular
%    matrix.  Only the upper triangle of the matrix is stored,
%    by successive partial columns, in an array which contains
%    (A11,A12,A22,A13,A23,A33,A14,...,AMN).
%
%    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.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 August 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, N, the order of the matrix.
%
%    real A_UTP(*), the R8UTP matrix.
%
%  Output:
%
%    real A_GE(M,N), the R8GE matrix.
%
  a_ge = zeros ( m, n );

  k = 0;
  for j = 1 : n
    for i = 1 : min ( j, m )
      k = k + 1;
      a_ge(i,j) = a_utp(k);
    end
  end

  return
end
