Esempio n. 1
0
 def recursion(fa, lisp, m):
     if m == 0:
          yield fa
     else:
         for i, fa2 in enumerate(lisp[0 : len(lisp) + 1 - m]):
             for el in recursion(zzx_mul(fa2, fa), list(lisp[i + 1:]), m - 1):
                 yield el
Esempio n. 2
0
 def recursion(fa, lisp, m):
     if m == 0:
         yield fa
     else:
         for i, fa2 in enumerate(lisp[0:len(lisp) + 1 - m]):
             for el in recursion(zzx_mul(fa2, fa), list(lisp[i + 1:]),
                                 m - 1):
                 yield el
def test_zzx_mul():
    assert zzx_mul([], []) == []
    assert zzx_mul([], [1]) == []
    assert zzx_mul([1], []) == []
    assert zzx_mul([1], [1]) == [1]
    assert zzx_mul([5], [7]) == [35]

    assert zzx_mul([3,0,0,6,1,2], [4,0,1,0]) == [12,0,3,24,4,14,1,2,0]
    assert zzx_mul([4,0,1,0], [3,0,0,6,1,2]) == [12,0,3,24,4,14,1,2,0]

    assert zzx_mul([2,0,0,1,7], [2,0,0,1,7]) == [4,0,0,4,28,0,1,14,49]
Esempio n. 4
0
def test_zzx_mul():
    assert zzx_mul([], []) == []
    assert zzx_mul([], [1]) == []
    assert zzx_mul([1], []) == []
    assert zzx_mul([1], [1]) == [1]
    assert zzx_mul([5], [7]) == [35]

    assert zzx_mul([3, 0, 0, 6, 1, 2],
                   [4, 0, 1, 0]) == [12, 0, 3, 24, 4, 14, 1, 2, 0]
    assert zzx_mul([4, 0, 1, 0],
                   [3, 0, 0, 6, 1, 2]) == [12, 0, 3, 24, 4, 14, 1, 2, 0]

    assert zzx_mul([2, 0, 0, 1, 7],
                   [2, 0, 0, 1, 7]) == [4, 0, 0, 4, 28, 0, 1, 14, 49]
def test_zzx_expand():
    zzx_expand([1,2,3], [1,2], [7,5,4,3]) == zzx_mul([1,2,3], zzx_mul([1,2], [7,5,4,3]))
Esempio n. 6
0
def test_zzx_expand():
    zzx_expand([1, 2, 3],
               [1, 2], [7, 5, 4, 3]) == zzx_mul([1, 2, 3],
                                                zzx_mul([1, 2], [7, 5, 4, 3]))