I was trying to see what IBM would do under the hood with a CCNOT gate. Something appears to be erroneous with the run.

enter image description here

The circuit above should produce state 11100 with 100% probability, as confirmed by the visualizer (and the basic definition of the CCNOT). However both the simulator and the actual backend (ibmqx4) give all 1024 shots as 00000. Something is definitely not working right here.


1 Answer 1


I think you forgot to measure your quantum registers. The backends and the actual simulators always return the results read from the classical registers. Even if the simulator could return the amplitudes 1, the real backends cannot as we can't read the whole statevector. I guess this behaviour has been fixed in order to have a consistency between real hardware and simulators.

Short solution: add measurement gates at the end of your circuit.

1 It depends on the simulation algorithm used.

  • $\begingroup$ Of course! How silly of me, thanks for answering $\endgroup$
    – bRost03
    Jun 19, 2019 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.