(g, h, f, p, K)
return comp
Compute polynomial composition ``g(h)`` in ``GF(p)[x]/(f)``.

    Examples
    ========

    >>> from sympy.polys.domains import ZZ
    >>> from sympy.polys.galoistools import gf_compose_mod

    >>> gf_compose_mod(ZZ.map([3, 2, 4]), ZZ.map([2, 2, 2]), ZZ.map([4, 3]), 5, ZZ)
    [4]
Compute polynomial composition ``g(h)`` in ``GF(p)[x]/(f)``.
Compute polynomial composition g ( h ) in GF ( p ) [ x ] / ( f ) .
def gf_compose_mod(g, h, f, p, K):
    """
    Compute polynomial composition ``g(h)`` in ``GF(p)[x]/(f)``.

    Examples
    ========

    >>> from sympy.polys.domains import ZZ
    >>> from sympy.polys.galoistools import gf_compose_mod

    >>> gf_compose_mod(ZZ.map([3, 2, 4]), ZZ.map([2, 2, 2]), ZZ.map([4, 3]), 5, ZZ)
    [4]

    """
    if not g:
        return []

    comp = [g[0]]

    for a in g[1:]:
        comp = gf_mul(comp, h, p, K)
        comp = gf_add_ground(comp, a, p, K)
        comp = gf_rem(comp, f, p, K)

    return comp
def gf_compose_mod ( g , h , f , p , K ) : if not g : return [ ] comp = [ g [ 0 ] ] for a in g [ 1 : ] : comp = gf_mul ( comp , h , p , K ) comp = gf_add_ground ( comp , a , p , K ) comp = gf_rem ( comp , f , p , K ) return comp