# Qiskit Controlled Reset of a qubit

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

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

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

• 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. Apr 7 at 10:07

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.

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)