rigetti / pyquil

A Python library for quantum programming using Quil.
http://docs.rigetti.com
Apache License 2.0
1.4k stars 341 forks source link

Add functionality to auto-generate Quantum Circuit diagrams for a pyQuil program #33

Closed jotterbach closed 6 years ago

jotterbach commented 7 years ago

Having a simple function call to generate and visualize the Quantum Circuits that are created from a pyQuil instruction set is useful for several reasons:

vontell commented 7 years ago

I was also thinking that this would be a great idea; furthermore, it might be useful to have a plugin for popular Python IDEs such as PyCharm which would let you construct the circuit graphically (i.e. a drag and drop interface) while the pyQuil instructions are generated automatically (which is the requested feature in reverse, so this may belong in another issue).

stylewarning commented 7 years ago

I don't think it's a bad idea necessarily, however, I will note the following:

  1. General Quil programs don't fit into the "circuit diagram" mantra.
  2. Quil should be programmed and communicated by writing Quil, not by drawing pictures.
  3. Circuit diagrams tend to be pretty useless beyond 3-4 qubits.
  4. Circuit diagrams will not capture any classical processing in a hybrid classical/quantum computation, like VQE.

Basically, the subtext of all of the above is that we should move away from, not closer to, programming graphically. But understandably every textbook and paper on quantum computation uses these diagrams, so it may have some value.

stevenheidel commented 6 years ago

You could use something like this: https://github.com/CQuIC/qcircuit/

marcusps commented 6 years ago

QPIC could also be used https://github.com/qpic/qpic

Travis-S commented 6 years ago

In reading the documentation for QPIC, it supports more useful functionality (such as adding text in places and sizing things). Because it is more powerful than qcircuit, it is probably going to be of more utility to you all.

If you end up going with qcircuit and have suggestions for improvements on our end, we could work with you to fold those into the package as appropriate.

stevenheidel commented 6 years ago

If someone contributed a patch or even just an initial sketch of qcircuit we would probably use that. I'd love to work on this myself but probably won't get around to it for a few weeks or so.