Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
5 changes: 1 addition & 4 deletions graphix_qasm_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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])
Expand Down
9 changes: 1 addition & 8 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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];
Expand All @@ -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
Expand Down