Multi-level Bloq decomposition for symbolic Bloqs
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- backend-api-design
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Python
- Estrellas
- 397
- Forks
- 127
- Merge medio
- 2 d 19 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de quantumlib/Qualtran
-
`show_bloq` not workingAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
quantumlib/Qualtran#2007 ·
Los mantenedores suelen responder en 3 días
-
Addition call_graph inconsistent with decomposition for registers with unequal bitsizesQuizá libre de nuevo @rupasri118 la tomó hace 56 días y no hay ningún pull request abierto. Abiertokind/bug-report
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
quantumlib/Qualtran#1818 · 2 comentarios ·
Los mantenedores suelen responder en 3 días
-
Dificultad 3/5 1-2 días Aptitud para principiantes 75/100
quantumlib/Qualtran#2008 ·
Los mantenedores suelen responder en 3 días
-
kickmix: `Circuit.reaction_depth()` materialises every op (≈ 135–170 B/op transient), limiting verifiable circuit sizePosiblemente ocupada @manwithacat la tomó hace 27 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
quantumlib/Qualtran#1993 ·
Los mantenedores suelen responder en 3 días
-
Windows wheel (or source) for kickmix library needed for Kaggle quantum compilation challengeAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
quantumlib/Qualtran#1991 ·
Los mantenedores suelen responder en 3 días
Todos los issues de quantumlib/Qualtran
Issues similares
-
bug game: 0100FF500E34A000 game: 0400FF500E34A001 mac packing
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
jxxghp/MoviePilot#7576 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
jbaruch/software-factory#266 ·
Los mantenedores suelen responder en 1 día
-
cron: raise a distinct error when next_fire finds no match in its search bound (from #813 item 5)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día