1
$\begingroup$

I'm generating a qiskit circuit and want to add an X gate to a qubit if the sum of some previous measurements modulo 2 is equal to 1. In cirq, I could just use a sympy expression that would look something like X(q(10)).with_classical_controls(Mod(q1 + q4 + q7, 2)), where q10 is the qubit I'm applying the X correction to, and q1, q4 and q7 are the measurement who's sum I'm using to control this correction. How can I do this in qiskit?

$\endgroup$
2
  • $\begingroup$ As far as I know, this is not possible in qiskit. But I would be very happy to be corrected on that. I faced a similar problem with classical control and kind of solved it with an ugly workaround: quantumcomputing.stackexchange.com/questions/38188/… (but I guess that is not what you are looking for) $\endgroup$
    – qubitzer
    May 15 at 9:22
  • 1
    $\begingroup$ You can implement sum modulo 2 by XOR'ing the bits. Here you can find how to do this with Qiskit dynamic circuits. $\endgroup$ May 15 at 9:54

0

Your Answer

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

Browse other questions tagged or ask your own question.