pyquil icon indicating copy to clipboard operation
pyquil copied to clipboard

DEFCIRCUIT cannot parse a definition on fixed qubits

Open mhodson-rigetti opened this issue 1 year ago • 0 comments

Pre-Report Checklist

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

Issue Description

The following pyquil program parses OK:

DEFCIRCUIT SX_CYCLE:
    RX(pi/2) 1
    RX(pi/2) 2
    RX(pi/2) 4
    RX(pi/2) 5

However, the following variant does not parse:

DEFCIRCUIT SX_CYCLE 1 2 4 5:
    RX(pi/2) 1
    RX(pi/2) 2
    RX(pi/2) 4
    RX(pi/2) 5

The error is:

PyProgramError: error while parsing: at line 1, column 1 (COMMAND(DEFCIRCUIT)): failed to parse arguments for DEFCIRCUIT

According to the the Quil spec a DEFCIRCUIT should support numeric qubit identifiers in this context. Labels are supported, but in this instance we're trying to define a circuit that is equivalent to a DEFCAL on specific qubits.

The following version works but would allow use on sites other than (1, 2, 4, 5):

DEFCIRCUIT SX_CYCLE q0 q1 q2 q3:
    RX(pi/2) q0
    RX(pi/2) q1
    RX(pi/2) q2
    RX(pi/2) q3

Environment Context

Operating System: Ubuntu LTS 20.04.3

Python Version (python -V): 3.10.12

Quilc Version (quilc --version): 1.26.0 (docker)

QVM Version (qvm --version): Latest (docker)

PyQuil version: 4.6.2

mhodson-rigetti avatar Feb 26 '24 01:02 mhodson-rigetti