function is_rref_test ( )

%*****************************************************************************80
%
%% is_rref_test() tests is_rref().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    15 December 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'is_rref_test():\n' );
  fprintf ( 1, '  is_rref() reports if a matrix is in reduced row echelon format.\n' );
%
%  Zero rows must come last.
%
  A0 = [    ...
     1, 0, 0, 9, 4; ...
     0, 0, 1, 0, 8; ...
     0, 0, 0, 0, 0; ...
     0, 0, 0, 1, 0 ] ;
%
%  First nonzero must be to right of first nonzero in previous row.
%
  A1 = [ ...
    1, 0, 0, 9, 4; ...
    0, 0, 0, 1, 0; ...
    0, 0, 1, 0, 8; ...
    0, 0, 0, 0, 0 ];
%
%  First nonzero must be a 1.
%
  A2 = [    ...
    1, 0, 0, 9, 4; ...
    0, 1, 0, 2, 8; ...
    0, 0, 3, 0, 0; ...
    0, 0, 0, 0, 0 ];
%
%  First nonzero must only nonzero in its column.
%
  A3 = [    ...
    1, 0, 3, 9, 4; ...
    0, 1, 0, 2, 8; ...
    0, 0, 1, 0, 0; ...
    0, 0, 0, 0, 0 ];
%
%  RREF example.
%
  A4 = [    ...
    1, 0, 3, 0, 4; ...
    0, 1, 2, 0, 8; ...
    0, 0, 0, 1, 0; ...
    0, 0, 0, 0, 0 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix A0:\n' )
  disp ( A0 );
  fprintf ( '  is_rref(A0) = %s\n', mat2str ( is_rref(A0) ) );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix A1:\n' )
  disp ( A1 );
  fprintf ( '  is_rref(A1) = %s\n', mat2str ( is_rref(A1) ) );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix A2:\n' )
  disp ( A2 );
  fprintf ( '  is_rref(A2) = %s\n', mat2str ( is_rref(A2) ) );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix A3:\n' )
  disp ( A3 );
  fprintf ( '  is_rref(A3) = %s\n', mat2str ( is_rref(A3) ) );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix A4:\n' )
  disp ( A4 );
  fprintf ( '  is_rref(A4) = %s\n', mat2str ( is_rref(A4) ) );

  return
end

