[BUG] Missing `ccx` decomposition in `rebase` for `ROTATIONAL_CX` and `CLIFFORD_T`
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
- #468 di @tonycoder-hub — integrata
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 57/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 29
- Fork
- 33
- Merge medio
- 1g 22h
- PR unite (30g)
- 15
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di qBraid/pyqasm
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement error-handling program-validation
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
[FEATURE] Decompose `p`, `phaseshift` and `u1` as `rz` instead of `h; rx; h`Forse già presa @tonycoder-hub l’ha presa 2 giorni fa. Apertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
-
Move the QASM 2 printer and its branch pre-processing out of qasm2.pyForse già presa @danielgaskins l’ha presa 16 giorni fa. Apertaenhancement qasm2
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
qBraid/pyqasm#447 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] dumps() emits extern calls without a semicolon, producing unparsable QASMForse già presa @Jah-yee l’ha presa 24 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
qBraid/pyqasm#438 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di qBraid/pyqasm
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
aws-samples/sample-per-model-bedrock#639 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
awslabs/visual-asset-management-system#937 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
project-codeflare/codeflare-sdk#1195 ·
I maintainer di solito rispondono entro 1 giorno
-
Bump numpy dependencyAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
pandas-dev/pandas-stubs#2051 ·
I maintainer di solito rispondono entro 1 giorno