Package: diffqc
diffqc: Differentiable Quantum Circuit Simulator for Quantum Machine Learning1. OverviewNoteThis 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 onJAX, so
that it isGPU friendly,easily vectorized,differentiable, butsupported environments are limited. (Ref."Installation" section at JAX README)2. Featuresdiffqc provides 2 types of operations,denseandsparse. Both have
same operations and only internal representations are different.2.1denseoperationIndenseoperation, complex coefficients of all possible2**nqubitsstates are traced. This is simple matrix calculation but
requires exponentially large memory whennqubitsis large.2.2sparseoperationWarningsparsemodule is under depelopment, and is not ready to use.Insparseoperation, only neccessary states are traced. This might
reduce memory requirements at largenqubitssystem, but it can be
computationally inefficient.2.3 Builtin AlgorithmlibBuiltin algorithms are implemented atdiffqc.lib. To support bothdenseandsparseoperation, 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 PluginWarningPennyLane plugin is planned, but is still under development, and is not ready yet.PennyLaneis 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 Usageexample/00-circuit-basics.pyBasic Usage of diffqcexample/01-qcl-flax.pyQCL[1] Classification ofIriswithFlaxexample/02-cnn-like-qcl-flax.pyCNN-like QCL[1] Classification ofDigitswithFlaxexample/03-pennylane.pyPennyLane Pluginexample/04-builtin-variational-cercuit-centric.pyBuiltin Variational Circuit: Circuit Centric Block described at [5]According to [6], this is one of the best circuit.example/05-builtin-variational-josephson-sampler.pyBuiltin Variational Circuit: Josephson Sampler described at [7]According to [6], this is one of the best circuit.4. ReferencesJAXOfficial SiteRepository at GitHubPennyLaneOfficial SiteRepository at GitHubTensorFlowOfficial SiteRepository at GitHubPyTorchOfficial SiteRepository at GitHubFlaxOfficial SiteRepository at GitHub[1] K. Mitarai et al. "Quantum Circuit Learning", Phys. Rev. A 98, 032309 (2018)DOI:https://doi.org/10.1103/PhysRevA.98.032309arXiv:https://arxiv.org/abs/1803.00745[2] D. M. Greenberger et al., "Going Beyond Bell's Theorem", arXiv:0712.0921arXiv:https://arxiv.org/abs/0712.0921[3] D. Coppersmith, "An approximate Fourier transform useful in quantum factoring",
IBM Research Report RC19642arXiv:https://arxiv.org/abs/quant-ph/0201067[4] A. Kitaev, "Quantum measurements and the Abelian Stabilizer Problem",
arXiv:quant-ph/9511026arXiv:https://arxiv.org/abs/quant-ph/9511026[5] M. Schuld et al., "Circuit-centric quantum classifiers",
Phys. Rev. A 101, 032308 (2020)DOI:https://doi.org/10.1103/PhysRevA.101.032308arXiv:https://arxiv.org/abs/1804.00633[6] S. Sim et al., "Expressibility and entangling capability of
parameterized quantum circuits for hybrid quantum-classical algorithms",
Adv. Quantum Technol. 2 (2019) 1900070DOI:https://doi.org/10.1002/qute.201900070arXiv:https://arxiv.org/abs/1905.10876[7] M. R. Geller, "Sampling and scrambling on a chain of superconducting qubits",
Phys. Rev. Applied 10, 024052 (2018)DOI:https://doi.org/10.1103/PhysRevApplied.10.024052arXiv:https://arxiv.org/abs/1711.11026