You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect this piece of code to transform my initial | 000 > state into | 110 >. The final result of running and measuring this code does return this result, but qvm.bit_string_probabilities(p) and print qvm.wavefunction(p)[0] do not have what I expect:
The ordering of the bits seems to be off; instead of 110 having an amplitude/probability of 1, 011 has an amplitude/probability of 1. After trying this out on a few other qubit variations, it seems that the results are reversed.
The text was updated successfully, but these errors were encountered:
The qubit indexes in Quil correspond to the exponents in the binary expansion of the basis index. Or, in other words, you should read the binary numbers right-to-left. So
No problem. I might add that this is a good convention to follow because, were we to do it left-to-right, the basis elements would change if you add a qubit to the system. The index of the |1> state in a 1-qubit system is the same as the index of the |0001> state in a 4-qubit system. In the left-to-right scheme, we would have |1> be indexed by 1, but |1000> be indexed by 8, which seems silly. :)
When running the following code, there are some conflicting results:
I would expect this piece of code to transform my initial | 000 > state into | 110 >. The final result of running and measuring this code does return this result, but
qvm.bit_string_probabilities(p)
andprint qvm.wavefunction(p)[0]
do not have what I expect:The ordering of the bits seems to be off; instead of
110
having an amplitude/probability of 1,011
has an amplitude/probability of 1. After trying this out on a few other qubit variations, it seems that the results are reversed.The text was updated successfully, but these errors were encountered: