Exemplo n.º 1
0
def tree_test():
    n = 8
    a = [0] * n
    C1 = cosymsum(X(a, 1), X(a, 2))
    C5 = cosymsum(X(a, 5), X(a, 6))
    C4 = coproduct(X(a, 4), C5)
    C3 = cosymsum(X(a, 3), C4)
    Z = coproduct(C1, C3, X(a, 7))
    lead = cosymsum(X(a, 0), Z)
    run_test(a, lead)
Exemplo n.º 2
0
def tree_test():
    n = 8
    a = [0] * n
    C1 = cosymsum(X(a, 1), X(a, 2))
    C5 = cosymsum(X(a, 5), X(a, 6))
    C4 = coproduct(X(a, 4), C5)
    C3 = cosymsum(X(a, 3), C4)
    Z = coproduct(C1, C3, X(a, 7))
    lead = cosymsum(X(a, 0), Z)
    run_test(a, lead)
Exemplo n.º 3
0
def manual_setup_test():
    n = 6
    a = [0] * n
    lead = coproduct(cosymsum(X(a, 0), X(a, 1)),
                     X(a, 2),
                     cosymsum(X(a, 3), X(a, 4), X(a, 5)))
    run_test(a, lead)
Exemplo n.º 4
0
def setup(n, poset):
    # 0 and n + 1 will be used as the minimum and maximum
    poset = add_min_max(poset, 0, n + 1)
    pi = list(range(n + 2))
    inv = pi[:]
    coroutines = [varol_rotem_local(poset, pi, inv, i + 1) for i in range(n)]
    lead = coproduct(*coroutines)
    return lead, pi
Exemplo n.º 5
0
def setup(n, E):
    a = [0] * n
    Y = []
    for j in range(len(E) - 1):
        Z = [X(a, i) for i in range(E[j] + 1, E[j + 1] + 1)]
        Y.append(cosymsum(*Z))
    lead = coproduct(*Y)
    return a, lead
Exemplo n.º 6
0
def setup(n):
    # Start with the identity permutation with 0 padded on both sides
    # Example: for n = 4, pi starts as [0, 1, 2, 3, 4, 0]
    # The n + 1 at the beginning and end will act as "fixed barriers", never
    # moving
    pi = [n + 1] + list(range(1, n + 1)) + [n + 1]
    # The inverse permutation starts as the identity as well. It does not need
    # the fixed barriers since their inverses will never be looked up.
    inv = pi[:-1]
    # The lead coroutine will be the coroutine in charge of moving n
    coroutines = [sjt_local(pi, inv, i + 1) for i in range(n)]
    lead = coproduct(*coroutines)
    return pi, lead
Exemplo n.º 7
0
def setup(M):
    n = len(M)
    a = [0] * n
    coroutines = [multiradix_lex_local(M, a, i) for i in range(n)]
    lead = coproduct(*coroutines)
    return a, lead
Exemplo n.º 8
0
def manual_setup_test():
    n = 6
    a = [0] * n
    lead = coproduct(cosymsum(X(a, 0), X(a, 1)), X(a, 2),
                     cosymsum(X(a, 3), X(a, 4), X(a, 5)))
    run_test(a, lead)