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)
def test_coefficients(self): """Test coefficients are correct""" self.logTestName() H, _ = zdisplacement(self.p) self.assertEqual(H, -QuadOperator('q0', 1))
def test_gaussian(self): """Test output is gaussian""" self.logTestName() H, _ = zdisplacement(self.p) res = H.is_gaussian() self.assertTrue(res)
def test_time(self): """Test time parameter is correct""" self.logTestName() _, r = zdisplacement(self.p) self.assertEqual(r, self.p)
def test_identity(self): """Test alpha=0 gives identity""" self.logTestName() _, r = zdisplacement(0) self.assertEqual(r, 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)))
def test_coefficients(self): """Test coefficients are correct""" H, _ = zdisplacement(self.p) assert H == -QuadOperator('q0', 1)
def test_time(self): """Test time parameter is correct""" _, r = zdisplacement(self.p) assert r == self.p
def test_gaussian(self): """Test output is gaussian""" H, _ = zdisplacement(self.p) res = H.is_gaussian() assert res
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))
def test_identity(self): """Test alpha=0 gives identity""" _, r = zdisplacement(0) assert r == 0