BlockEncoding interface seems too permissive: register names or ordering should be defined
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start by reading the BlockEncoding interface and the LinearCombination example that uses AutoPartition, then inspect the cited commit to understand why the register guarantees changed. Decide how generic block encodings should expose system and ancilla registers and what compatibility changes that entails; done means the interface supports QSVT use with arbitrary block encodings and the resulting refactoring is addressed.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Context
I am implementing the quantum singular value transformation (QSVT) algorithm, see Lin Lin's lecture chapter 8.3 and the circuit is the following:
Figure 8.1. Circuit of quantum singular value transformation to construct $U_{P^\diamond_{Re}} \in BE_{1,m+1}(P^\diamond_{Re}(A))$, using $U_A \in BE_{1,m}(A)$.
$|0^m>$ are the ancillas of the block encoding $U_A$.
The Issue
To translate that into Qualtran, I define a class QSVT(blockEncoding) that takes a blockEncoding. It is easy to define a correct signature, for example:
bloqEnc : BlockEncoding
def signature(self):
return Signature([
Register("signal", QBit()),
Register("ancilla", QAny(self.bloqEnc.ancilla_bitsize)),
Register("system", QAny(self.bloqEnc.system_bitsize)),
])
But when implementing the build_composite_bloq(), I run into the following problem:
signal, ancilla = bb.add(controlled_rotation_bloq, target=signal, ctrl=ancilla)
ancilla, system = bb.add(bloqEnc, what_to_put_here=ancilla, what_to_put_here=system)
To make this generic, I would need either the names or ordering of the registers expected by an arbitrary block encoding. But the current BlockEncoding interface gives no guarantees about either.
I may be missing something, maybe there is a method to use bb.add correctly, but add_t and add_d don't seem to work here.
One other solution is to create a new interface, child of the BlockEncoding interface, but it seems impractical, every time someone needs to use QSVT they will need to use this other interface.
I could also impose a naming convention myself and throw an error if it is not respected, but this defeats the purpose of a general interface.
I saw that the LinearCombination bloq automatically wraps block encodings using AutoPartition. That might be the best solution, but it feels like a big overhead to do this every time we want to work with general block encodings.
I feel like the cleanest solution would be to change the BlockEncoding interface so that every block encoding must have standard system and ancilla registers (maybe a resource register as well). We know that every block encoding will have a system register and an ancilla register (except in the edge case where the matrix you are block encoding is unitary).
I also saw that this was the case before the commit 0d45c825cd2c0c8488b420cf644be40734a02185, so there must be a reason for this design choice.
The only downside I can see in changing the BlockEncoding interface is the amount of refactoring required.
- Lenguaje dominante
- Python
- Estrellas
- 397
- Forks
- 127
- Merge medio
- 2 d 22 h
- PR fusionados (30 d)
- 1
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 ·
-
Addition call_graph inconsistent with decomposition for registers with unequal bitsizesQuizá libre de nuevo @rupasri118 la tomó hace 67 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 ·
-
`ReflectionUsingPrepare.adjoint()` returns `self` for non-real `global_phase`Posiblemente ocupada @doubleMcyber la tomó hace 9 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
quantumlib/Qualtran#2009 ·
-
Classical simulation fails for a QROAM with block size 1 on one axis: 0-bit `BQUInt` breaks `Partition`Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 75/100
quantumlib/Qualtran#2008 ·
-
kickmix: `Circuit.reaction_depth()` materialises every op (≈ 135–170 B/op transient), limiting verifiable circuit sizePosiblemente ocupada @manwithacat la tomó hace 38 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
quantumlib/Qualtran#1993 ·
Todos los issues de quantumlib/Qualtran
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
521xueweihan/HelloGitHub#4729 ·
-
Relatório de erro do LinuxToysAbiertoauto-reported bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
cliproxy-quota: a tab around a credential email skips own-accounts and paced-accounts matchingAbiertoneeds-triage type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
pollen-robotics/reachy_mini_conversation_app#631 ·
Los mantenedores suelen responder en 7 días
-
stix-atlas.json: the same relationship id is used for several different mitigates relationshipsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100