Exemplo n.º 1
0
 def test_bell_state(self):
     p = qu.bell_state('psi-')
     assert_allclose(qu.schmidt_gap(p, [2, 2], 0), 0.0)
     p = qu.up() & qu.down()
     assert_allclose(qu.schmidt_gap(p, [2, 2], 0), 1.0)
     p = qu.rand_ket(2**3)
     assert 0 < qu.schmidt_gap(p, [2] * 3, sysa=[0, 1]) < 1.0
Exemplo n.º 2
0
 def test_bell_state(self):
     p = bell_state('psi-')
     assert_allclose(schmidt_gap(p, [2, 2], 0), 0.0)
     p = up() & down()
     assert_allclose(schmidt_gap(p, [2, 2], 0), 1.0)
     p = rand_ket(2**3)
     assert 0 < schmidt_gap(p, [2] * 3, sysa=[0, 1]) < 1.0
Exemplo n.º 3
0
    def test_schmidt_values_entropy_gap_simple(self):
        n = 12
        p = MPS_rand_state(n, 16)
        p.right_canonize()
        svns = []
        sgs = []
        for i in range(1, n):
            sgs.append(p.schmidt_gap(i, current_orthog_centre=i - 1))
            svns.append(p.entropy(i, current_orthog_centre=i))

        pd = p.to_dense()
        ex_svns = [entropy_subsys(pd, [2] * n, range(i)) for i in range(1, n)]
        ex_sgs = [schmidt_gap(pd, [2] * n, range(i)) for i in range(1, n)]
        assert_allclose(ex_svns, svns)
        assert_allclose(ex_sgs, sgs)