A collection of educational Jupyter notebooks focused on quantum algorithms.
We recommend setting up a dedicated Python environment before running
the notebooks. The project includes a requirements.txt file that
specifies all necessary dependencies.
Create a virtual environment and install dependencies:
python3 -m venv venv
. venv/bin/activate # On Windows: venv\\Scripts\\activate
pip install --upgrade pip
pip install -r requirements.txtAlternatively, if you prefer conda:
conda create -n openqcp-lab python=3.9
conda activate openqcp-lab
pip install -r requirements.txtYou can also use the provided POSIX shell script to create a virtual environment and install dependencies in one step:
./setup_env.shThis will create a venv directory (if it does not already exist),
install the required packages, and print instructions on how to
activate the environment.
If you have make installed, you can use the provided Makefile:
-
Create a virtual environment and install dependencies:
make env
-
Install dependencies in the current environment:
make install
After setting up the environment, start a Jupyter notebook server:
jupyter notebookor if you have migrated to JupyterLab:
jupyter labFrom the web portal, Jupyter notebooks could be opened and executed.
In newer versions of Jupyter server, it is possible to open an
.ipynb file in NbClassic, JupyterLab or Notebook.
Most Jupyter notebooks contain python codes and hence Jupyter would
use the preinstalled Python 3 (pykernel) kernel to execute codes
within them. However, in case a notebook requires running codes in
other languages such as Julia, R, SageMath, C, and ..., it is
possible to install the relevant
kernel or
even to make
kernels
on need basis. Having the required kernel, one could then switch to
that kernel from the corresponding Jupyter web-portal. Also, to run
different types of codes within a single notebook, one could take
advantage of magic.
Note: If you have installed the dependencies from requirements.txt,
the notebooks should run without requiring additional package
installations. Each notebook's README also documents its specific
software requirements for reference.
For information on reproducing figures and results from the notebooks, see REPRODUCING_RESULTS.md.
Good luck and have fun using these tutorials!
-
( 00 ) - Quantum Fourier Transform - Abelian groups case
Learn the mathematical foundations of QFT over finite Abelian groups and its applications in phase estimation and Hadamard test. -
( 01 ) - Quantum Machine Learning - minimize expectation value
Optimize variational quantum circuits using gradient descent to minimize expectation values of quantum observables. -
( 02 ) - Discrete-Time Quantum Walk - path graph
Implement quantum walk operators on graphs using coin and shift operators for a path graph with 16 nodes. -
( 03 ) - Non-Unitary Quantum Computing - lcu
Represent and manipulate non-unitary operations using Linear Combination of Unitaries (LCU) decomposition. -
( 04 ) - Quantum Optimization - qubo and vqe
Solve Quadratic Unconstrained Binary Optimization (QUBO) problems using Variational Quantum Eigensolvers (VQE). -
( 05 ) - Quantum Simulation - coupled harmonic oscillators
Simulate the dynamics of coupled classical harmonic oscillators using quantum Hamiltonian simulation with exponential speedup.
Copyright (C) 2023 Mohammadreza Khellat GNU GPL v3+
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.