function rref_compute_test ( )

%*****************************************************************************80
%
%% rref_compute_test() tests rref_compute().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 December 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'rref_compute_test():\n' );
  fprintf ( 1, '  rref_compute() is a user-written code to compute the\n' );
  fprintf ( 1, '  reduced row echelon form (RREF) of a matrix.\n' );
  fprintf ( 1, '  Compare it to MATLAB''s built-in version.\n' );

  A = [ ...
     1,  3,  0,  2,  6,  3,  1; ...
    -2, -6,  0, -2, -8,  3,  1; ...
     3,  9,  0,  0,  6,  6,  2; ...
    -1, -3,  0,  1,  0,  9,  3 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix A:\n' );
  disp ( A );

  [ A1, a_cols ] = rref_compute ( A );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  rref_compute(A):\n' );
  disp ( A1 );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Independent column indices:\n' );
  disp ( a_cols );

  [ A2, a_cols ] = rref ( A );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  rref(A) (MATLAB built-in code):\n' );
  disp ( A2 );

  return
end

