pyquil icon indicating copy to clipboard operation
pyquil copied to clipboard

Add a DECLARE function to gates.py

Open karalekas opened this issue 5 years ago • 2 comments

Right now the README recommends this as the standard way to write a program:

p = Program()
p += H(0)
p += CNOT(0, 1)
ro = p.declare('ro', 'BIT', 2)
p += MEASURE(0, ro[0])
p += MEASURE(1, ro[1])
p.wrap_in_numshots_loop(10)

I can't think of any reason for us to not have a corresponding function DECLARE, seeing as we don't really need the memory reference object (we support a whole slew of types for the second argument of a MEASURE). However, it is important to note that without the object we currently will not catch index errors when trying to use the memory reference, so changes to the "recommended program" would require further thought.

karalekas avatar Sep 27 '19 17:09 karalekas

Hey @karalekas I was wondering if I could pick this issue assuming no one has already tackled it :)

Omaliano avatar Apr 04 '20 21:04 Omaliano

Hey @karalekas I was wondering if I could pick this issue assuming no one has already tackled it :)

Go for it!

braised-babbage avatar Apr 06 '20 17:04 braised-babbage