Skip to main content

Schrödinger and Schrödinger-Feynman simulators for quantum circuits.

Project description

qsim and qsimh

Quantum circuit simulators qsim and qsimh. These simulators were used for cross entropy benchmarking in [1].

[1], F. Arute et al, "Quantum Supremacy Using a Programmable Superconducting Processor", Nature 574, 505, (2019).

qsim

qsim is a Schrödinger full state-vector simulator. It computes all the 2n amplitudes of the state vector, where n is the number of qubits. Essentially, the simulator performs matrix-vector multiplications repeatedly. One matrix-vector multiplication corresponds to applying one gate. The total runtime is proportional to g2n, where g is the number of 2-qubit gates. To speed up the simulator, we use gate fusion [2] [3], single precision arithmetic, AVX/FMA instructions for vectorization and OpenMP for multi-threading.

[2] M. Smelyanskiy, N. P. Sawaya, A. Aspuru-Guzik, "qHiPSTER: The Quantum High Performance Software Testing Environment", arXiv:1601.07195 (2016).

[3] T. Häner, D. S. Steiger, "0.5 Petabyte Simulation of a 45-Qubit Quantum Circuit", arXiv:1704.01127 (2017).

qsimh

qsimh is a hybrid Schrödinger-Feynman simulator [4]. The lattice is split into two parts and the Schmidt decomposition is used to decompose 2-qubit gates on the cut. If the Schmidt rank of each gate is m and the number of gates on the cut is k then there are mk paths. To simulate a circuit with fidelity one, one needs to simulate all the mk paths and sum the results. The total runtime is proportional to (2n1 + 2n2)mk, where n1 and n2 are the qubit numbers in the first and second parts. Path simulations are independent of each other and can be trivially parallelized to run on supercomputers or in data centers. Note that one can run simulations with fidelity F < 1 just by summing over a fraction F of all the paths.

A two level checkpointing scheme is used to improve performance. Say, there are k gates on the cut. We split those into three parts: p+r+s=k, where p is the number of "prefix" gates, r is the number of "root" gates and s is the number of "suffix" gates. The first checkpoint is executed after applying all the gates up to and including the prefix gates and the second checkpoint is executed after applying all the gates up to and including the root gates. The full summation over all the paths for the root and suffix gates is performed.

If p>0 then one such simulation gives F ≈ m-p (for all the prefix gates having the same Schmidt rank m). One needs to run mp simulations with different prefix paths and sum the results to get F = 1.

[4] I. L. Markov, A. Fatima, S. V. Isakov, S. Boixo, "Quantum Supremacy Is Both Closer and Farther than It Appears", arXiv:1807.10749 (2018).

C++ Usage

The code is basically designed as a library. The user can modify sample aplications in apps to meet their own needs. The usage of sample applications is described in the docs.

Input format

The circuit input format is described in the docs.

NOTE: This format is deprecated, and no longer actively maintained.

Sample Circuits

A number of sample circuits are provided in circuits.

Unit tests

Unit tests for C++ libraries use the Google test framework, and are located in tests. Python tests use pytest, and are located in qsimcirq_tests.

To build and run all tests, run:

make run-tests

This will compile all test binaries to files with .x extensions, and run each test in series. Testing will stop early if a test fails. It will also run tests of the qsimcirq python interface. To run C++ or python tests only, run make run-cxx-tests or make run-py-tests, respectively.

To clean up generated test files, run make clean from the test directory.

Cirq Usage

Cirq is a framework for modeling and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.

To get started simulating Google Cirq circuits with qsim, see the tutorial.

More detailed information about the qsim-Cirq API can be found in the docs.

Disclaimer

This is not an officially supported Google product.

How to cite qsim

Qsim is uploaded to Zenodo automatically. Click on this badge DOI to see all the citation formats for all versions.

An equivalent BibTex format reference is below for all the versions:

@software{quantum_ai_team_and_collaborators_2020_4023103,
  author       = {Quantum AI team and collaborators},
  title        = {qsim},
  month        = Sep,
  year         = 2020,
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.4023103},
  url          = {https://doi.org/10.5281/zenodo.4023103}
}

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

qsimcirq-0.15.0-cp310-cp310-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.10Windows x86-64

qsimcirq-0.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

qsimcirq-0.15.0-cp310-cp310-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

qsimcirq-0.15.0-cp39-cp39-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.9Windows x86-64

qsimcirq-0.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

qsimcirq-0.15.0-cp39-cp39-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

qsimcirq-0.15.0-cp38-cp38-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.8Windows x86-64

qsimcirq-0.15.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

qsimcirq-0.15.0-cp38-cp38-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

qsimcirq-0.15.0-cp37-cp37m-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.7mWindows x86-64

qsimcirq-0.15.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

qsimcirq-0.15.0-cp37-cp37m-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

File details

