function B = gauss_inverse ( A )

%*****************************************************************************80
%
%% gauss_inverse() uses Gauss elimination for the inverse of a square matrix A.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    08 January 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real A(n,n), the matrix.
%
%  Output:
%
%    real B(n,n), the inverse matrix.
%
  [ m, n ] = size ( A );

  B = [];

  if ( m ~= n )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'gauss_inverse - Fatal error!\n' );
    fprintf ( 1, '  Input matrix is not square.\n' );
    error ( 'gauss_inverse - Fatal error!' );
    return
  end

  I = eye ( n, n );

  B = gauss ( A, I );

  return
end

