Esempio n. 1
0
 def test_rank(self, bond_dim, cyclic):
     psi = qu.rand_matrix_product_state(
         10, bond_dim, cyclic=cyclic)
     rhoa = qu.ptr(psi, [2] * 10, [0, 1, 2, 3])
     el = qu.eigvalsh(rhoa)
     # bond_dim squared as cyclic mps is generated
     assert sum(el > 1e-12) == bond_dim ** (2 if cyclic else 1)
Esempio n. 2
0
    def test_shape(self, d_n_b_e, cyclic):
        d, n, b, e = d_n_b_e
        psi = qu.rand_matrix_product_state(n, b, d, cyclic=cyclic)
        assert psi.shape == (e, 1)

        assert_allclose(qu.expec(psi, psi), 1.0)