Exemplo n.º 1
0
 def test_Zgate_displacement(self):
     """Test displacement vector matches Zgate"""
     z = 0.654
     H, _ = zdisplacement(z)
     _, d = quadratic_coefficients(H)
     expected = np.array([0, 1])
     assert np.allclose(d, expected)
Exemplo n.º 2
0
 def test_coefficients(self):
     """Test coefficients are correct"""
     self.logTestName()
     H, _ = zdisplacement(self.p)
     self.assertEqual(H, -QuadOperator('q0', 1))
Exemplo n.º 3
0
 def test_gaussian(self):
     """Test output is gaussian"""
     self.logTestName()
     H, _ = zdisplacement(self.p)
     res = H.is_gaussian()
     self.assertTrue(res)
Exemplo n.º 4
0
 def test_time(self):
     """Test time parameter is correct"""
     self.logTestName()
     _, r = zdisplacement(self.p)
     self.assertEqual(r, self.p)
Exemplo n.º 5
0
 def test_identity(self):
     """Test alpha=0 gives identity"""
     self.logTestName()
     _, r = zdisplacement(0)
     self.assertEqual(r, 0)
Exemplo n.º 6
0
 def test_hermitian(self):
     """Test output is hermitian"""
     self.logTestName()
     H, _ = zdisplacement(self.p)
     self.assertTrue(is_hermitian(H))
     self.assertTrue(is_hermitian(get_boson_operator(H, hbar=self.hbar)))
Exemplo n.º 7
0
 def test_coefficients(self):
     """Test coefficients are correct"""
     H, _ = zdisplacement(self.p)
     assert H == -QuadOperator('q0', 1)
Exemplo n.º 8
0
 def test_time(self):
     """Test time parameter is correct"""
     _, r = zdisplacement(self.p)
     assert r == self.p
Exemplo n.º 9
0
 def test_gaussian(self):
     """Test output is gaussian"""
     H, _ = zdisplacement(self.p)
     res = H.is_gaussian()
     assert res
Exemplo n.º 10
0
 def test_hermitian(self, hbar):
     """Test output is hermitian"""
     H, _ = zdisplacement(self.p)
     assert is_hermitian(H)
     assert is_hermitian(get_boson_operator(H, hbar=hbar))
Exemplo n.º 11
0
 def test_identity(self):
     """Test alpha=0 gives identity"""
     _, r = zdisplacement(0)
     assert r == 0