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

オープン
#476 コメント 0 件 リアクション 0 件 担当者 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時間
マージ済み PR(30日)
8

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

qBraid/pyqasm のほかの issue

qBraid/pyqasm の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。