Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration with QPIC for drawing circuit diagrams #5895

Open
tanujkhattar opened this issue Sep 28, 2022 · 3 comments
Open

Add integration with QPIC for drawing circuit diagrams #5895

tanujkhattar opened this issue Sep 28, 2022 · 3 comments
Labels
area/circuits area/interop area/visualization kind/feature-request Describes new functionality triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on

Comments

@tanujkhattar
Copy link
Collaborator

Is your feature request related to a use case or problem? Please describe.
As the size of the circuits we build with Cirq increases, the ASCII style circuit diagrams do not scale very well. We also need a way to draw diagrams for publications in latex and it would be nice if Cirq users have a way to convert their cirq circuits into nice latex diagrams.

Describe the solution you'd like
QPIC is a flexible and powerful framework for drawing quantum circuit diagrams. See https://github.com/qpic/qpic for more details.

What is the urgency from your perspective for this issue? Is it blocking important work?

P1 - I need this no later than the next release (end of quarter)

@tanujkhattar tanujkhattar added the kind/feature-request Describes new functionality label Sep 28, 2022
@Dripto
Copy link
Contributor

Dripto commented Sep 28, 2022

Other options could be quantikz (https://arxiv.org/abs/1809.03842) or qcircuit, unsure if those tools have different licenses that are more amenable

@tanujkhattar
Copy link
Collaborator Author

tanujkhattar commented Sep 28, 2022

A good thing about QPIC is that it reads circuits written in an intermediate representation and then generates the corresponding latex code automatically. IIUC, other packages like quantikz / qcircuit provide packages that can be included in a latex document but there would be a non-trivial conversion from a cirq circuit object to the corresponding latex code using commands from these packages. With QPIC, we just need to worry about representing the same circuit in a much more easily human readable IR, that can potentially be tweaked by users manually as well, before passing it over to QPIC to generate the actual diagrams.

For example, we already have an integration to qcircuit, but this integration depends on first generating a cirq-style text diagram and then converting the text diagram to latex using qcircuit. See

def circuit_to_latex_using_qcircuit(

@viathor viathor added triage/discuss Needs decision / discussion, bring these up during Cirq Cynque area/circuits area/interop labels Oct 4, 2022
@tanujkhattar tanujkhattar added triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on and removed triage/discuss Needs decision / discussion, bring these up during Cirq Cynque labels Oct 12, 2022
@tanujkhattar
Copy link
Collaborator Author

From cirq sync:

  • I confirmed with the legal team that adding an integration such that we don't have a direct dependence on their codebase should be fine. This implies that we can add a method that outputs the circuit in an IR that can be consumed by QPIC without any legal implications.
  • So yes, this should be done. We should probably add this in cirq/contrib to make sure we don't have any backwards compatibility promises because of an indirect dependency on QPIC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/circuits area/interop area/visualization kind/feature-request Describes new functionality triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on
Projects
Status: No status
Status: No status
Development

No branches or pull requests

5 participants