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..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 @@ -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..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 @@ -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