Пример #1
0
    def test_weyl_non_hermitian(self):
        res = weyl_polynomial_quantization('q0 p0')
        expected = QuadOperator('q0 p0', 0.5) \
            + QuadOperator('p0 q0', 0.5)
        self.assertTrue(res == expected)
        self.assertTrue(is_hermitian(res))

        res = weyl_polynomial_quantization('q0^2 p0')
        expected = QuadOperator('q0 q0 p0', 0.5) \
            + QuadOperator('p0 q0 q0', 0.5)
        self.assertTrue(res == expected)
        self.assertTrue(is_hermitian(res))
Пример #2
0
 def test_weyl_two_term_same(self):
     op = QuadOperator('q0 q0')
     res = weyl_polynomial_quantization('q0^2')
     self.assertTrue(res == op)
Пример #3
0
 def test_weyl_one_term(self):
     op = QuadOperator('q0')
     res = weyl_polynomial_quantization('q0')
     self.assertTrue(res == op)
Пример #4
0
 def test_weyl_one_term_multimode(self):
     op = QuadOperator('q0 q1 p2 p3')
     res = weyl_polynomial_quantization('q0 q1 p2 p3')
     self.assertTrue(res == op)
Пример #5
0
 def test_weyl_empty(self):
     res = weyl_polynomial_quantization('')
     self.assertTrue(res == QuadOperator.zero())