In a five qubit (q0, q1, q2, q3 and q4) quantum circuit, I need to consider only those measurement readings of q0, q1 and q2 for which q3 and q4 measures 0. More specifically, I am trying to implement a protocol using this (see eq. 3). I use two ancilla qubits (q3 and q4) instead of one (as descried in this paper) and the protocol will be executed only if both the ancillaries measure 0. In the end I need the readouts for q0, q1 and q2. How to implement this in Qiskit (also I need to execute the code on a IBM Quantum computer)?

  • $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – Community Bot
    Jul 12, 2023 at 6:16
  • $\begingroup$ please have a look at quantumcomputing.meta.stackexchange.com/questions/49/… and quantumcomputing.stackexchange.com/help/how-to-ask $\endgroup$
    – glS
    Jul 12, 2023 at 7:43
  • $\begingroup$ I edited my question. Thanks $\endgroup$
    – User3912
    Jul 12, 2023 at 9:49
  • $\begingroup$ Just to be sure: do you want to apply quantum gates after having measured 0 on both ancillas, or do you apply quantum gates, meaasure the whole thing and only consider results where both ancillas were measured to be 0? (This is probably equivalent anyway, but the code is different) $\endgroup$
    – Tristan Nemoz
    Jul 12, 2023 at 10:54
  • $\begingroup$ Do you want to apply quantum gates after having measured 0 on both ancillas: no. But if I do apply, I guess it can't be executed on a IBM Quantum computer at present (correct this if it is wrong and please provide the code for this as well). Thank you $\endgroup$
    – User3912
    Jul 12, 2023 at 10:55

1 Answer 1


Yes, this is implementable with dynamic circuit support on IBM Quantum hardware.


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.