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

Latex renders circuits incorrectly #1455

Closed
2 tasks done
pboyle1960 opened this issue Jul 7, 2022 · 1 comment · Fixed by #1520
Closed
2 tasks done

Latex renders circuits incorrectly #1455

pboyle1960 opened this issue Jul 7, 2022 · 1 comment · Fixed by #1520
Labels
bug 🐛 An issue that needs fixing. LaTeX v4
Milestone

Comments

@pboyle1960
Copy link

pboyle1960 commented Jul 7, 2022

Pre-Report Checklist

  • I am running the latest versions of pyQuil and the Forest SDK
  • I checked to make sure that this bug has not already been reported

Issue Description

When running the code in the attached example notebook incorrect circuit renderings result.

Problem 1:
SITUATION: a 2-qubit gate acts on qubits that are not given in increasing order, such as XY(np.pi,2,1)
BUG DESCRIPTION: the gate will connect the wrong gates (see the first code snippet below).

Problem 2:
SITUATION: circuit includes CPHASE
BUG DESCRIPTION: CPHASE is not correctly represented (see the second code snippet below).

How to Reproduce

Please see the code snippets below.

Please also see notebook sandbox.ipynb in attached sandbox.zip.

Please also see attached output draw_circuit.pdf.

Code Snippets

from pyquil.quil import Pragma, Program
from pyquil.gates import CNOT, H, XY, CPHASE, I
from pyquil import latex

import numpy as np

p = Program()
p  += XY(0.1,2,1)
p +=XY(0.2,2,3)

print(p)

print(latex.to_latex(p)) 
from pyquil.quil import Pragma, Program
from pyquil.gates import CNOT, H, XY, CPHASE, I
from pyquil import latex

import numpy as np

p = Program()
p  += CPHASE(0.1,1,2)

print(p)

print(latex.to_latex(p))

sandbox.zip
draw_circuit.pdf

@pboyle1960 pboyle1960 added the bug 🐛 An issue that needs fixing. label Jul 7, 2022
@MarquessV MarquessV added v3 v4 and removed v3 labels Nov 7, 2022
@MarquessV MarquessV added this to the v4.0 milestone Nov 7, 2022
@kalzoo
Copy link
Contributor

kalzoo commented Nov 7, 2022

v4 tag because we need to ensure that this is working ahead of the v4.0.0 release

This is not what this has come to mean. We may in fact target this fix for v3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue that needs fixing. LaTeX v4
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants