SwiftQuantumComputing
Quantum circuit simulator in Swift.
Usage
Check code in Circuit.playground.
Algorithms
- Use a genetic algorithm to automatically generate a quantum circuit - Check example in Genetic.playground.
- Two-level decomposition: Decompose any gate into an equivalent sequence of not gates and fully controlled phase shifts, z-rotations, y-rotations & not gates - Check example in TwoLevelDecomposition.playground.
Other algorithms
- Euclidean Algorithm: Find greatest common divisor of two integers - Check example in EuclideanAlgorithm.playground.
- Continued Fractions: Find an approximation to a given rational number - Check example in ContinuedFractions.playground.
- Gaussian Elimination: Solve a system of XOR equations - Check example in XorGaussianElimination.playground.
More examples
- Bernstein–Vazirani algorithm - Check code in BernsteinVaziraniAlgorithm.playground.
- Deutsch's algorithm - Check code in DeutschAlgorithm.playground.
- Deutsch-Jozsa algorithm - Check code in DeutschJozsaAlgorithm.playground.
- Grover's algorithm - Check code in GroverAlgorithm.playground.
- Shor's Algorithm - Check code in ShorAlgorithm.playground.
- Simon's periodicity algorithm - Check code in SimonPeriodicityAlgorithm.playground.
Linux
This package depends on BLAS if running on Linux, more exactly, Ubuntu.
This dependency is reflected in Package.swift
with CBLAS-Linux, which in turn expects to find the following file: /usr/include/x86_64-linux-gnu/cblas-netlib.h
. So, after installing BLAS (in case it is not already there):
sudo apt-get install libblas-dev
Check cblas-netlib.h
is in the expected location.