function ival = r8mat_is_scalar_antidiagonal ( m, n, a )

%*****************************************************************************80
%
%% R8MAT_IS_SCALAR_ANTIDIAGONAL: R8MAT is a scalar along antidiagonals.
%
%  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 IVAL:
%    False, the matrix is not antidiagonal scalar.
%    True, the matrix is antidiagonal scalar.
%
  ival = true;

  for k = 2 : m + n
    ilo = max ( 1, k - n );
    ihi = min ( m, k - 1 );
    s = a(ilo,k-ilo);
    for i = ilo : ihi
      if ( a(i,k-i) ~= s )
        ival = false;
      end
    end
  end

  return
end
