From 255a4c094669a22c7d14b8a09ee21bb1d514b56c Mon Sep 17 00:00:00 2001 From: clebrin Date: Wed, 17 Jun 2026 09:16:52 +0200 Subject: [PATCH 1/2] Remove crz gate --- README.md | 1 - graphix_qasm_parser/parser.py | 3 --- tests/test_parser.py | 7 ------- 3 files changed, 11 deletions(-) diff --git a/README.md b/README.md index 2571c18..6b9c8a4 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,6 @@ circuit = parser.parse_file("my_circuit.qasm") | OpenQASM gate | Graphix instruction | |------------------------------------------------------------------|---------------------| | [ccx](https://openqasm.com/language/standard_library.html#ccx) | CCX | -| [crz](https://openqasm.com/language/standard_library.html#crz) | RZZ | | [cx](https://openqasm.com/language/standard_library.html#cx) | CNOT | | [swap](https://openqasm.com/language/standard_library.html#swap) | SWAP | | [cz](https://openqasm.com/language/standard_library.html#cz) | CZ | diff --git a/graphix_qasm_parser/parser.py b/graphix_qasm_parser/parser.py index 11cdbcf..320ff7c 100644 --- a/graphix_qasm_parser/parser.py +++ b/graphix_qasm_parser/parser.py @@ -324,9 +324,6 @@ def visitGateCallStatement(self, ctx: qasm3Parser.GateCallStatementContext) -> N if gate == "ccx": # https://openqasm.com/language/standard_library.html#ccx instruction = CCX(target=operands[2], controls=(operands[0], operands[1])) - elif gate == "crz": - # https://openqasm.com/language/standard_library.html#crz - instruction = RZZ(target=operands[1], control=operands[0], angle=rad_to_angle(exprs[0])) elif gate == "cx": # https://openqasm.com/language/standard_library.html#cx instruction = CNOT(target=operands[1], control=operands[0]) diff --git a/tests/test_parser.py b/tests/test_parser.py index 7dee2ae..5e89c9c 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -85,7 +85,6 @@ def test_parse_all_instructions() -> None: # noqa: PLR0915 include "qelib1.inc"; qubit[3] q; ccx q[0], q[1], q[2]; -crz(pi/3) q[0], q[1]; cx q[0], q[1]; swap q[0], q[1]; // cz q[0], q[1]; @@ -107,12 +106,6 @@ def test_parse_all_instructions() -> None: # noqa: PLR0915 assert instruction.target == 2 assert instruction.controls == (0, 1) instruction = next(iterator) - assert isinstance(instruction, RZZ) - assert instruction.target == 1 - assert instruction.control == 0 - assert isinstance(instruction.angle, float) - assert math.isclose(instruction.angle, ANGLE_PI / 3) - instruction = next(iterator) assert isinstance(instruction, CNOT) assert instruction.target == 1 assert instruction.control == 0 From 5e73aa94f10d683212e718013b91063e8011fa22 Mon Sep 17 00:00:00 2001 From: clebrin Date: Wed, 17 Jun 2026 09:32:06 +0200 Subject: [PATCH 2/2] Remove unused RZZ import --- graphix_qasm_parser/parser.py | 2 +- tests/test_parser.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graphix_qasm_parser/parser.py b/graphix_qasm_parser/parser.py index 320ff7c..1cdaf86 100644 --- a/graphix_qasm_parser/parser.py +++ b/graphix_qasm_parser/parser.py @@ -13,7 +13,7 @@ ParserRuleContext, ) from graphix import Circuit -from graphix.instruction import CCX, CNOT, RX, RY, RZ, RZZ, SWAP, H, I, S, X, Y, Z +from graphix.instruction import CCX, CNOT, RX, RY, RZ, SWAP, H, I, S, X, Y, Z from openqasm_parser import qasm3Lexer, qasm3Parser, qasm3ParserVisitor # override introduced in Python 3.12 diff --git a/tests/test_parser.py b/tests/test_parser.py index 5e89c9c..57f4266 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING import pytest -from graphix.instruction import CCX, CNOT, RX, RY, RZ, RZZ, SWAP, H, S, X, Y, Z +from graphix.instruction import CCX, CNOT, RX, RY, RZ, SWAP, H, S, X, Y, Z from graphix_qasm_parser import OpenQASMParser