def test_Xgate_displacement(self): """Test displacement vector matches Xgate""" x = 0.1234 H, _ = xdisplacement(x) _, d = quadratic_coefficients(H) expected = np.array([1, 0]) assert np.allclose(d, expected)
def test_gaussian(self): """Test output is gaussian""" self.logTestName() H, _ = xdisplacement(self.x) res = H.is_gaussian() self.assertTrue(res)
def test_identity(self): """Test alpha=0 gives identity""" self.logTestName() _, r = xdisplacement(0) self.assertEqual(r, 0)
def test_hermitian(self): """Test output is hermitian""" self.logTestName() H, _ = xdisplacement(self.x) self.assertTrue(is_hermitian(H)) self.assertTrue(is_hermitian(get_boson_operator(H, hbar=self.hbar)))
def test_time(self): """Test time parameter is correct""" self.logTestName() _, r = xdisplacement(self.x) self.assertEqual(r, self.x)
def test_coefficients(self): """Test coefficients are correct""" self.logTestName() H, _ = xdisplacement(self.x) self.assertEqual(H, QuadOperator('p0', 1))
def test_coefficients(self): """Test coefficients are correct""" H, _ = xdisplacement(self.x) assert H == QuadOperator('p0', 1)
def test_time(self): """Test time parameter is correct""" _, r = xdisplacement(self.x) assert r == self.x
def test_gaussian(self): """Test output is gaussian""" H, _ = xdisplacement(self.x) res = H.is_gaussian() assert res
def test_hermitian(self, hbar): """Test output is hermitian""" H, _ = xdisplacement(self.x) assert is_hermitian(H) assert is_hermitian(get_boson_operator(H, hbar=hbar))
def test_identity(self): """Test alpha=0 gives identity""" _, r = xdisplacement(0) assert r == 0