pyquil icon indicating copy to clipboard operation
pyquil copied to clipboard

Memory Declaration are sometimes moved to the top of the program

Open bramathon opened this issue 2 years ago • 2 comments

from pyquil.quil import Program

print(Program("DEFGATE DDXX_184:\n    1.0, 0.0\n    0.0, 1.0\n\nDDXX_184 2\nCPHASE(0.1) 0 1\nDECLARE ro BIT[3]\nMEASURE 0 ro[0]\nMEASURE 1 ro[1]\nMEASURE 2 ro[2]\n").out())

Yields:

DECLARE ro BIT[3]
DEFGATE DDXX_184 AS MATRIX:
	1, 0
	0, 1

DDXX_184 2
CPHASE(0.1) 0 1
MEASURE 0 ro[0]
MEASURE 1 ro[1]
MEASURE 2 ro[2]

Possibly related to #1666

bramathon avatar Sep 22 '23 15:09 bramathon

For now at least, this is intended behavior on the part of quil-rs.

MarquessV avatar Sep 22 '23 17:09 MarquessV

The problem here is that this seems to be non-deterministic. Sometimes the declarations are at the top, sometimes they are not.

bramathon avatar Oct 11 '23 12:10 bramathon