def _mahal(self, u, v):
    "\n        gets the mahalanobis distance between two vectors u and v\n        a blatant copy of the Mathworks fcn as it doesn't require the\n        covariance matrix to be calculated which is a pain if there\n        are NaNs in the matrix\n        "
    u_sz = u.shape
    v_sz = v.shape
    if (u_sz[1] != v_sz[1]):
        warnings.warn('Input size mismatch: matrices must have same num of columns')
    if (v_sz[0] < v_sz[1]):
        warnings.warn('Too few rows: v must have more rows than columns')
    if (np.any(np.imag(u)) or np.any(np.imag(v))):
        warnings.warn('No complex inputs are allowed')
    m = np.nanmean(v, axis=0)
    M = np.tile(m, reps=(u_sz[0], 1))
    C = (v - np.tile(m, reps=(v_sz[0], 1)))
    (_, R) = np.linalg.qr(C)
    ri = np.linalg.solve(R.T, (u - M).T)
    d = (np.sum((ri * ri), 0).T * (v_sz[0] - 1))
    return d
gets the mahalanobis distance between two vectors u and v
a blatant copy of the Mathworks fcn as it doesn't require the
covariance matrix to be calculated which is a pain if there
are NaNs in the matrix
def _mahal(self, u, v):
    "\n        gets the mahalanobis distance between two vectors u and v\n        a blatant copy of the Mathworks fcn as it doesn't require the\n        covariance matrix to be calculated which is a pain if there\n        are NaNs in the matrix\n        "
    u_sz = u.shape
    v_sz = v.shape
    if (u_sz[1] != v_sz[1]):
        warnings.warn('Input size mismatch: matrices must have same num of columns')
    if (v_sz[0] < v_sz[1]):
        warnings.warn('Too few rows: v must have more rows than columns')
    if (np.any(np.imag(u)) or np.any(np.imag(v))):
        warnings.warn('No complex inputs are allowed')
    m = np.nanmean(v, axis=0)
    M = np.tile(m, reps=(u_sz[0], 1))
    C = (v - np.tile(m, reps=(v_sz[0], 1)))
    (_, R) = np.linalg.qr(C)
    ri = np.linalg.solve(R.T, (u - M).T)
    d = (np.sum((ri * ri), 0).T * (v_sz[0] - 1))
    return d