def test_EntropyConditional(): "Entropy: Conditional entropy" # test_ S(A,B|C,D)<=S(A|C)+S(B|D) rhos = [ rand_dm(16, dims=[[2, 2, 2, 2], [2, 2, 2, 2]], pure=True) for k in range(20) ] for ABCD in rhos: AC = ptrace(ABCD, [0, 2]) BD = ptrace(ABCD, [1, 3]) assert_equal( entropy_conditional(ABCD, [2, 3]) <= (entropy_conditional(AC, 1) + entropy_conditional(BD, 1)), True) # test_ S(A|B,C)<=S(A|B) rhos = [ rand_dm(8, dims=[[2, 2, 2], [2, 2, 2]], pure=True) for k in range(20) ] for ABC in rhos: AB = ptrace(ABC, [0, 1]) assert_equal( entropy_conditional(ABC, [1, 2]) <= entropy_conditional(AB, 1), True)
def test_triangle_inequality_4_qubits(self): # S(A,B | C,D) <= S(A|C) + S(B|D) full = qutip.rand_dm(16, dims=[[2] * 4] * 2, pure=True) ac, bd = full.ptrace([0, 2]), full.ptrace([1, 3]) assert (qutip.entropy_conditional(full, [2, 3]) <= (qutip.entropy_conditional(ac, 1) + qutip.entropy_conditional(bd, 1)))
def test_EntropyConditional(): "Conditional entropy" # test_ S(A,B|C,D)<=S(A|C)+S(B|D) rhos = [rand_dm(16, dims=[[2, 2, 2, 2], [2, 2, 2, 2]], pure=True) for k in range(20)] for ABCD in rhos: AC = ptrace(ABCD, [0, 2]) BD = ptrace(ABCD, [1, 3]) assert_equal(entropy_conditional(ABCD, [2, 3]) <= ( entropy_conditional(AC, 1) + entropy_conditional(BD, 1)), True) # test_ S(A|B,C)<=S(A|B) rhos = [rand_dm(8, dims=[[2, 2, 2], [2, 2, 2]], pure=True) for k in range(20)] for ABC in rhos: AB = ptrace(ABC, [0, 1]) assert_equal(entropy_conditional( ABC, [1, 2]) <= entropy_conditional(AB, 1), True)
def test_inequality_3_qubits(self): # S(A | B,C) <= S(A|B) full = qutip.rand_dm(8, dims=[[2] * 3] * 2, pure=True) ab = full.ptrace([0, 1]) assert (qutip.entropy_conditional(full, [1, 2]) <= qutip.entropy_conditional(ab, 1))