Quil output with writable classical memory
See original GitHub issueIs your feature request related to a use case or problem? Please describe.
In QuilOutput
, the measurement id convention returns PyQuil memory declarations that are read-only. From the PyQuil docs:
The only memory that is writeable is the region named ro, and only through MEASURE instructions.
All other memory is read-only.
This means that measurements are always empty when you run any program from QuilOutput
(unless you manually change the memory declarations and measurements).
Describe the solution you’d like
QuilOutput
to return a program with writeable memory - namely, a program with a single memory declaration called "ro"
with a number of bits equal to the number of measurements in the circuit, and all measurements writing into "ro"
.
[optional] Additional context (e.g. screenshots)
Current behavior:
import cirq
q = cirq.LineQubit(0)
circuit = cirq.Circuit(cirq.H(q), cirq.measure(q))
print(circuit.to_quil())
Output:
# Created using Cirq.
DECLARE m0 BIT[1]
H 0
MEASURE 0 m0[0]
Desired output (m0
-> ro
):
# Created using Cirq.
DECLARE ro BIT[1]
H 0
MEASURE 0 ro[0]
[optional] Describe alternatives/workarounds you’ve considered
Asking the PyQuil folks to allow additional writable memory references… 🙃
What is the urgency from your perspective for this issue? Is it blocking important work?
P2 - we should do it in the next couple of quarters
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
opened https://github.com/quantumlib/Cirq/issues/4469
Issue closed due to inactivity.