1
$\begingroup$

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)
circ.h(0)
circ.measure(0,1)
circ.measure(2,1).c_if(1,0)

fig=circ.draw('mpl')
fig.show()

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

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}$

QUESTION :

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

1 Answer 1

0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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