mirror of
https://github.com/quantumjim/Quantum-Computation-course-Basel.git
synced 2025-11-08 22:14:25 +01:00
update for 2024
This commit is contained in:
parent
747c64a901
commit
d10d64b92e
83
README.md
83
README.md
@ -1,87 +1,76 @@
|
||||
# Quantum Computation and Error Correction
|
||||
|
||||
This is a [course at the University of Basel](https://vorlesungsverzeichnis.unibas.ch/de/home?id=278317), given by [Dr James Wootton of IBM Research](https://researcher.watson.ibm.com/researcher/view.php?person=zurich-JWO).
|
||||
This is a [course at the University of Basel](https://vorlesungsverzeichnis.unibas.ch/de/semester-planung?id=286075), given by Dr James Wootton of Moth Quantum.
|
||||
|
||||
This repository reflects the version of the course given in 2023. For the 2020, 2021 and 2022 version see [here](https://github.com/quantumjim/Quantum-Computation-course-Basel/tree/2022).
|
||||
|
||||
The lecture videos for this course are all on [YouTube](https://www.youtube.com/playlist?list=PLaU1vYImkPDxyqJ6zHAs8W92fYKsfXsV-) for you to view at any time.
|
||||
The course will largely follow the same structure as previous years, for which a series of lecture videos where created. These are all available on [YouTube](https://www.youtube.com/playlist?list=PLaU1vYImkPDxyqJ6zHAs8W92fYKsfXsV-) for you to view at any time.
|
||||
|
||||
|
||||
## Course Content
|
||||
|
||||
Quantum information theory is the basis of multiple emerging technologies, such as quantum computation and quantum crypotography. It allows us to understand how quantum effects in physical systems may be harnessed for new forms of information processing. The course will also feature some hands on experience with quantum technology, via the open-source Qiskit framework for quantum computing.
|
||||
This course is an introduction to quantum computation, suitable for students with a physics, nanoscience, computer science or mathematical background. Theologians and philosophers have also been known to try it out!
|
||||
|
||||
|
||||
## Course Text
|
||||
|
||||
The course will be based on the [Qiskit textbook](https://github.com/NCCR-SPIN/qiskit-textbook/blob/main/content/preface.ipynb). Note that this link is to the Jupyter notebook source files of the textbook. The latest version of Qiskit learning materials can be found [here](https://learning.quantum-computing.ibm.com/).
|
||||
The course will be based on the [Qiskit textbook](https://github.com/NCCR-SPIN/qiskit-textbook/blob/main/content/preface.ipynb). Links to specific pages will be given for each lecture. Note that this textbook is no longer maintained, and so does not reflect the most recent version of Qiskit.
|
||||
|
||||
|
||||
## Lectures
|
||||
|
||||
Most of the course will be done as a 'flipped classroom'. Lecture videos will be provided 1 week early. In-person sessions take place from 14:15-16:00 on Tuesdays. This will be used for questions from students, working together through exercises, and covering additional topics.
|
||||
|
||||
Below are links to the lecture videos for the lectures so far. For links to the corresponding sections of the textbook, see the video description.
|
||||
The course consists of the following set of lectures. We will aim to do slightly more than one per week. All lectures will be given in person, but [video versions](https://www.youtube.com/playlist?list=PLaU1vYImkPDxyqJ6zHAs8W92fYKsfXsV-) of many lectures are available also. Links to the pertinent parts of the Qiskit textbook can be found in the video descriptions.
|
||||
|
||||
* Lecture 1: [The Atoms of Computation and What is Quantum](https://youtu.be/myzcjukQUFc) and [Python, Qiskit and Hello Qiskit](https://youtu.be/mMJtw-vFXC4)
|
||||
- In-class lecture: [The Unique Properties of Qubits](extra_resources/unique-properties-qubits.ipynb)
|
||||
- In-class exercise: [Quantum Logic Gates](exercises_2022/Exercise2.ipynb)
|
||||
|
||||
|
||||
* Lecture 2: [Representing Single Qubit States and Gates](https://www.youtube.com/watch?v=GdRt8vO9xY8)
|
||||
- In-class exercises: [Playing with Paulis](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/exercises_2022/Exercise3.ipynb), [More playing with Paulis](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/exercises_2022/Exercise4.ipynb)
|
||||
|
||||
* Lecture 3: [Multi qubit States and Circuit Identities](https://www.youtube.com/watch?v=pzkeypXaQ-Q)
|
||||
- In-class lecture: [Density matrices](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/QI_course/2_The_Qubit.pdf), [partial trace](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/QI_course/3_Quantum_Information.pdf) and [Schmidt decomposition](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/QI_course/6_Quantum_Correlations_part_1.pdf).
|
||||
|
||||
* Lecture 4: [Fun with matrices](https://www.youtube.com/watch?v=e7NTozZMRqk)
|
||||
|
||||
* Lecture 5: [Circuits and Universality](https://www.youtube.com/watch?v=E53mfGrV8ek)
|
||||
- In-class lecture: [Proof that Clifford + t is universal](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/extra_resources/Lecture%206%20(2013%20version).pdf)
|
||||
- In-class exercise: [Real quantum computing](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/exercises_2022/Exercise7.ipynb)
|
||||
|
||||
|
||||
* Lecture 6: [Basic Algorithms and Protocols](https://www.youtube.com/watch?v=fNOEVXQKv9M)
|
||||
- In-class lecture: [Relative Entropy and Entanglement Sharing](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/QI_course/7_Quantum_Correlations_part_2.pdf)
|
||||
- In-class exercise: [Trotters and Garbage](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/exercises_2022/Exercise6.ipynb)
|
||||
|
||||
|
||||
* Lecture 7: [From the Fourier Transform to Shor's Algorithm](https://www.youtube.com/watch?v=WqgNu8ZziPQ)
|
||||
- In-class lecture [Quantum key distribution](https://github.com/NCCR-SPIN/qiskit-textbook/blob/main/content/ch-algorithms/quantum-key-distribution.ipynb)
|
||||
- In-class exercise: [The order finding operator](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/exercises_2019/Exercise8.pdf)
|
||||
|
||||
|
||||
* Lecture 8: [Grover's Algorithm and why we can't yet run it](https://www.youtube.com/watch?v=YfFp3K4cAF4)
|
||||
- In-class lecture: [Quantum noise](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/QI_course/8_Quantum_Noise.pdf) and [Stabilizer formalism](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/QI_course/9_Stabilizer_Formalism.pdf)
|
||||
|
||||
* Lecture 9: [Introduction to QEC 1: The repetition code](https://www.youtube.com/watch?v=AuDfq7j_W7E&list=PLaU1vYImkPDxyqJ6zHAs8W92fYKsfXsV-&index=10)
|
||||
- In-class lecture: [Decoding 1: Running Circuits and Interpreting Outputs](https://github.com/quantumjim/qec_lectures/blob/main/lecture-1.ipynb)
|
||||
|
||||
|
||||
* Lecture 10: [Introduction to QEC 2: The surface code](https://www.youtube.com/watch?v=IdZkxX-Qank&list=PLaU1vYImkPDxyqJ6zHAs8W92fYKsfXsV-&index=11)
|
||||
- In-class lecture: [Decoding 2: Correcting Errors](https://github.com/quantumjim/qec_lectures/blob/main/lecture-2.ipynb)
|
||||
|
||||
* Lecture 11: *No video lecture*
|
||||
- In-class lecture: [Toric code](https://en.wikipedia.org/wiki/Toric_code) and [LDPC codes](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/extra_resources/LDPC-codes.pdf)
|
||||
- In-class exercises: [Shor code](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/exercises_2019/Exercise7.pdf)
|
||||
* Lecture 11: [Introduction to QEC 3: LDPC codes](https://www.youtube.com/watch?v=IdZkxX-Qank&list=PLaU1vYImkPDxyqJ6zHAs8W92fYKsfXsV-&index=11)
|
||||
|
||||
* Lecture 12: [Decoding 1: Running Circuits and Interpreting Outputs](https://github.com/quantumjim/qec_lectures/blob/main/lecture-1.ipynb)
|
||||
|
||||
* Lecture 12: *No video lecture*
|
||||
- In-class lecture: [Decoding 3: Programming and Using a Matching Decoder](https://github.com/quantumjim/qec_lectures/blob/main/lecture-3.ipynb)
|
||||
* Lecture 13: [Decoding 2: Correcting Errors](https://github.com/quantumjim/qec_lectures/blob/main/lecture-2.ipynb)
|
||||
|
||||
* Lecture 14: [Decoding 3: Programming and Using a Matching Decoder](https://github.com/quantumjim/qec_lectures/blob/main/lecture-3.ipynb)
|
||||
|
||||
* Lecture 15: [Decoding 4: Programming HDRG Decoders](https://github.com/quantumjim/qec_lectures/blob/main/lecture-4.ipynb)
|
||||
|
||||
## Extra Topics
|
||||
|
||||
For some lectures there is also some extra content that we will cover if there is time. Or you can just check it out for fun!
|
||||
|
||||
* Lecture 1: [The Unique Properties of Qubits](extra_resources/unique-properties-qubits.ipynb)
|
||||
|
||||
* Lecture 3: [Density matrices](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/QI_course/2_The_Qubit.pdf), [partial trace](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/QI_course/3_Quantum_Information.pdf) and [Schmidt decomposition](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/QI_course/6_Quantum_Correlations_part_1.pdf).
|
||||
|
||||
* Lecture 5: [Proof that Clifford + t is universal](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/extra_resources/Lecture%206%20(2013%20version).pdf)
|
||||
|
||||
* Lecture 6: [Relative Entropy and Entanglement Sharing](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/QI_course/7_Quantum_Correlations_part_2.pdf)
|
||||
|
||||
* Lecture 7: [Quantum key distribution](https://github.com/NCCR-SPIN/qiskit-textbook/blob/main/content/ch-algorithms/quantum-key-distribution.ipynb)
|
||||
|
||||
* Lecture 9: [Quantum noise](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/QI_course/8_Quantum_Noise.pdf) and [Stabilizer formalism](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/QI_course/9_Stabilizer_Formalism.pdf)
|
||||
|
||||
* Lecture 13: *No video lecture*
|
||||
- In-class lecture: [Decoding 4: Programming HDRG Decoders](https://github.com/quantumjim/qec_lectures/blob/main/lecture-4.ipynb)
|
||||
|
||||
## Exercises
|
||||
|
||||
### In-Class Exercises
|
||||
|
||||
Exercises covered in class will be drawn from the big pile of all the exercises used in previous versions of this course.
|
||||
|
||||
### Take-Home Exercises
|
||||
|
||||
Take-home exercises set on 17th Oct, 7th Nov and 28th Nov. There will be hints sessions at 16:15 on those dates. Solutions will be presented at 16:15 on 31st Oct, 21st Nov and 12th Dec.
|
||||
|
||||
* [Exercise sheet 1](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/exercises/Exercise1.ipynb): Set 17th Oct. Hint session and hand-in instructions at 16:15.
|
||||
|
||||
* [Exercise sheet 2](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/exercises/Exercise2.ipynb): Set 7th Nov. Hint session and hand-in instructions at 16:15 (on Zoom).
|
||||
|
||||
* [Exercise sheet 3](https://github.com/quantumjim/Quantum-Computation-course-Basel/blob/main/exercises/Exercise3.ipynb): Set 28th Nov. Hint session and hand-in instructions at 16:15.
|
||||
Three sets of take-home exercises set throughout the course. There will be hints sessions at 16:15 on the dates that these are set. Solutions will be presented after the exercises have been graded.
|
||||
|
||||
**Note: These exercises form 50% of your final grade**
|
||||
|
||||
@ -93,9 +82,9 @@ As in previous years, we'll have a final project instead of a standard exam. The
|
||||
|
||||
### Important dates
|
||||
|
||||
You have until 15th January to hand-in your final projects (to me, by email). That gives you around 3 weeks after the hand-in of your final set of exercises (not including the Christmas break). You are expected to put a similar amount of time and effort in to the final project as you would put into two sets of exercises.
|
||||
You have until *tbd* January to hand-in your final projects (to me, by email). You are expected to put a similar amount of time and effort in to the final project as you would put into two sets of exercises.
|
||||
|
||||
You have until 21st December to email me and ask for feedback on project ideas, and to give guidelines for what would be expected for them.
|
||||
You have until *tbd* December to email me and ask for feedback on project ideas, and to give guidelines for what would be expected for them.
|
||||
|
||||
### Project ideas
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,146 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Exercise Sheet 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 1 - Trotter-Suzuki Simulations\n",
|
||||
"\n",
|
||||
"Consider the following Hamiltonian defined on four qubits.\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\tilde H = - J_x (X_0 X_1 + X_2 X_3) - J_z (Z_0 Z_2 + Z_1 Z_3) - h\\sum_j X_j + Z_j\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"Here $X_1 = I \\otimes \\sigma^x \\otimes I \\otimes I$, etc. The Hamiltonian is denoted $\\tilde H$ here to distingush it from the Hadamard, $H$.\n",
|
||||
"\n",
|
||||
"The time evolution of this Hamiltonian can be approximated by\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"e^{i \\tilde H t} \\approx \\left( e^{-i X_0 X_1 \\, J_x t/n} e^{-i X_2 X_3 \\, J_x t/n} e^{-i Z_0 Z_2 \\, J_z t/n} e^{-i Z_1 Z_3 J_z \\, t/n}\\prod_j e^{-i(X_j +Z_j)\\, ht/n} \\right)^n\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"where the approximation becomes increasing accurate as $n$ is increased.\n",
|
||||
"\n",
|
||||
"To complete the following questions, first write a Qiskit circuit to implement such a simulation of the time evolution.\n",
|
||||
"\n",
|
||||
"(a) For $J_x=1$ and $J_z=h=0$,$e^{i\\tilde H t} \\sim X_1 X_2 X_3 X_4$ for a suitable value of $t$. Determine the required value of $t$, and show that your simulation has this effect by appling to an initial $|0\\rangle^{\\otimes 4}$ state.\n",
|
||||
"\n",
|
||||
"(b) For $J_z=1$ and $J_x=h=0$, $e^{i\\tilde H t} \\sim Z_1 Z_2 Z_3 Z_4$ for a suitable value of $t$. Determine the required value of $t$, and show that your simulation has this effect by appling to an initial $|+\\rangle^{\\otimes 4}$ state.\n",
|
||||
"\n",
|
||||
"(c) For $J_x=J_z=0$ and $h=1$, $e^{i\\tilde H t} \\sim H_1 H_2 H_3 H_4$ for a suitable value of $t$. Determine the required value of $t$, and show that your simulation has this effect by appling to an initial $|0\\rangle^{\\otimes 4}$ state.\n",
|
||||
"\n",
|
||||
"(d) Find $W$, a four-qubit Pauli observable (non-trivial on all qubits) that commutes with all the two-qubit terms in the Hamiltonian.\n",
|
||||
"\n",
|
||||
"(e) For what value of $n$ (approximately) does the error in the simulation for the next question become on the same order as sampling error for $10^3$ shots? Assume that $n=1000$ yields a perfect approximation and use $J_x=J_z=1$, $h=2$.\n",
|
||||
"\n",
|
||||
"(f) For $J_x=J_z=1$ and starting in an eigenstate of $W$, calculate $\\langle W \\rangle$ for various times in the interval $0 < t \\leq 2 \\pi$, and for a sufficiently large $n$. Plot the results for $h=0.1$, $h=1$ and $h=2$.\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"\n",
|
||||
"# 2 - Inverse QFT\n",
|
||||
"Using Qiskit, implement an inverse Quantum Fourier transform for any general number of qubits.\n",
|
||||
"* Unlike the QFT in the lecture notes, your inverse QFT should not reverse qubit\n",
|
||||
"order.\n",
|
||||
"* You must implement the $R_n$ rotations using only single qubit gates and\n",
|
||||
"controlled-NOT gates.\n",
|
||||
"\n",
|
||||
"To demonstrate that your circuit does what it is supposed to, you can use the following function. This prepares the state that is QFT of the binary representation of a given integer $j$ on a\n",
|
||||
"given quantum register `qr``. Applying your inverse QFT, you should be able to rotate\n",
|
||||
"back to the binary representation of $j$.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import numpy as np\n",
|
||||
"\n",
|
||||
"# this function creates the state prep circuit\n",
|
||||
"def state_prep(j,qr):\n",
|
||||
" n = qr.size\n",
|
||||
" N = 2**n\n",
|
||||
" state = [0]*N\n",
|
||||
" for k in range(N):\n",
|
||||
" state[k] = np.exp( 1j * 2*np.pi*j*k/N ) / np.sqrt(N)\n",
|
||||
" qc_prep = QuantumCircuit(qr)\n",
|
||||
" qc_prep.initialize(state,qr)\n",
|
||||
" return qc_prep\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Here's an example of using this function to show that an inverse QFT circuit works. Here I use the inverse QFT from Qiskit (which of course you cannot submit as your solution)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from qiskit import transpile\n",
|
||||
"from qiskit.circuit.library import QFT\n",
|
||||
"from qiskit_aer import AerSimulator\n",
|
||||
"\n",
|
||||
"# set an integer\n",
|
||||
"j = 8\n",
|
||||
"# and a number of qubits\n",
|
||||
"n = 5\n",
|
||||
"\n",
|
||||
"# create an inverse qft circuit\n",
|
||||
"qc_qft = QFT(n, inverse=True)\n",
|
||||
"# prepare the QFT of the integer on the same quanntum register\n",
|
||||
"qc_prep = state_prep(j, qc_qft.qregs[0])\n",
|
||||
"# create the combined circuit: first the prep, then the inverse qft\n",
|
||||
"qc = qc_prep.compose(qc_qft)\n",
|
||||
"# measure all qubits\n",
|
||||
"qc.measure_all()\n",
|
||||
"\n",
|
||||
"# run it, and see what integer comes out for 10 samples\n",
|
||||
"# (hopefully, it's the one you put in)\n",
|
||||
"backend = AerSimulator()\n",
|
||||
"for string in backend.run(transpile(qc,backend), shots=10, memory=True).result().get_memory():\n",
|
||||
" print(int(string, 2))"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "arc-decoder",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.6"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
@ -1,116 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Exercise Sheet 3 - Decoding the Repetition Code\n",
|
||||
"\n",
|
||||
"*These exercises require you to use a quantum SDK such as Qiskit. If you are having trouble setting up Qiskit or Python locally, you can use [this online service](https://lab.quantum-computing.ibm.com).*\n",
|
||||
"\n",
|
||||
"*For information about how many points each question is worth, contact the TA.*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 1 - Repetition code circuits\n",
|
||||
"\n",
|
||||
"*Note: You should not use Qiskit QEC for this exercise.*\n",
|
||||
"\n",
|
||||
"(a) Write a function to create Qisit circuits for linear repetition codes, for arbitrary code distance `d`, number of syndrome measurement rounds `T` and for both a stored logical `0` and logical `1`. Remember that, for the final set of syndrome measurememnts, there is no need for the `reset` gate after the final measurement. So leave this out in your circuits.\n",
|
||||
"\n",
|
||||
"(b) Transpile these to the backend `FakeSherbrooke` for distances from `d=3` to `d=55` and with `T=1`. This should be done such that the number of two-qubit gates prior to transpilation should be equal to the number of two-qubit gates after transpilation. Note that the native two-qubit gate for Sherbrooke is the `'ecr'` gate. The backend can be obtained with\n",
|
||||
"\n",
|
||||
" from qiskit.providers.fake_provider import FakeSherbrooke\n",
|
||||
" backend = FakeSherbrooke()\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"### 2 - Decoding graphs\n",
|
||||
"\n",
|
||||
"*Note: You should not use Qiskit QEC for this exercise.*\n",
|
||||
"\n",
|
||||
"In the lecture [Decoding 2: Correcting Errors](https://github.com/quantumjim/qec_lectures/blob/main/lecture-2.ipynb) we saw Qiskit QEC create a decoding graph for a Qiskit QEC repetition code. In this exercise, you will create the same thing for your own repetition code.\n",
|
||||
"\n",
|
||||
"(a) Write a function that can process the output of your repetition code, to find syndrome changes and create nodes for your decoding graph. For this you can draw heavy inspiration from [Decoding 1: Running Circuits and Interpreting Outputs](https://github.com/quantumjim/qec_lectures/blob/main/lecture-1.ipynb). To demonstrate your function, apply it to a few example output strings that result in both normal nodes and boundary nodes, and explain why it does what it does.\n",
|
||||
"\n",
|
||||
"(b) Using this, insert all possible single Paulis into your circuit to see what nodes result. Using `rustworkx` or `networkx`, create a graph in which edges link nodes that were found to result from the same inserted Paulis. In the end you should create an image such as the following one in [Decoding 2: Correcting Errors](https://github.com/quantumjim/qec_lectures/blob/main/lecture-2.ipynb) (but the numbers don't need to be the same).\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"For an idea of how to insert Paulis into a circuit, see the following example.\n",
|
||||
"\n",
|
||||
" from qiskit import QuantumCircuit\n",
|
||||
"\n",
|
||||
" # here's a circuit, into which we'll insert a Pauli\n",
|
||||
" qc = QuantumCircuit(2,2)\n",
|
||||
" qc.h(0)\n",
|
||||
" qc.cx(0,1)\n",
|
||||
" qc.measure([0,1],[0,1])\n",
|
||||
"\n",
|
||||
" # first we make a blank circuit\n",
|
||||
" error_qc = QuantumCircuit()\n",
|
||||
" for reg in qc.qregs + qc.cregs:\n",
|
||||
" error_qc.add_register(reg)\n",
|
||||
"\n",
|
||||
" # go through all the gates in the circuit\n",
|
||||
" for gate in qc.data:\n",
|
||||
" # add them to the new circuit\n",
|
||||
" error_qc.data.append(gate)\n",
|
||||
" # if one of them is a cnot\n",
|
||||
" if gate[0].name == 'cx':\n",
|
||||
" # find out what the control qubit is\n",
|
||||
" q = gate[1][0]\n",
|
||||
" # add an x as an 'error'\n",
|
||||
" error_qc.x(q)\n",
|
||||
"\n",
|
||||
" # the resulting circuit now has an x inserted on the control qubit\n",
|
||||
" # after every cnot\n",
|
||||
" error_qc.draw()\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"### 3 - A hexagonal code\n",
|
||||
"\n",
|
||||
"Consider a hexagonal lattice with periodic boundary conditions (wrapped around a torus), with a qubit at each vertex. A portion of this lattice is shown in Fig. (a) below, with the qubits in black.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Consider a QEC code in which the stabilizer generators consist of:\n",
|
||||
"* The $Z \\otimes Z$ operator on every vertical link, as seen in Fig. (b).\n",
|
||||
"* A plaquette operator $W_p = X \\otimes Y \\otimes Z\\otimes X\\otimes Y \\otimes Z$ defined on the 6 qubits around each hexagon. The qubits from left to right in this tensor product are those numbered from 0 to 5 in Fig. (b).\n",
|
||||
"\n",
|
||||
"(a) Show that these stabilizer generators mutually commute.\n",
|
||||
"\n",
|
||||
"(b) Find logical $X$ and $Z$ operators for the two stored logical qubits. Show that they have the correct communtation relations.\n",
|
||||
"\n",
|
||||
"(c) Repeat (a) and (b), but with for the code in which the $Y \\otimes Y$ operators are the stabilizer generators instead of the $Z \\otimes Z$ operators.\n",
|
||||
"\n",
|
||||
"(d) Devise circuits for mmeasuring the $Z \\otimes Z$, $Y \\otimes Y$ and $X \\otimes X$ operators. For these, use the additional grey qubits located on the edges of the lattice, and assume that two-qubit gates exist between these and their neighbouring black qubits.\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "arc-decoder",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.6"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 59 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 100 KiB |
Loading…
x
Reference in New Issue
Block a user