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

Abierto
#476 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@TheGupta2012 ya está trabajando en esto.

Desde el 19/11/2026.

  • #492 de @TheGupta2012 — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
62/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
compilers

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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).

Lenguaje dominante
Python
Estrellas
29
Forks
33
Merge medio
1 d 20 h
PR fusionados (30 d)
8

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de qBraid/pyqasm

Todos los issues de qBraid/pyqasm

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.