Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rzz qasm string in qasm converter #679

Merged
merged 7 commits into from
Dec 8, 2022
Merged
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
2 changes: 1 addition & 1 deletion pytket/docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Fixes:

* Warn rather than abort when significant rounding errors are detected in
TK2-to-CX rebase.

* Fix incorrect QASM output for ``OpType.CopyBits``.
* Fix incorrect QASM read in ``OpType.ZZPhase``.

1.9.0 (November 2022)
---------------------
Expand Down
1 change: 1 addition & 0 deletions pytket/pytket/qasm/qasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class QASMUnsupportedError(Exception):
"rxx": OpType.XXPhase,
"ry": OpType.Ry,
"rz": OpType.Rz,
"RZZ": OpType.ZZPhase,
"rzz": OpType.ZZPhase,
"Rz": OpType.Rz,
"U1q": OpType.PhasedX,
Expand Down
17 changes: 16 additions & 1 deletion pytket/tests/qasm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
_load_gdict,
)
from pytket.transform import Transform # type: ignore
from pytket.passes import DecomposeClassicalExp # type: ignore
from pytket.passes import DecomposeClassicalExp, DecomposeBoxes # type: ignore

curr_file_path = Path(__file__).resolve().parent

Expand Down Expand Up @@ -661,6 +661,21 @@ def test_CopyBits() -> None:
assert result_circ_qasm == correct_qasm


def test_RZZ_read_from() -> None:
c = circuit_from_qasm_str(
"""
OPENQASM 2.0;
include "hqslib1.inc";

qreg q[2];
RZZ(0.5*pi) q[0],q[1];
"""
)
DecomposeBoxes().apply(c)
assert "RZZ(0.5*pi) q[0],q[1];" in circuit_to_qasm_str(c, header="hqslib1")
assert "rzz(0.5*pi) q[0],q[1];" in circuit_to_qasm_str(c)


if __name__ == "__main__":
test_qasm_correct()
test_qasm_qubit()
Expand Down