def METHOD_NAME(mn, inverse_covariance, dof, tcontrast):
    a = np.linalg.lstsq(inverse_covariance, tcontrast.T, rcond=None)[0]
    varcope = float(tcontrast @ a)
    cope = float(tcontrast @ mn)
    if isnan(cope) or isnan(varcope) or isclose(varcope, 0) or varcope < 0:
        t = np.nan  # avoid warnings
    else:
        t = cope / np.sqrt(varcope)
    z = t2z_convert(t, dof)
    return cope, varcope, t, z