1
$\begingroup$

I'd like to be able to apply $|0 \rangle \langle 0|$ to project a qubit to the state $|0 \rangle$ in the middle of qiskit circuit (see, for example, the attached circuit).

enter image description here

I wonder if, in general, one can customize those orange boxes in some way and if that works in the real hardware.

$\endgroup$

1 Answer 1

1
$\begingroup$

I hope this is what you are looking for.


Within IBM hardware, there is a new option called "reset" that allows you to reset a certain qubit back to the state $|0\rangle$. For instance,

from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
qreg_q = QuantumRegister(3, 'q')
creg_c = ClassicalRegister(3, 'c')
circuit = QuantumCircuit(qreg_q, creg_c)
circuit.x(qreg_q[0])
circuit.h(qreg_q[2])
circuit.cswap(qreg_q[2], qreg_q[0], qreg_q[1])
circuit.h(qreg_q[2])
circuit.reset(qreg_q[1])

enter image description here

Within the circuit composer, you can find the reset method as well with the $|0\rangle$ symbol:

enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ Yes, that's exactly what I'm looking for, thanks!. Is it possible to customize operators in the middle of the circuits? what about if instead I want to get $| 1 \rangle$ ? $\endgroup$
    – danuzco
    Commented Feb 5, 2021 at 22:06
  • $\begingroup$ I believe you can only reset it to the state $|0\rangle$. To get $|1\rangle$ you would have to apply the $X$ gate after the reset. $\endgroup$
    – KAJ226
    Commented Feb 5, 2021 at 22:07
  • $\begingroup$ Oh, you're right, applying $X$. Thanks again. $\endgroup$
    – danuzco
    Commented Feb 5, 2021 at 22:10
  • $\begingroup$ No problem!!! :) $\endgroup$
    – KAJ226
    Commented Feb 5, 2021 at 22:11

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.