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

未关闭
#476 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@TheGupta2012 已经在做这个了。

开始于 2026年11月19日。

  • #492 来自 @TheGupta2012 —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
62/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
compilers

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Python
星标
29
派生
33
平均合并
1 天 20 小时
30 天内合并 PR
8

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

qBraid/pyqasm 的其他 Issue

查看 qBraid/pyqasm 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。