function rref_inverse_test ( )

%*****************************************************************************80
%
%% rref_inverse_test() tests rref_inverse().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    06 December 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'rref_inverse_test():\n' );
  fprintf ( 1, '  rref_inverse() uses the reduced row echelon form \n' );
  fprintf ( 1, '  of a square matrix to compute its inverse.\n' );

  n = 4;

  A = [ ...
     5,  7,  6,  5; ...
     7, 10,  8,  7; ...
     6,  8, 10,  9; ...
     5,  7,  9, 10 ];
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix A:\n' );
  disp ( A );

  a_inv = rref_inverse ( A );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Estimated inverse of A, A_inv:\n' );
  disp ( a_inv );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  MATLAB inverse of A:\n' );
  disp ( inv ( A ) );

  p = a_inv * A;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Product A_inv * A:\n' );
  disp ( p );

  return
end

