(f, s, K)
return dup_from_raw_dict(g, K)
Helper function for :func:`_dup_decompose`.
Helper function for :func:`_dup_decompose`.
Helper function for : func : _dup_decompose .
def _dup_right_decompose(f, s, K):
    """Helper function for :func:`_dup_decompose`."""
    n = len(f) - 1
    lc = dup_LC(f, K)

    f = dup_to_raw_dict(f)
    g = { s: K.one }

    r = n // s

    for i in xrange(1, s):
        coeff = K.zero

        for j in xrange(0, i):
            if not n + j - i in f:
                continue

            if not s - j in g:
                continue

            fc, gc = f[n + j - i], g[s - j]
            coeff += (i - r*j)*fc*gc

        g[s - i] = K.quo(coeff, i*r*lc)

    return dup_from_raw_dict(g, K)
def _dup_right_decompose ( f , s , K ) : n = len ( f ) - 1 lc = dup_LC ( f , K ) f = dup_to_raw_dict ( f ) g = { s : K . one } r = n // s for i in xrange ( 1 , s ) : coeff = K . zero for j in xrange ( 0 , i ) : if not n + j - i in f : continue if not s - j in g : continue fc , gc = f [ n + j - i ] , g [ s - j ] coeff += ( i - r * j ) * fc * gc g [ s - i ] = K . quo ( coeff , i * r * lc ) return dup_from_raw_dict ( g , K )