def test_subsystem(self): p = qu.singlet_pairs(4) rhoab = p.ptr([2, 2, 2, 2], [0, 1]) assert qu.negativity(rhoab, [2] * 2) > 0.5 - 1e-14 rhoab = p.ptr([2, 2, 2, 2], [1, 2]) assert qu.negativity(rhoab, [2] * 2) < 1e-14 rhoab = p.ptr([2, 2, 2, 2], [2, 3]) assert qu.negativity(rhoab, [2] * 2) > 0.5 - 1e-14
def test_negativity_approx_simple(self, psi_abc, bsz): rho_ab = psi_abc.ptr(DIMS, [0, 1]) actual_neg = negativity(rho_ab, DIMS[:-1], 0) approx_neg = negativity_subsys_approx(psi_abc, DIMS, 0, 1, bsz=bsz) assert_allclose(actual_neg, approx_neg, rtol=2e-1)
def test_simple(self, qtype, bs): p = qu.bell_state(bs, qtype=qtype) assert qu.negativity(p) > 0.5 - 1e-14