This is the repo for Li-Heng Henry Chang's Senior project "Compiling Qauntum Programs" at Bard College, NY.
The thesis can be accessed at source, static pdf or on Bard Digital Commons.
The goal of this repository is to use simple code to demonstrate the implementation of the Universal Decomposition and the Solovay-Kitaev algorithm without going into the theories that require high-level math. This will allow us to build a simple compiler as the important conceptual peices used to build a quantum compiler.
This repository builds a compiler with two components:
- Universal Decomposition decomposes a quantum program
$U$ into CNOT and single qubit gates (two-level) unitaries. - The single qubit gates are further approximated using the Solovay-Kitaev algorithm. In the compiler we use the Qiskit built-in Solovay-Kitaev algorithm since Qiskit provides a easy way to represent quantum gates and plot nice circuit diagrams.
UDSKcompiler.ipynb
is the final compiler file that is used.SKalgo.ipynb
is a file that implements the Solovay-Kitaev thoerem from scratch.qiskitSK.ipynb
is a example file for using the Solovay-Kitaev algorithm inside the Qiskit library.
numpy
(1.23.3) for matrix operationsscipy.stats
for generating random unitary matrixqiskit
(0.42.0) for circuit diagram and SolovayKitaevSynthesis
- Sort the final compiler file.
- Find main references
We follow the implementation of this repo to decompose a general unitary matrix into two-level ones. This gives us a product of two-level matrices, which is further approximated using the Solovay-Kitaev algorithm.