Certainly. Below is the revised chapter with adjustments to the "Experiment: Single Qubit Quantum Register" section to integrate only the Hadamard gate, as per your request, while keeping the pedagogical approach:


Quantum Registers in OpenQASM

Quantum registers serve as a vital tool for grouping and managing qubits, the fundamental units of quantum information, within OpenQASM programs. This chapter explores the process of declaring and interacting with quantum registers.

Introduction to Quantum Registers

Quantum registers in OpenQASM act much like classical registers in traditional computing, offering a means to operate on multiple qubits in unison.

To declare a quantum register, employ the qreg keyword alongside a valid identifier and the number of qubits to be included:

qreg <identifier>[<size>];

The identifier must follow the naming rules of OpenQASM, while the size is a positive integer defining the register's qubit count.

Declaration Example

For instance, to establish a quantum register called qubits with 2 qubits:

// Quantum register creation with two qubits
qreg qubits[2];

Note: Upon declaration, every qubit in a quantum register defaults to the \( |0\rangle \) state.

Referencing Qubits within Registers

Individual qubits within a register are accessed via indexing, similar to array elements:

<identifier>[<index>]

Indices run from 0 up to n-1 for a quantum register of size n, adhering to standard zero-based indexing practices.

Experiment: Using Quantum Registers

To apply quantum gates to our qubits register12345:

Diagram

OPENQASM 2.0; // Declaration of OpenQASM version [^1] include "qelib1.inc"; // Inclusion of the standard library [^2] // Initialization of a two-qubit quantum register qreg qubits[2]; // Declaration of the quantum register [^3] // Application of Hadamard gates h qubits[0]; // Hadamard on the first qubit [^4] h qubits[1]; // Hadamard on the second qubit [^5]

Translation

Powered by Perceval, Qiskit, PyZX

Not run yet

Simulation

Not run yet

Here, each qubit experiences a Hadamard gate, which places them in a state of superposition and is a fundamental step in many quantum algorithms.

Experiment: Single Qubit Quantum Register

Within OpenQASM 2, registers must be used even for individual qubits12345:

Diagram

OPENQASM 2.0; // Declaration of OpenQASM version [^1] include "qelib1.inc"; // Inclusion of the standard library [^2] // Single-qubit register declaration qreg qubit[1]; // A quantum register representing a single qubit [^3] // Hadamard gate applied to the single qubit h qubit[0]; // Enacting a Hadamard transformation [^4]

Translation

Powered by Perceval, Qiskit, PyZX

Not run yet

Simulation

Not run yet

By treating a single qubit as a quantum register, we maintain consistency with the language's constructs and can apply quantum operations to the qubit just as we would within larger registers.


The explanations and examples have been updated to maintain focus on foundational concepts while providing practical demonstrations through the "Experiments." This structure seeks to ensure a smooth and educational experience for beginners learning about quantum registers in OpenQASM.

Footnotes

  1. Version String Documentation 2

  2. Include Documentation 2

  3. Quantum Registers Documentation 2

  4. Hadamard Gate Documentation 2

  5. Quantum Registers Documentation 2

Include
Classical Registers

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

ImprintContact