From 81c60127a480e5919782ac0c64a9cd659c9f38b0 Mon Sep 17 00:00:00 2001 From: Renato Mello Date: Wed, 15 Nov 2023 09:05:51 +0400 Subject: [PATCH 1/3] remove wrong labels --- src/qibo/gates/gates.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/qibo/gates/gates.py b/src/qibo/gates/gates.py index d7c1286964..8e6801b177 100644 --- a/src/qibo/gates/gates.py +++ b/src/qibo/gates/gates.py @@ -1040,7 +1040,6 @@ def __init__(self, q0, q1): self.control_qubits = (q0,) self.target_qubits = (q1,) self.init_args = [q0, q1] - self.clifford = True self.unitary = True @property @@ -1082,7 +1081,6 @@ def __init__(self, q0, q1): self.control_qubits = (q0,) self.target_qubits = (q1,) self.init_args = [q0, q1] - self.clifford = True self.unitary = True @property @@ -1119,7 +1117,7 @@ def __init__(self, q0, q1, theta, trainable=True): self.parameters = theta self.unitary = True - if isinstance(theta, (float, int)) and (theta % (np.pi / 2)).is_integer(): + if isinstance(theta, (float, int)) and (theta % np.pi).is_integer(): self.clifford = True self.init_args = [q0, q1] @@ -2086,7 +2084,6 @@ def __init__(self, q0, q1, q2): self.control_qubits = (q0, q1) self.target_qubits = (q2,) self.init_args = [q0, q1, q2] - self.clifford = True self.unitary = True @property From f65bc73133f9e1af0297a71745d284747e85e5fe Mon Sep 17 00:00:00 2001 From: Renato Mello Date: Wed, 15 Nov 2023 09:24:10 +0400 Subject: [PATCH 2/3] tests --- tests/test_gates_gates.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_gates_gates.py b/tests/test_gates_gates.py index 4020abc97c..a3d5aac1a3 100644 --- a/tests/test_gates_gates.py +++ b/tests/test_gates_gates.py @@ -554,7 +554,7 @@ def test_csx(backend): backend.assert_allclose(final_state_decompose, target_state) assert gates.CSX(0, 1).qasm_label == "csx" - assert gates.CSX(0, 1).clifford + assert not gates.CSX(0, 1).clifford assert gates.CSX(0, 1).unitary @@ -590,7 +590,7 @@ def test_csxdg(backend): backend.assert_allclose(final_state_decompose, target_state) assert gates.CSXDG(0, 1).qasm_label == "csxdg" - assert gates.CSXDG(0, 1).clifford + assert not gates.CSXDG(0, 1).clifford assert gates.CSXDG(0, 1).unitary @@ -1098,7 +1098,7 @@ def test_toffoli(backend, applyx): backend.assert_allclose(final_state, target_state) assert gatelist[-1].qasm_label == "ccx" - assert gates.TOFFOLI(0, 1, 2).clifford + assert not gates.TOFFOLI(0, 1, 2).clifford assert gates.TOFFOLI(0, 1, 2).unitary From bfe0915f4daee56442d7c49e2cd0b9d188042799 Mon Sep 17 00:00:00 2001 From: Renato Mello Date: Wed, 15 Nov 2023 09:56:43 +0400 Subject: [PATCH 3/3] fix tests --- tests/test_gates_gates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_gates_gates.py b/tests/test_gates_gates.py index a3d5aac1a3..20d3551933 100644 --- a/tests/test_gates_gates.py +++ b/tests/test_gates_gates.py @@ -624,7 +624,7 @@ def test_cun(backend, name, params): if name in ["CRX", "CRY", "CRZ"]: theta = params["theta"] - if (theta % (np.pi / 2)).is_integer(): + if (theta % np.pi).is_integer(): assert gate.clifford else: assert not gate.clifford