inv @ raises on sx, sxdg, p, u, prx, gpi and gpi2

Aperta
#476 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@TheGupta2012 ci sta già lavorando.

Dal 19/11/2026.

  • #492 di @TheGupta2012 — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
compilers

Direzione di ricerca

Start by running the snippet in the issue to reproduce the ValidationError: Unsupported / undeclared QASM operation: sx, then grep for that message in the validation/unrolling code to find where a plain inv @ gate is checked. Compare that path with how inv @ ctrl(n) @ maps a gate through its U-form inverse; the fix is to route these single-qubit gates down the same conversion. Done when inv @ unrolls for sx, sxdg, p, u, prx, gpi and gpi2, with tests alongside the existing unroller tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

inv @ with no ctrl raises on several single-qubit standard gates. It raises on main too, so this isn't a regression from #459.

from pyqasm import loads
m = loads('OPENQASM 3.0;\ninclude "stdgates.inc";\nqubit[1] q;\ninv @ sx q[0];')
m.unroll()
# ValidationError: Unsupported / undeclared QASM operation: sx

Gates that raise: sx, sxdg, p, u, prx, gpi, gpi2. Gates that unroll: U, u2, id, s, t, rz.

inv @ ctrl(n) @ already handles all of these exactly through the U-form inverse, (e^{iγ}U(θ, φ, λ))† = e^{-iγ}U(-θ, -λ, -φ). One fix is to send plain inv @ on a gate with a U-form base down the same path.

Raised by @TheGupta2012 in the review of #459 (L1).

Lingua principale
Python
Stelle
29
Fork
33
Merge medio
1g 20h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di qBraid/pyqasm

Tutte le issue di qBraid/pyqasm

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.