[Performance] Resource counting for a bloq.adjoint() needs a bloq decomposition even when my_static_cost or build_call_graph is implemented for the bloq

Abierto
#1,841 2 comentarios 0 reacciones 0 asignados Ver en GitHub

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
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
python

Línea de trabajo

Read the Bloq APIs for build_call_graph, my_static_cost, and adjoint(), then trace how bloq.adjoint().call_graph() and qubit counting currently obtain their results. Define and check the intended behavior for adjoints, including the measurement-based uncomputing caveat; the issue also notes controlled Bloqs as a related case. Done means the supported behavior is decided and implemented with coverage for call graphs and static cost.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Using the call_graph example (but it applies similarly to qubit count/my_static_cost):

If one defines a Bloq with a build_call_graph, then calls bloq.adjoint().call_graph(), the current behaviour in Qualtran is to call for the bloq.adjoint() decomposition, which can, especially when working with big circuit, lead to performance issue.

However with most Bloq, the call_graph of bloq.ajdoint() is simply the "adjoint of the original bloq.call_graph()" ie, the original bloq.call_graph() with every element replace by its adjoint.
Do you think it is possible to get bloq.adjoint() call_graph to be the adjoint of the call_graph by default or via an optional argument ?
This could obviously raise issue in situation where the adjoint is very different (for example when doing measurement based uncomputing), which is why it should probably remain optional.

The same problem arise when using my_static_cost, for example when estimating qubit count, (and in this case, I believe the qubit count of bloq.adjoint() should always be the same as the bloq).

There is a similar issue when using bloq.controlled(), however this one is probably more complex.

Currently the solution I am using is to create a wrapper bloq for the adjoint version, but it does involve a lot of verbose which would be nice to avoid.

Let me know what you think.

Lenguaje dominante
Python
Estrellas
397
Forks
127
Merge medio
2 d 19 h
PR fusionados (30 d)
4

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de quantumlib/Qualtran

Todos los issues de quantumlib/Qualtran

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.