Details for the file qsimcirq-0.15.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: qsimcirq-0.15.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for qsimcirq-0.15.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ab660a79fcd4a55fac547a03edecd87e44b846132f5e3a3263cbcd020831ab1a
MD5 7b05b4f5b9f1b1507706f6fbd7620455
BLAKE2b-256 e6955e3f0250407e73ee03e1c44c81e0ae969b7d75e44e65036f8338b30a3f80

See more details on using hashes here.

File details

Details for the file qsimcirq-0.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae362a46b7ea9faa69c890addb3d98f92f5a76eacb7218bd656d08e1a4557162
MD5 92681094630f861e9b21b35ed75ba1b3
BLAKE2b-256 b5bf3e09f51d013a3d1b6123b8ef05a651220b1a58ef1d0f8c29c2bd4484585b

See more details on using hashes here.

File details

Details for the file qsimcirq-0.15.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.15.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c0927e0abb43948ed49150f2d89c7bf989f490ba1e22c4bcffc426d8a8bcfad1
MD5 6b7ae4f220a6f23f4578742e802adb29
BLAKE2b-256 95e4a912a717a420a428190a7395225935768548efee2a68c1090328678fa711

See more details on using hashes here.

File details

Details for the file qsimcirq-0.15.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: qsimcirq-0.15.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for qsimcirq-0.15.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 45bee866c08d515ce42f2a3cf0418565c88546f285175dc67f74f0b6f132189a
MD5 9d6fc6ab53665de0b3af7e77b625e9b0
BLAKE2b-256 3dfa6f12424d0b8985d0e2a3c3271ae525a8b8cdf253a3208c2edb5342770063

See more details on using hashes here.

File details

Details for the file qsimcirq-0.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 693b7eed75506984f34366897710d46289318e2d27f9aec0477079ed94b01f61
MD5 19ec7e16abbb376ef76b70333e875b9a
BLAKE2b-256 a760cfcfb9ba3cbb13697b33fcac0ce47b3c3caf813935bd930ad2e6ac13ac9e

See more details on using hashes here.

File details

Details for the file qsimcirq-0.15.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.15.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b662810291857d8d3015e2da2e8bd714349603ba66e2b25e97a0a6c662d0ade8
MD5 a25e26c18d34332e502cb871719b232c
BLAKE2b-256 9a3ce6c0eba350e0d111cc62338c34998d9eb98f9ab8c4e7c6eb774705bceadf

See more details on using hashes here.

File details

Details for the file qsimcirq-0.15.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: qsimcirq-0.15.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for qsimcirq-0.15.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2601c2b2891beb976177215904e326f42c2a01de784a782690d242324f130204
MD5 8742af90bcd4f3cd4faaf2ae3ee8c54d
BLAKE2b-256 525e1db44c33f49dbfb19997b423077469e52f57abd596d57396423dd9d32495

See more details on using hashes here.

File details

Details for the file qsimcirq-0.15.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.15.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 edc8634644648aa2bd01a86e37320b0c0750682c57ec317a11a597ded9ec5850
MD5 6897a56b51a0e42ab69d997916c9dae2
BLAKE2b-256 d11e518e7b5521fb6c940fd3241ad4059255ab127f639e816392ddf042c5ce26

See more details on using hashes here.

File details

Details for the file qsimcirq-0.15.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.15.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a31fce9b1bf4f43af219b8a570b1172385098ceac77a37d6e01cdeedd3fa153d
MD5 c328149a55051b2c34544ec47c3aa3eb
BLAKE2b-256 0bcfa035f4e445a0454332ab85862d56414e15b55e7abae8f41a521777b9164f

See more details on using hashes here.

File details

Details for the file qsimcirq-0.15.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: qsimcirq-0.15.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for qsimcirq-0.15.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 0d34b72f01730593c6e283b222d5d492a00b922aa49974edfd91661ea9cf284d
MD5 2385a805c20a8a69d959cce30ec26807
BLAKE2b-256 783dea4841634f2c62f3cad8dfbe7e4c510ac36137c6d892af14598dd12ffb66

See more details on using hashes here.

File details

Details for the file qsimcirq-0.15.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.15.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9663b0bdf9810f192091f2d799ab85faa88c10d6ccbb2e7a9331fab702a692c2
MD5 ec63811b73980b4827dcfb5dd94c32b5
BLAKE2b-256 eee8989b596503d242ca5be226b270d4c4a7d4dc162850376c7c50936a4df75f

See more details on using hashes here.

File details

Details for the file qsimcirq-0.15.0-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.15.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ca9670703d88f5103764166144a25a421d00b124739aa0a8c8bc5bb7e9bc76e7
MD5 ee0ef5c2c0be93c695077728914e295c
BLAKE2b-256 f2e6d6c11d1c7d1acaec9dd7fe2f8abf89736e26e56deae7b1a22271e7ad9744

See more details on using hashes here.

Supported by

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