I am trying to implement Figure 6 in Implementing a distance-based classifier with a quantum interference circuit by Schuld et. al

The specific part that I'm struggling with is the controlled (on |0>) measurement in part F of Figure 6.

enter image description here

I can't figure out how to code that controlled measurement element in qiskit. Below is my simple python qiskit (v0.20.0) code :

from qiskit import * 
from qiskit import Aer

circ = QuantumCircuit(4,2)


backend = Aer.get_backend('statevector_simulator')
job = backend.run(circ)

My code results in the image :

enter image description here

Note that it does not look like part F from Figure 6. Specifically, it isn't apparent that the conditioning is on classical output of $q_{0}$


  1. How do I replicate part F of Figure 6 from Schuld's paper using qiskit?

1 Answer 1


Although QASM allows controlled measurements like if (c == 0) measure q[1] -> c[1];, I am afraid you won't be able to execute it in Qiskit. Conditional measurements are not supported by Qiskit and you will get an error message when trying to run your circuit on backend. Nevertheless you can create and draw such a circuit. What you described in your code is exactly what is shown in the figure 6. It is just that Qiskit draws it in a slightly different way. There has been a similar question here.


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.