function ival = r8mat_is_negative ( m, n, a )

%*****************************************************************************80
%
%% R8MAT_IS_NEGATIVE checks whether an R8MAT is a negative matrix.
%
%  Discussion:
%
%    An R8MAT is a matrix of real values.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    09 April 2017
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer M, N, the row and column dimensions of 
%    the matrix.  M and N must be positive.
%
%    Input, real A(M,N), the matrix.
%
%    Output, integer IVAL:
%    -1, the matrix is not negative.
%    0, the matrix is nonpositive.
%    1, the matrix is negative.
%
  ival = 1;

  for i = 1 : m
    for j = 1 : n

      if ( 0.0 < a(i,j) )
        ival = -1;
        return
      elseif ( a(i,j) == 0.0 )
        ival = 0;
      end

    end
  end

  return
end
