Multi-level Bloq decomposition for symbolic Bloqs
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
Start with the symbolic-width guards in Bloqs such as LessThanEqual, QROM, and CSwap, and trace how decompose_bloq() and _decompose_from_build_composite_bloq() handle decomposition. The issue gives a minimal reproduction using StatePreparationAliasSampling.from_n_coeff; run it to confirm the failure and inspect the resulting call graph. Done means symbolic subtrees expand into QREF routines with port definitions and connection wiring so GraphViz preserves their topology.
索引モデルが issue の本文から書いたものです。
説明
Description:
When you instantiate certain Bloq subclasses with Sympy symbols for register widths (e.g.)
StatePreparationAliasSampling.from_n_coeff(L, lam, precision=eps)
the call to decompose_bloq() immediately raises
DecomposeTypeError("bitsize must be a concrete value")
because each of these Bloq classes contains a guard like:
if not isinstance(self.bitsize, int):
raise DecomposeTypeError("bitsize must be a concrete value")
This affects many Bloqs (e.g. LessThanEqual, QROM, CSwap, etc.) and prevents any symbolic-parameter subtree from ever being expanded when you convert to QREF + GraphViz. All you ever see is a monolithic leaf.
There is a private _decompose_from_build_composite_bloq() that builds a CompositeBloq via the call-graph, but it still runs the same per-class guards, so it also refuses on symbolic bitsizes.
Why the “obvious” fixes don’t work
-
Centralizing dual-fallback in the QREF importer
We could catchDecomposeTypeErrorandcall _decompose_from_build_composite_bloq()instead—but that builder itself enforces the sameisinstance(bitsize, int)checks, so symbolic widths are still rejected. -
Using
from_callgraph=True
There is already abloq_to_qref(..., from_callgraph=True)path, but it only reconstructs a flat call-graph of Bloqs. It does not produce real port definitions or connection wiring in the resultingRoutineV1, soto_graphvizon that schema loses all topology.
Minimal repro
import sympy
from qualtran.bloqs.state_preparation import StatePreparationAliasSampling
L, lam, eps = sympy.symbols("L lam eps")
alias = StatePreparationAliasSampling.from_n_coeff(L, lam, precision=eps)
cb = alias.decompose_bloq() # CompositeBloq with 5 leaves
for inst in cb.bloq_instances:
inst.bloq.decompose_bloq() # always raises DecomposeTypeError
Related
MR #1643 adds a dual-fallback for numeric Bloqs, but it still fails for symbolic cases because of the per-class guards.
Tagging @mstechly
- 主要言語
- Python
- スター
- 397
- フォーク
- 127
- 平均マージ
- 2日 19時間
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
quantumlib/Qualtran のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
quantumlib/Qualtran#2007 ·
メンテナーはふだん 3 日以内に返信
-
Addition call_graph inconsistent with decomposition for registers with unequal bitsizes再び着手できるかも @rupasri118 が 56 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンkind/bug-report
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
quantumlib/Qualtran#1818 · コメント 2 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 75/100
quantumlib/Qualtran#2008 ·
メンテナーはふだん 3 日以内に返信
-
kickmix: `Circuit.reaction_depth()` materialises every op (≈ 135–170 B/op transient), limiting verifiable circuit size対応中かも @manwithacat が 27 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
quantumlib/Qualtran#1993 ·
メンテナーはふだん 3 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
quantumlib/Qualtran#1991 ·
メンテナーはふだん 3 日以内に返信
quantumlib/Qualtran の issue をすべて見る
似ている issue
-
bug game: 0100FF500E34A000 game: 0400FF500E34A001 mac packing
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
jxxghp/MoviePilot#7576 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
jbaruch/software-factory#266 ·
メンテナーはふだん 1 日以内に返信
-
cron: raise a distinct error when next_fire finds no match in its search bound (from #813 item 5)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信