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.
Using the
call_graphexample (but it applies similarly to qubit count/my_static_cost):If one defines a
Bloqwith abuild_call_graph, then callsbloq.adjoint().call_graph(), the current behaviour in Qualtran is to call for thebloq.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 originalbloq.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 ofbloq.adjoint()should always be the same as thebloq).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.