function error_frobenius = r8mat_is_tournament ( n, a )

%*****************************************************************************80
%
%% R8MAT_IS_TOURNAMENT checks if an R8MAT is a tournament matrix.
%
%  Discussion:
%
%    An R8MAT is a matrix of real values.
%
%    A matrix is a tournament matrix if:
%    * it is square, and
%    * it is antisymmetric: A' = -A, and
%    * the offdiagonal elements are either 1 or -1.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    08 April 2017
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, order of the matrix.
%
%    real A(N,N), the matrix.
%
%  Output:
%
%    real ERROR_FROBENIUS, the Frobenius tournament error.
%
  error_frobenius = r8mat_is_antisymmetric ( n, n, a );

  error_frobenius = error_frobenius^2;

  for i = 1 : n - 1
    for j = i + 1 : n
      error_frobenius = error_frobenius + ( abs ( a(i,j) ) - 1.0 )^2;
    end
  end

  error_frobenius = sqrt ( error_frobenius );

  return
end
