2
$\begingroup$

In Qiskit, is there a way to perform a reset of a qubit with control on another without using an additional ancilla qubit?

$\endgroup$
2
  • $\begingroup$ could you explain a bit better what you mean? It seems to me like perhaps the answer to your question is a CNOT gate... $\endgroup$
    – Lior
    Apr 7, 2022 at 9:45
  • 1
    $\begingroup$ @Lior: No, the CNOT negates, while reset changes any state to $|0\rangle$. $\endgroup$ Apr 7, 2022 at 10:06

3 Answers 3

1
$\begingroup$

No , From the documentation you can only reset based on a classical bit

$\endgroup$
1
  • $\begingroup$ Hi and welcome to Quantum Computing SE. Please note that once you have enough reputation, you should post such short answers (or link-only answer) as comments. $\endgroup$ Apr 7, 2022 at 10:07
1
$\begingroup$

I’m not 100% sure I understand the context, but I’ll try to answer to the best of my understanding of the question:

If you want to reset a qubit using quantum operations only, you can swap the state with an ancilla in the 0 state. If you want to do it controlled on the state of another qubit, do a controlled swap between the 0 state ancilla and your target qubit with the control qubit as, well, control.

$\endgroup$
1
$\begingroup$

You could perform a hand-rolled conditional reset with something like the code below. This will reset the second qubit if the first qubit is excited.

from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit

qreg_q = QuantumRegister(2, 'q')
creg_cw = ClassicalRegister(1, 'cw')
circuit = QuantumCircuit(qreg_q, creg_cw)


circuit.measure(qreg_q[0], creg_cw[0])
circuit.reset(qreg_q[1]).c_if(creg_cw, 1)
$\endgroup$

Your Answer

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

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