Quantum Computing Asked by Petra W on April 18, 2021
Why am I getting here a measurement outcome of $00$? I measure after the first $X$ gate in a separate output bit c[1]
which should result in a $1$ and I measure again after a second $X$ gate in a separate output bit c[0]
which should result in a $0$, so $10$ in total. Why do I get the output $00$ as if both measurements are performed after the whole circuit? And how can I do intermediate measurements as expected?
The first measurement is not being ignored.
Your quantum state started in the state $|0rangle$ and after the $X$ gate, it is now in the state $|1rangle$. Measuring the qubit collapsed it into the state $|1rangle$ again... since $|1rangle$ is already an eigenvector of the $Z$ Pauli operator.
So your state never changes after the first measurement, you still in the state $|1rangle$. Thus, after applying another $X$ gate, you get back to $|0rangle$. That is the reason why you only see $0$ is being measured.
Edit: My comment about the first measurement "not" being ignored when looking at the measurement probabilities is incorrect.
However, the first measurement is not being ignore in the experiment overall... That is, say you start in the state $|0rangle$ then apply Hadamard gate $H$ to it, make a measurement, apply another Hadamard gate $H$ and then make another measurement. If the first measurement is being ignored, then you would get back $|0rangle$.. but in fact we don't:
Now, if you put the first measurement in the first cbit1 and the second measurement on the second cbit2 then you get something like:
This was being simulated on the qasm_simulator as current device is not capable of yet doing this intermediate measurement. So on the real hardware, you can't perform any additional operations after the first measurement.
Another note is that if you do this in the circuit composer environment, you get something like:
Answered by KAJ226 on April 18, 2021
The problem is that IBM Q shows results of measurement of a final quantum state (I found this after some trial and error).
When you apply first $X$ gate, qubits switches from $|0rangle$ to $|1rangle$. The measurement result is of course 1 and this value is stored in classical register, hence you see 10 in Measurement probabilities window.
Now you apply another $X$ gate and this switches your qubit back to state $|0rangle$. So, after measurement you see 0 in classical register. As I mentioned above, only final state probabilities is shown Measurement probabilities window. So, yes, the first measurement is really ignored and it seems that this is a feature of IBM Q environment, although logic says that if you save results to different classical bits, they should be preserved.
Answered by Martin Vesely on April 18, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP