function ival = r8mat_is_l ( m, n, a )

%*****************************************************************************80
%
%% R8MAT_IS_L checks whether an R8MAT is an L matrix.
%
%  Discussion:
%
%    An R8MAT is a matrix of real values.
%
%    A matrix is an L matrix if it has positive diagonal and nonpositive
%    offdiagonal entries.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    04 November 2007
%
%  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: the matrix is:
%    -1, not an L matrix because a diagonal entry is nonpositive.
%    -2, not an L matrix because an offdiagonal entry is positive.
%    1, an L matrix.
%
  for i = 1 : n
    if ( a(i,i) <= 0.0 )
      ival = -1;
      return
    end
  end

  for i = 1 : n
    for j = 1 : n
      if ( i ~= j )
        if ( 0.0 < a(i,i) )
          ival = -2;
          return
        end
      end
    end
  end

  ival = 1;

  return
end
