def test_hadamard_pauli_identities(self): X = qc.PauliX() Y = qc.PauliY() Z = qc.PauliZ() H = qc.Hadamard() self.assertLess(max_absolute_difference(H(X(H)), Z), epsilon) self.assertLess(max_absolute_difference(H(Z(H)), X), epsilon) self.assertLess(max_absolute_difference(H(Y(H)), -Y), epsilon) self.assertLess(max_absolute_difference(X(Y(X)), -Y), epsilon)
def test_rotations_equal_pauli(self): X = qc.PauliX() Y = qc.PauliY() Z = qc.PauliZ() Rx = qc.RotationX(np.pi) Ry = qc.RotationY(np.pi) Rz = qc.RotationZ(np.pi) self.assertLess(max_absolute_difference(1j * Rx, X), epsilon) self.assertLess(max_absolute_difference(1j * Ry, Y), epsilon) self.assertLess(max_absolute_difference(1j * Rz, Z), epsilon)
def test_pauli_identities(self): X = qc.PauliX() Y = qc.PauliY() Z = qc.PauliZ() self.assertLess(max_absolute_difference(X(Y), 1j * Z), epsilon) self.assertLess(max_absolute_difference(Y(X), -1j * Z), epsilon) self.assertLess(max_absolute_difference(Y(Z), 1j * X), epsilon) self.assertLess(max_absolute_difference(Z(Y), -1j * X), epsilon) self.assertLess(max_absolute_difference(Z(X), 1j * Y), epsilon) self.assertLess(max_absolute_difference(X(Z), -1j * Y), epsilon)