Ejemplo n.º 1
0
def test_tse1(i, j):
    """ Test identity comparing TSE to B from Olbrich's talk """
    d = n_mod_m(i, j)
    indices = [[k] for k in range(i)]
    tse = TSE(d)
    x = 1 / 2 * sum(B(d, rv) / nCk(i, len(rv)) for rv in powerset(indices))
    assert tse == pytest.approx(x)
Ejemplo n.º 2
0
def test_tse1():
    """ Test identity comparing TSE to B from Olbrich's talk """
    for i, j in zip(range(3, 6), range(2, 5)):
        d = n_mod_m(i, j)
        indices = [[k] for k in range(i)]
        tse = TSE(d)
        x = 1/2 * sum(B(d, rv)/nCk(i, len(rv)) for rv in powerset(indices))
        yield assert_almost_equal, tse, x
Ejemplo n.º 3
0
def test_tse2(n):
    """ Test TSE for giant bit distributions """
    d = D(['0' * n, '1' * n], [1 / 2, 1 / 2])
    tse = TSE(d)
    assert tse == pytest.approx((n - 1) / 2)
Ejemplo n.º 4
0
def test_tse2():
    """ Test TSE for giant bit distributions """
    for n in range(2, 7):
        d = D(['0'*n, '1'*n], [1/2, 1/2])
        tse = TSE(d)
        yield assert_almost_equal, tse, (n-1)/2