예제 #1
0
파일: test_core.py 프로젝트: zizai/quimb
 def test_entangled_permute(self):
     dims = [2, 2, 2]
     a = qu.bell_state(0) & qu.up()
     assert_allclose(qu.mutinf_subsys(a, dims, 0, 1), 2.)
     b = qu.permute(a, dims, [1, 2, 0])
     assert_allclose(qu.mutinf_subsys(b, dims, 0, 1), 0., atol=1e-12)
     assert_allclose(qu.mutinf_subsys(b, dims, 0, 2), 2.)
예제 #2
0
 def test_mutinf_subsys_pure(self):
     p = rand_ket(2**7)
     dims = (2**3, 2**4)
     # exact
     mi0 = mutual_information(p, dims, sysa=0)
     mi1 = mutinf_subsys(p, dims, sysa=0, sysb=1, approx_thresh=1e30)
     assert_allclose(mi1, mi0)
     # approx
     mi2 = mutinf_subsys(p, dims, sysa=0, sysb=1, approx_thresh=1)
     assert_allclose(mi1, mi2, rtol=5e-2)
예제 #3
0
파일: test_calc.py 프로젝트: zeta1999/quimb
 def test_mutinf_subsys(self):
     p = qu.rand_ket(2**9)
     dims = (2**3, 2**2, 2**4)
     # exact
     rho_ab = qu.ptr(p, dims, [0, 2])
     mi0 = qu.mutual_information(rho_ab, [8, 16])
     mi1 = qu.mutinf_subsys(p, dims, sysa=0, sysb=2, approx_thresh=1e30)
     assert_allclose(mi1, mi0)
     # approx
     mi2 = qu.mutinf_subsys(p, dims, sysa=0, sysb=2, approx_thresh=1)
     assert_allclose(mi1, mi2, rtol=0.1)