function rref_rank_test ( )

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

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

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

  a_rank = rref_rank ( A );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  A has rank %d\n', a_rank );

  fprintf ( 1, '  MATLAB rank estimate is %d\n', rank ( A ) );

  return
end

