function fnorm = r8mat_is_sparse ( m, n, a )

%*****************************************************************************80
%
%% r8mat_is_sparse() counts the proportion of nonzero entries in an R8MAT.
%
%  Discussion:
%
%    An R8MAT is a matrix of real values.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 April 2017
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, N, the row and column dimensions of 
%    the matrix.  M and N must be positive.
%
%    real A(M,N), the matrix.
%
%  Output:
%
%    integer FNORM, the number of nonzeros divided by M*N.
%
  ival = 0;

  for i = 1 : m
    for j = 1 : n
      if ( a(i,j) ~= 0.0 )
        ival = ival + 1;
      end
    end
  end

  fnorm = ival / m / n;

  return
end
