def test_block2_upscale(self): p = bell_state('phi+') & bell_state('phi+') ecm = ent_cross_matrix(p, ent_fn=logneg, calc_self_ent=False, sz_blc=2) assert ecm.shape == (2, 2) ecm = ent_cross_matrix(p, ent_fn=logneg, calc_self_ent=False, sz_blc=2, upscale=True) assert ecm.shape == (4, 4)
def test_shapes_and_blocks(self, sz_blc, sz_p, calc_self_ent): if sz_p // sz_blc > 0: p = qu.rand_rho(2**sz_p) n = sz_p // sz_blc ecm = qu.ent_cross_matrix(p, sz_blc, calc_self_ent=calc_self_ent) assert ecm.shape[0] == n if not calc_self_ent: assert_allclose(np.diag(ecm), [np.nan] * n, equal_nan=True)
def test_block2_no_self_ent(self): p = qu.bell_state('phi+') & qu.bell_state('phi+') ecm = qu.ent_cross_matrix(p, ent_fn=qu.logneg, calc_self_ent=False, sz_blc=2) assert_allclose(ecm[0, 1], 0) assert_allclose(ecm[0, 0], np.nan) assert_allclose(ecm[1, 0], 0)
def test_block2(self): p = qu.bell_state('phi+') & qu.bell_state('phi+') ecm = qu.ent_cross_matrix(p, ent_fn=qu.logneg, sz_blc=2) assert_allclose(ecm[1, 1], 0) assert_allclose(ecm[0, 1], 0) assert_allclose(ecm[1, 0], 0)
def test_bell_state_no_self_ent(self): p = qu.bell_state('phi+') ecm = qu.ent_cross_matrix(p, ent_fn=qu.concurrence, calc_self_ent=False) assert_allclose(ecm, [[np.nan, 1], [1, np.nan]])
def test_bell_state(self): p = qu.bell_state('phi+') ecm = qu.ent_cross_matrix(p, ent_fn=qu.concurrence, calc_self_ent=True) assert_allclose(ecm, [[1, 1], [1, 1]])