Build repetition codes | IBM Quantum Learning

 

Background

To enable real-time quantum error correction (QEC), we require the capability to dynamically control quantum program flow during execution so that quantum gates may be conditioned on measurement results. In this tutorial, we will run the bit-flip code, which is a very simple form of QEC. We will demonstrate a dynamic quantum circuit that can protect an encoded qubit from a single bit-flip error, and then evaluate the performance of the bit-flip code.
We can exploit additional ancilla qubits and entanglement to measure what are known as stabilizers that do not transform our encoded quantum information, while still informing us of some classes of errors that may have occurred. A quantum stabilizer code encodes kk logical qubits into nn physical qubits. Stabilizer codes critically focus on correcting a discrete error set with support from the Pauli group ΠnΠn. Assume the set of possible errors are ϵ⊂Πnϵ⊂Πn. For example, in a bit-flip code with three qubits encoding the quantum state, we will have ϵ={IIX,IXI,XII}ϵ={IIX,IXI,XII}. We can measure the stabilizers and observing their eigenvalues to dete

Setup

Authenticate to run code cells Sign in
Copy to clipboard
Output:
Authenticate to run code cells Sign in
Copy to clipboard
Output:

Build a bit-flip stabilizer circuit

The bit-flip code is among the simplest examples of a stabilizer code. It can protect our state against a single bit-flip (X) error on any of the encoding qubits. If we consider the action of bit-flip error XX which maps ∣0⟩→∣1⟩∣0⟩→∣1⟩ and ∣1⟩→∣0⟩∣1⟩→∣0⟩ on any of our qubits, we have ϵ={E0,E1,E2}={IIX,IXI,XII}ϵ={E0​,E1​,E2​}={IIX,IXI,XII}. The code requires five qubits: three are used to encode the protected state, and the remaining two are used as stabilizer measurement ancillas.
Authenticate to run code cells Sign in
Copy to clipboard
Output:
Authenticate to run code cells Sign in
Copy to clipboard
Output:
notion image

Optimize the circuit

We will transpile the circuit to select the best qubit layout and routing.
Authenticate to run code cells Sign in
Copy to clipboard
Output:
notion image
Authenticate to run code cells Sign in
Copy to clipboard
Output:

Execute the circuit in hardware

We'll run the version with correction applied, and one without correction
Authenticate to run code cells Sign in
Copy to clipboard
Output:
Authenticate to run code cells Sign in
Copy to clipboard
Output:

Analyze the results

Authenticate to run code cells Sign in
Copy to clipboard
Output:
Authenticate to run code cells Sign in
Copy to clipboard
Output:
Authenticate to run code cells Sign in
Copy to clipboard
Output:
Authenticate to run code cells Sign in
Copy to clipboard
Output:
Authenticate to run code cells Sign in
Copy to clipboard
Output:
  • Giscus
quantum
literature base
video notes