function a_rank = rref_rank ( a )

%*****************************************************************************80
%
%% rref_rank() returns the rank of a matrix, using the reduced row echelon form.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 September 2018
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real A(M,N), the matrix to be analyzed.
%
%  Output:
%
%    integer A_RANK, the estimated rank of A.
%    0 <= A_RANK <= min ( M, N ).
%
  [ a_ref, a_pivot ] = rref ( a );

  a_rank = length ( a_pivot );

  return
end

