Beispiel #1
0
def test_data_processing_inequality_wyner(dist):
    """
    given X - Y - Z:
        C(X:Z) <= C(X:Y)
    """
    c_xy = C(dist, [[0], [1]])
    c_xz = C(dist, [[0], [2]])
    assert c_xz <= c_xy + 10 * epsilon
def test_cis2(dist):
    """
    Test that the common informations are ordered correctly.
    """
    k = K(dist)
    j = J(dist)
    b = B(dist)
    c = C(dist)
    g = G(dist)
    f = F(dist)
    m = M(dist)
    assert k <= j + epsilon
    assert j <= b + epsilon
    assert b <= c + epsilon
    assert c <= g + epsilon
    assert g <= f + epsilon
    assert f <= m + epsilon
def test_wci1(rvs, crvs, val):
    """
    Test against known values.
    """
    c = C(xor, rvs, crvs)
    assert float(c) == pytest.approx(val, abs=1e-4)