Skip to main content

Diiferentiable Quantum Simulator

Project description

diffqc: Differentiable Quantum Circuit Simulator for Quantum Machine Learning

1. Overview

Note
This project started as diffq, but because of accidental name conflict, we changed name to diffqc.

diffqc is a python package providing differentiable quantum circuit simulator. The main target is quantum machine learning.

diffqc is built on JAX, so that it is

2. Features

diffqc provides 2 types of operations, dense and sparse. Both have same operations and only internal representations are different.

2.1 dense operation

In dense operation, complex coefficients of all possible 2**nqubits states are traced. This is simple matrix calculation but requires exponentially large memory when nqubits is large.

2.2 sparse operation

Warning
sparse module is under depelopment, and is not ready to use.

In sparse operation, only neccessary states are traced. This might reduce memory requirements at large nqubits system, but it can be computationally inefficient.

2.3 Builtin Algorithm lib

Builtin algorithms are implemented at diffqc.lib. To support both dense and sparse operation, operation module is passed to 1st argument.

  • GHZ(op, c: jnp.ndarray, wires: Tuple[int])
    • Create Greenberger-Horne-Zeilinger state [2]
    • |00...0> -> (|00...0> + |11...1>)/sqrt(2)
  • QFT(op, c: jnp.ndarray, wires: Tuple[int])
    • Quantum Fourier Transform (without last swap) [3]
  • QPE(op, c: jnp.ndarray, wires: Tuple[int], U: jnp.ndarray, aux: Tuple[int])
    • Quantum Phase Estimation [4]
    • wires: Eigen Vector
    • U: Unitary Matrix
    • aux: Auxiliary qubits. These should be |00...0>.

2.4 PennyLane Plugin

Warning
PennyLane plugin is planned, but is still under development, and is not ready yet.

PennyLane is a quantum machine learning framework. By using PennyLane, we can choose machine learning framework (e.g. TensorFlow, PyTorch) and real/simulation quantum device independently, and can switch relatively easy.

3. Example Usage

  • example/00-circuit-basics.py
    • Basic Usage of diffqc
  • example/01-qcl-flax.py
    • QCL[1] Classification of Iris with Flax
  • example/02-cnn-like-qcl-flax.py
    • CNN-like QCL[1] Classification of Digits with Flax
  • example/03-pennylane.py
    • PennyLane Plugin
  • example/04-builtin-variational-cercuit-centric.py
    • Builtin Variational Circuit: Circuit Centric Block described at [5]
    • According to [6], this is one of the best circuit.
  • example/05-builtin-variational-josephson-sampler.py
    • Builtin Variational Circuit: Josephson Sampler described at [7]
    • According to [6], this is one of the best circuit.

4. References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diffqc-0.0.2.tar.gz (16.9 kB view hashes)

Uploaded Source

Built Distribution

diffqc-0.0.2-py3-none-any.whl (17.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page