function det = r8utp_det ( m, n, a )

%*****************************************************************************80
%
%% r8utp_det() computes the determinant of a R8UTP 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).
%
%  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.
%    M and N must be equal.
%
%    real A(*), the R8UTP matrix.
%
%  Output:
%
%    real DET, the determinant of the matrix.
%
  if ( m ~= n )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'r8utp_det(): Fatal error!\n' );
    fprintf ( 1, '  m and n are not equal.\n' );
    error ( 'r8utp_det(): Fatal error!' );
  end

  det = 1.0;

  k = 1;
  for j = 1 : n
    det = det * a(k);
    k = k + j + 1;
  end

  return
end
