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
- GPU friendly,
- easily vectorized,
- differentiable, but
- supported environments are limited. (Ref. "Installation" section at JAX README)
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
sparsemodule 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 VectorU: Unitary Matrixaux: 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
- example/02-cnn-like-qcl-flax.py
- 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
- JAX
- PennyLane
- TensorFlow
- PyTorch
- Flax
- [1] K. Mitarai et al. "Quantum Circuit Learning", Phys. Rev. A 98, 032309 (2018)
- [2] D. M. Greenberger et al., "Going Beyond Bell's Theorem", arXiv:0712.0921
- [3] D. Coppersmith, "An approximate Fourier transform useful in quantum factoring", IBM Research Report RC19642
- [4] A. Kitaev, "Quantum measurements and the Abelian Stabilizer Problem", arXiv:quant-ph/9511026
- [5] M. Schuld et al., "Circuit-centric quantum classifiers", Phys. Rev. A 101, 032308 (2020)
- [6] S. Sim et al., "Expressibility and entangling capability of parameterized quantum circuits for hybrid quantum-classical algorithms", Adv. Quantum Technol. 2 (2019) 1900070
- [7] M. R. Geller, "Sampling and scrambling on a chain of superconducting qubits", Phys. Rev. Applied 10, 024052 (2018)
Metadata
Release files for diffqc 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| diffqc-0.0.2.tar.gz | 16.9 kB | Without provenance | Details for diffqc-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| diffqc-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for diffqc-0.0.2-py3-none-any.whl |
Total release size: 34.2 kB
Release files / diffqc-0.0.2.tar.gz
| Download URL | diffqc-0.0.2.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c41bd1c4c68056bcb2c23299068f6fa73cbe8dc5e8e84441b1ddff015f082c28
|
|
BLAKE2b-256 checksum How to use checksums |
a409699134020a1d1723f3be95a897489f843d46c8b848850020123227d6afa0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.1
|
Release files / diffqc-0.0.2-py3-none-any.whl
| Download URL | diffqc-0.0.2-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5654a30014caf1ddb95476c404040444c7bc9cf6a577d6407b976b378aaaa2b2
|
|
BLAKE2b-256 checksum How to use checksums |
2fe392a9eb42973c97ed3ea8f5f5868fede5f419e2133cb00f354c62ebc9b3d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.1
|
Security for diffqc 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.