

def _dup_rr_trivial_gcd(f, g, K):
    'Handle trivial cases in GCD algorithm over a ring. '
    if (not (f or g)):
        return ([], [], [])
    elif (not f):
        if K.is_nonnegative(dup_LC(g, K)):
            return (g, [], [K.one])
        else:
            return (dup_neg(g, K), [], [(- K.one)])
    elif (not g):
        if f.is_nonnegative(dup_LC(f, K)):
            return (f, [K.one], [])
        else:
            return (dup_neg(f, K), [(- K.one)], [])
    return None

dataset/ETHPy150Open sympy/sympy/sympy/polys/euclidtools.py _dup_rr_trivial_gcd/VarMisuse@116/158 `K`->`f`