I wish to have a "reset" gate. This gate would have an effect to bring a qubit to the $\mid0\rangle$ state.
Clearly, such a gate is not unitary (and so I'm unable to find any reliable implementation in terms of universal gates).

Now for my particular needs, I need this ability to reset a qubit or a quantum register to that state so users can always start from $\mid0\rangle$. I'm making a small programming language that transpiles to QASM, and when a function is exited, I want all local (quantum) variables (qubits) reset to $\mid0\rangle$ so they can be reused. QASM reset instruction does not work on the real processor.

I think that something to this effect may be achieved with quantum phase estimation but I'm wondering if there is another way.

  • $\begingroup$ "I want all local (quantum) variables (qubits) reset to $\vert 0 \rangle$ so they can be reused" => most of the time, this should be performed by uncomputation and not by reseting brutally the unused qubits. If one of these "unused" qubit is still entangled with a "in-use" qubit, reseting the unused one will also affect the state of the used one, which is most of the time not desirable. $\endgroup$ – Nelimee Jul 31 '18 at 14:06
  • $\begingroup$ @Nelimee I agree. Brutal resetting is not safe. I'm starting to settle on simply warning users when a qubit (register) is already in use. $\endgroup$ – Ntwali B. Jul 31 '18 at 15:36
  • 1
    $\begingroup$ @Nelimee If they are entangled, uncomputing will also effect those entangled qubits in one way or another. $\endgroup$ – Norbert Schuch Jul 31 '18 at 21:55
  • $\begingroup$ @Blue thanks for the edit. Did not even realise how nonsensical the question title was. $\endgroup$ – Ntwali B. Aug 4 '18 at 17:28

One way is simply to measure the qubit in the standard, $Z$, basis. If you get the answer 0, then you've got the state you want. Otherwise, you apply a bit-flip to it.

Indeed, if you want to implement a non-unitary operation, you need some sort of measurement operation somewhere, whether that's a direct measurement, or the implementation of a CP map or POVM (but for these options, you need to introduce ancillas of a fixed state, which rather negates the point). Or you could use noise in the system, but you are unlikely to have sufficient control of it - it's noise after all! Of course, none of these options just reset a single qubit; anything that qubit is entangled with is also affected, but that's kind of in the definition of "reset" in the quantum context.

The only other option is to uncompute, but this is not a generic option because, generically you have to uncompute the entire computation to reset even a single qubit, and that resets everything. Except it doesn't work perfectly because of errors. You would be better starting a new computation. There are specific scenarios where an ancilla qubit is used and it can be uncomputed, but this is typically built into the algorithm because the uncomputation step is important for getting rid of some unwanted entanglement that would otherwise appear.

  • $\begingroup$ This was close but since I'm targeting QASM, it doesn't allow applying further gates to qubits after measurement. And of course, any entangled qubits will also have their states determined. As commented on other answers, my attempt is misguided but I appreciate all the answers. $\endgroup$ – Ntwali B. Jul 31 '18 at 16:02
  • 1
    $\begingroup$ You have to distinguish between what QASM does not allow and what the current hardware does not allow. Rest or applying a gate after measure is completely fine in QASM (i'm talking about OpenQASM). But it is a limitation of current hardware that these operations can't take place. If you create such QASM, you can still simulate it. And hardware of the not-so-distant future will also support it. $\endgroup$ – Ali Javadi Aug 1 '18 at 1:24
  • $\begingroup$ @AliJavadi That may be true but I am constrained about what's possible now. But I do wish in the future we have the possible to bring a qubit to the $\mid0\rangle$ state. $\endgroup$ – Ntwali B. Aug 4 '18 at 16:56

I do not think that you can achieve this with a single gate, but the cool thing of quantum gates and unitary transformations is that they are reversible, therefore, when implementing a function in your quantum circuit, all you need to do is 'uncompute' it just by reversing the gates that you used.

Here i made a random circuit and reversed it; you can see that you are back to the state $\vert 0\rangle$.

This would mean that you have to "reset" in a specific way for each function, though.

  • 4
    $\begingroup$ that only works if you know that no errors have occurred. In a noisy system, you can't undo the noise. $\endgroup$ – DaftWullie Jul 31 '18 at 13:46
  • 1
    $\begingroup$ This is not a bad idea. And from a programming point of view, it's doable too. Though after much thought, this attempt of mine is misguided for three reasons: 1) the uncomputation will rollback the useful computation, and to users' discontent, the function will appear to do nothing 2) we can't uncompute a measurement if there is one. 3) as @DaftWulie just suggested, the presence of errors makes the scheme shaky and errors will probably happen. But I'm glad you proposed this. Thank you. $\endgroup$ – Ntwali B. Jul 31 '18 at 15:55
  • 2
    $\begingroup$ @NtwaliB. For classical logic it is always possible to uncompute (=reset) the ancilla workspace while keeping the desired result, that's the key point of classical reversible computation. $\endgroup$ – Norbert Schuch Jul 31 '18 at 21:56
  • $\begingroup$ @NorbertSchuch That is true. But I was talking about arbitrary qubits not ancilla cbits after measurement. $\endgroup$ – Ntwali B. Aug 4 '18 at 17:01

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.