code: def _Q(A):
      """Twice the number of discordant pairs, excluding ties."""
      # See [2] bottom of page 309
      m, n = A.shape
      count = 0
      for i in range(m):
          for j in range(n):
              count += A[i, j] * _Dij(A, i, j)
      return count
  
imports: from collections import namedtuple
  from dataclasses import make_dataclass
  import numpy
  import warnings
  from itertools import combinations
  import scipy.stats
  from scipy.optimize import shgo
  from .None import distributions
  from ._continuous_distns import chi2, norm
  from scipy.special import gamma, kv, gammaln
  from .None import _wilcoxon_data
label_desc: Use image node_id 10 for calling a global function with example usage: _Q(A) and returns: count