function r8ge_inverse_test ( )

%*****************************************************************************80
%
%% r8ge_inverse_test() tests r8ge_inverse().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 March 2009
%
%  Author:
%
%    John Burkardt
%
  n = 4;
  x = 2.0;
  y = 3.0;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8ge_inverse_test():\n' );
  fprintf ( 1, '  r8ge_inverse() computes the inverse of an R8GE matrix.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix order N = %d\n', n );
%
%  Set the matrix.
%
  for j = 1 : n
    for i = 1 : n
      if ( i == j )
        a(i,i) = x + y;
      else
        a(i,j) = y;
      end
    end
  end

  r8ge_print ( n, n, a, '  Matrix A:' );
%
%  Factor and invert the matrix.
%
  [ a_lu, pivot, info ] = r8ge_fa ( n, a );

  if ( info ~= 0 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'TEST35 - Fatal error!\n' );
    fprintf ( 1, '  R8GE_FA reports the matrix is singular.\n' );
    return
  end

  a_inverse = r8ge_inverse ( n, a_lu, pivot );

  r8ge_print ( n, n, a_inverse, '  Inverse matrix B:' );
%
%  Check.
%
  c = r8ge_mm ( n, n, n, a, a_inverse );

  r8ge_print ( n, n, c, '  Product matrix:' );

  return
end
