SwiftQuantumComputing 10.0.0

SwiftQuantumComputing 10.0.0

Maintained by Enrique de la Torre.



  • By
  • Enrique de la Torre

A quantum circuit simulator in Swift

CI Status codecov.io Version platforms

In this repository you can find a quantum circuit simulator written in Swift and speeded up with Accelerate.framework in iOS/macOS and BLAS in Linux. Along side the simulator there is also a genetic algorithm to automatically generate circuits able to solve a given quantum problem.

The code written so far is mostly based on the content of: Quantum Computing for Computer Scientists, with a few tips from Automatic Quantum Computer Programming: A Genetic Programming Approach. It is also inspired by IBM Qiskit.

Usage

To create a circuit gate by gate:

Deutsch's Algorithm

Check DeutschAlgorithm.playground for the actual code.

Or check Genetic.playground to see how to configure the genetic algorithm to produce a quantum circuit:

Circuit generated with a genetic algorithm

Linux

As mentioned above, 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.