Jan-25-2021, 10:47 PM
(Jan-25-2021, 10:16 PM)bowlofred Wrote: Don't create them as separate variables in your namespace. Instead assign the variables to a collection, and pull out the values as needed.cirq.LineQubit.range(number)
is already returning a list. Your assignment is just unpacking it into separate variables.
Instead consider:
number = 3 all_qbits = cirq.LineQubit.range(number) print (all_qbits)
Output:[cirq.LineQubit(0), cirq.LineQubit(1), cirq.LineQubit(2)]
Thanks it is true! But it could be nice to know logic. Because I also do following script dynalmically:
If I have 1 variable, it will be
a =kron(unitary(rz(qbt[0])))If I have 2 vaarible, it will be
a = kron(unitary(rz(qt[0])),unitary(rz(qbt[1])))and if I have 10, it will go...
HOw can I do it automatically?