function error_frobenius = r8mat_is_orthogonal ( m, n, a )

%*****************************************************************************80
%
%% r8mat_is_orthogonal() checks whether an R8MAT is orthogonal.
%
%  Discussion:
%
%    An R8MAT is a matrix of real values.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 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:
%
%    real ERROR_FROBENIUS, the Frobenius orthogonality
%    error, which is zero if the matrix is exactly orthogonal.
%
  if ( ~ r8mat_is_square ( m, n, a ) )
    error_frobenius = Inf;
    return
  end

  b = a' * a;

  error_frobenius = r8mat_is_identity ( n, b );

  return
end
