SwiftQuantumComputing
Quantum circuit simulator in Swift.
Usage
Build & use a quantum circuit
Check full code in Circuit.playground.
Draw a quantum circuit
Check full code in Drawer.playground.
Algorithms
Use a genetic algorithm to automatically generate a quantum circuit
Check full code in Genetic.playground.
Two-level decomposition: Decompose any gate into an equivalent sequence faster to execute
When it comes to get the statevector produced by a circuit, single-qubit gates & fully controlled matrix gates (i.e. controlled matrix gates where all inputs but one are controls) can be simulated faster. This algorithm decomposes any gate/s into an equivalent sequence of not gates and fully controlled gates. In most cases, the new sequence will be faster to execute than the original.
Check full code in TwoLevelDecomposition.playground.
Euclidean Algorithm: Find greatest common divisor of two integers
Check full code in EuclideanAlgorithm.playground.
Continued Fractions: Find an approximation to a given rational number
Check full code in ContinuedFractions.playground.
Gaussian Elimination: Solve a system of XOR equations
Check full code in XorGaussianElimination.playground.
Examples
Check following playgrounds for more examples:
- BernsteinVaziraniAlgorithm.playground - Bernstein–Vazirani algorithm.
- DeutschAlgorithm.playground - Deutsch's algorithm.
- DeutschJozsaAlgorithm.playground - Deutsch-Jozsa algorithm.
- GroverAlgorithm.playground - Grover's algorithm.
- ShorAlgorithm.playground - Shor's Algorithm.
- SimonPeriodicityAlgorithm.playground - Simon's periodicity algorithm.