pyquil
pyquil copied to clipboard
Add a DECLARE function to gates.py
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.
Hey @karalekas I was wondering if I could pick this issue assuming no one has already tackled it :)
Hey @karalekas I was wondering if I could pick this issue assuming no one has already tackled it :)
Go for it!