function value = gauss_det ( A )

%*****************************************************************************80
%
%% gauss_det() uses Gauss elimination for the determinant of a matrix A.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    08 January 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real A(n,n), the system matrix.
%    The matrix A should be square.
%
%  Output:
%
%    real value, the determinant.
%
  Ab = init ( A );

  [ m, n ] = size ( A );

  value = 1.0;

  for j = 1 : n

    [ Ab, p ] = pivot ( j );

    if ( p ~= j )
      value = - value;
    end

    value = value * Ab(j,j);

    for i = j + 1 : n
      Ab = elim ( i, j );
    end

  end

  return
end

