[BUG] Missing `ccx` decomposition in `rebase` for `ROTATIONAL_CX` and `CLIFFORD_T`
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
- #468 của @tonycoder-hub — đã merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 57/100
Hướng nghiên cứu
Start with decomposition_rules.py and trace how rebase handles ccx, c3x, id, and p for the ROTATIONAL_CX and CLIFFORD_T bases; the issue reports that unroll retains ccx. Add regression coverage for the reported gates and run the project tests. Done when the requested gates rebase successfully and the regressions pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment
- pyqasm version: 1.3.0 (also
mainat62b012e) - Python version: 3.11.16
- OS: Ubuntu 22.04.5 LTS (WSL2)
What happened?
rebase(BasisSet.ROTATIONAL_CX) and rebase(BasisSet.CLIFFORD_T) raise RebaseError on a program with a single ccx. validate() and unroll() accept the same program, and the unrolled program still contains the ccx.
How can we reproduce the issue?
import pyqasm
from pyqasm.elements import BasisSet
module = pyqasm.loads("""OPENQASM 2.0;
include "qelib1.inc";
qreg q[3];
ccx q[0], q[1], q[2];
""")
module.validate()
module.rebase(BasisSet.ROTATIONAL_CX)
Output:
pyqasm.exceptions.RebaseError: Gate 'ccx' is not supported in the 'BasisSet.ROTATIONAL_CX set'.
The user guide says there is "complete conversion support for the BasisSet.ROTATIONAL_CX basis set". When we tried every qelib1 gate on its own, ROTATIONAL_CX rejected three of them: ccx, id, and c3x (reported as Gate 'p' is not supported). Interestingly, cswap can be rebased successfully because it is already expanded into simpler gates, whereas ccx remains as a single gate after unrolling.
What should happen?
ccx should be decomposed into both ROTATIONAL_CX and CLIFFORD_T, while c3x should be decomposed into ROTATIONAL_CX. The id gate can simply be removed in either case.
Suggestions (Optional)
The issue appears to come from missing decomposition rules in decomposition_rules.py. ccx is retained by unroll, while c3x is expanded into gates including p, which is also missing from the target basis and decomposition rules.
One possible fix is to add the missing rules for ccx, id, and p, along with support for selecting a third qubit in the decomposition rules.
We prototyped this approach. The resulting circuits match their original unitaries up to global phase, all 1,011 existing tests pass, and five new regression tests fail before the change and pass afterward.
- Ngôn ngữ chính
- Python
- Star
- 29
- Fork
- 33
- Merge trung bình
- 1 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 15
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của qBraid/pyqasm
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement error-handling program-validation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[FEATURE] Decompose `p`, `phaseshift` and `u1` as `rz` instead of `h; rx; h`Có thể đã có người làm @tonycoder-hub đã nhận 1 ngày trước. Đang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Move the QASM 2 printer and its branch pre-processing out of qasm2.pyCó thể đã có người làm @danielgaskins đã nhận 15 ngày trước. Đang mởenhancement qasm2
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
qBraid/pyqasm#447 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] dumps() emits extern calls without a semicolon, producing unparsable QASMCó thể đã có người làm @Jah-yee đã nhận 24 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
qBraid/pyqasm#438 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của qBraid/pyqasm
Issue tương tự
-
Skill submission: negative-test-first (testing discipline; PR creation is collaborator-only)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ComposioHQ/awesome-claude-skills#2398 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug converter
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
grafana/sigma-rule-deployment#435 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
datamodel-code-generator/datamodel-code-generator#5589 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Shell: serve the home app's Cookie Policy on a hard reloadCó thể đã có người làm @2001anshkaushik đã nhận hôm nay. Đang mởfeature module:ai
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
rocketride-org/rocketride-server#2899 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
GEFSv12
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100