コード例 #1
0
 def test_rand_mps_left_canonize_with_bra(self):
     n = 10
     k = MPS_rand_state(n,
                        10,
                        site_tag_id="foo{}",
                        tags='bar',
                        normalize=False)
     b = k.H
     k.left_canonize(normalize=True, bra=b)
     assert_allclose(b @ k, 1)
     p_tn = (b & k) ^ slice(0, 9)
     assert_allclose(p_tn['foo8'].data, np.eye(10), atol=1e-13)
コード例 #2
0
    def test_rand_mps_left_canonize(self):
        n = 10
        k = MPS_rand_state(n,
                           10,
                           site_tag_id="foo{}",
                           tags='bar',
                           normalize=False)
        k.left_canonize(normalize=True)

        assert k.count_canonized() == (9, 0)

        assert_allclose(k.H @ k, 1)
        p_tn = (k.H & k) ^ slice(0, 9)
        assert_allclose(p_tn['foo8'].data, np.eye(10), atol=1e-13)