quantumlib / Qualtran

Qᴜᴀʟᴛʀᴀɴ is a Python library for expressing and analyzing Fault Tolerant Quantum algorithms.
https://qualtran.readthedocs.io/en/latest/
Apache License 2.0
134 stars 35 forks source link

Show number of controls in string representation of controlled bloq #981

Closed tanujkhattar closed 2 months ago

tanujkhattar commented 2 months ago

This is useful to visualize and analyze bloq decomposition diagrams where the decomposition may have multiple controlled-bloqs of the same subbloq but with different number of controls

For example,

image

is much more helpful than

image
fdmalone commented 2 months ago

Does it work with symbolics?

tanujkhattar commented 2 months ago

It works but doesn't look great right now

image

I can change it to C[num_controls][subbloq] and that should look nicer for symbolic expression. WDYT?

tanujkhattar commented 2 months ago

Changed, this is how it looks now

image
fdmalone commented 2 months ago

LGTM