OpenQASM Reset

Reset is an important operation in Quantum Computing that allows to reset the state of a Qubit. In this chapter of the OpenQASM Tutorial, you will be learning about how to reset the state of a Qubit.

The reset operation destroys the state of the Qubit. Therefore, the reset operation generally follows the measurement operation on a Qubit. The Reset operation resets the state of a Qubit to |0>.

OpenQASM provides the optionality to reset the state of a single Qubit in the Quantum Register, or all the Qubits in the Quantum Register at once.

Reset a Qubit

The state of a single Qubit in the Quantum Register can be reset to |0> by using the reset keyword. The following syntax is used to reset the state of a Qubit at given index of the Quantum Register-

reset quantum_register[index];

Example

Below is an example of resetting the state of first Qubit of Quantum Register qubits.

reset qubits[0];

Reset a Quantum Register

It is also possible to reset the state of all the Qubits of a Quantum Register to |0> at once by using the reset keyword. The following syntax is used to reset the state of all the Qubits of a Quantum Register at once-

reset quantum_register;

Example

Below is an example of resetting the state of all Qubits of Quantum Register qubits.

reset qubits;

Note– Notice that both reset instructions make use of the reset keyword in different ways.