Reset Operation in OpenQASM

Initiating qubits to a known state is an essential part of quantum computing. The reset command in OpenQASM is specifically designed for this purpose, directing qubits back to the \( |0\rangle \) state. This chapter will detail the reset operation usage, following the preparation of qubits with a Hadamard gate.

Preparing and Resetting Qubits

Before resetting qubits, it is common to apply quantum operations, such as the Hadamard gate, which puts qubits into a superposition of states. The reset operation is then used to bring qubits back to a known default state, often as a precursory step before starting a new sequence of quantum operations.

Reset a Single Qubit

To reset one specific qubit to the \( |0\rangle \) state, you can use the reset keyword as follows:

reset <quantum_register>[<index>];

Experiment: Applying Hadamard and Resetting a Qubit

Here is an example of preparing a qubit in superposition with a Hadamard gate and then resetting it1234:

Diagram

OPENQASM 2.0; // Define the OpenQASM version [^1] include "qelib1.inc"; // Include the standard quantum library [^2] // Declare a quantum register qreg qubits[1]; // Single-qubit quantum register [^3] // Place the first qubit in a superposition state h qubits[0]; // Apply Hadamard gate [^4] // Return the first qubit to its initial state reset qubits[0]; // Reset operation

Translation

Powered by Perceval, Qiskit, PyZX

Not run yet

Simulation

Not run yet

In this experiment, the qubit is first put into a superposition by the Hadamard gate, and then the reset command brings it back to \( |0\rangle \), demonstrating the qubit's state manipulation.

Reset an Entire Quantum Register

The reset operation can be extended to reset every qubit in a quantum register simultaneously:

reset <quantum_register>;

Experiment: Resetting a Quantum Register After Superposition

For an entire quantum register prepped with superposition states1234:

Diagram

OPENQASM 2.0; // Define the OpenQASM version [^1] include "qelib1.inc"; // Include the standard quantum library [^2] // Declare a quantum register with multiple qubits qreg qubits[4]; // Single-qubit quantum register [^3] // Prepare each qubit in a superposition state h qubits[0]; // Apply Hadamard gate to the first qubit [^4] h qubits[1]; // Apply Hadamard gate to the second qubit [^4] h qubits[2]; // Apply Hadamard gate to the third qubit [^4] h qubits[3]; // Apply Hadamard gate to the fourth qubit [^4] // Reset all qubits in the register to their initial states reset qubits;

Translation

Powered by Perceval, Qiskit, PyZX

Not run yet

Simulation

Not run yet

In this example, the Hadamard gate creates a superposition state for each qubit in the qubits register before the collective reset operation returns them all to the \( |0\rangle \) state.

Note: The reset command, whether applying to individual qubits or the entire register, is an integral feature in OpenQASM for maintaining control over qubit states throughout quantum computations.

Understanding and effectively utilizing the reset command is fundamental for setting up and reusing qubits within quantum circuits, ensuring optimal operations in quantum algorithms.

Footnotes

  1. Version String Documentation 2

  2. Include Documentation 2

  3. Registers Documentation 2

  4. Hadamard Gate Documentation 2

Measure
Gates

Copyright © 2024 Walther Group, Faculty of Physics, University of Vienna. All rights reserved.

ImprintContact