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

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

Uploaded CPython 3.9 Windows x86-64

qsimcirq-0.13.1-cp39-cp39-manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9

qsimcirq-0.13.1-cp39-cp39-macosx_10_9_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

qsimcirq-0.13.1-cp38-cp38-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.8 Windows x86-64

qsimcirq-0.13.1-cp38-cp38-manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8

qsimcirq-0.13.1-cp38-cp38-macosx_10_9_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

qsimcirq-0.13.1-cp37-cp37m-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.7m Windows x86-64

qsimcirq-0.13.1-cp37-cp37m-manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.7m

qsimcirq-0.13.1-cp37-cp37m-macosx_10_9_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

qsimcirq-0.13.1-cp36-cp36m-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.6m Windows x86-64

qsimcirq-0.13.1-cp36-cp36m-manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.6m

qsimcirq-0.13.1-cp36-cp36m-macosx_10_9_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: qsimcirq-0.13.1-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.9.13

File hashes

Hashes for qsimcirq-0.13.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9e116ba84d7fa737b0a3f2b81d36ceee180d92a895429d7a020789a05669aa57
MD5 bf9075842bce630825ca0a547f7ee8b8
BLAKE2b-256 ebf6d06400d5fc4c3588f9526986a4ff14188a5f39322d437ed7680d313e6d32

See more details on using hashes here.

Provenance

File details

Details for the file qsimcirq-0.13.1-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.13.1-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 84fed077dd8ed3894855d5b6f1c88424aa7d41a0e9d2e0aaccff28f1338c4847
MD5 0b3a4fa1ac01cf62782a9da2ec89c62c
BLAKE2b-256 d01f70dea0816941c4fd1087f329d4edcd70645a5a3468e69ce4a9ee20aebc89

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.13.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5ddfcd8b06f4597eec116aa2d486f26fab84912efb288cafbf28d6f2c9397406
MD5 7e94b98ef27e292562f11e9d9c02b3bb
BLAKE2b-256 2fe0ff58a96dcea6b38df4c067d077050b3f9c9c3f6868fff23c93c85af86546

See more details on using hashes here.

Provenance

File details

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

File metadata

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

File hashes

Hashes for qsimcirq-0.13.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 abb1eb20a806213a48aa07c3585d7f1b52d678283b4ce5c39d53547dd74f7464
MD5 09cb284ef15a433af997b13c51be7706
BLAKE2b-256 98084e660d7dcfe7ac88e6ca337b71f8ff6ade9600a3b219619e8e3b4eab8188

See more details on using hashes here.

Provenance

File details

Details for the file qsimcirq-0.13.1-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.13.1-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea1b80c6784dc8b4f0a8e1b00254a6a92d9e9a67c67a15c80b122f9eb1857c66
MD5 aa22129d480af8429f2029c6d8604402
BLAKE2b-256 13a0f23d71ae6f92c0883c53759a0de2454ff342b0e1797f042bbb54a7ae14bd

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.13.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2e6a79d32363dd5b5a4fd256451e0cf673347ef14af997c0e470c0a73c6045c4
MD5 46f6096a0895e4ec5452b51ce59a050a
BLAKE2b-256 2e12a1f7bce20915c97fb7f0d35d054f02d32de4bfbf76f6ac34a520b39caafc

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.13.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 9546191932cafbbbb8a868a87748f820a88735d2dd25552df32465067153bf19
MD5 7f0e999a241d462ca730fba0f9d461f3
BLAKE2b-256 879d3f33839ee73f419002c088435a1b1b9489e1723d2211058593a5c1e3a1d3

See more details on using hashes here.

Provenance

File details

Details for the file qsimcirq-0.13.1-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.13.1-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 baa7264c8a06f32d1d57fbcca0e8157aa7d23571732c6a81d99d565b7e6d8b63
MD5 47c417e7f97f7cc0905cbf802c1ab9be
BLAKE2b-256 67e5eaa35d77339afdc41c448b5fadf99e73450026a9b7ee64b777754c26e730

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.13.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 055c97d5923e0478fec99fb1b55a4152bbb6fc21012892235cc81d4f0d29ba7d
MD5 327bf79995a50d87dc7a82a80debf60b
BLAKE2b-256 bcbcc2d442f3834dbf415cf7e7150c4c0988b0ce3a957cccbe639626880b2290

See more details on using hashes here.

Provenance

File details

Details for the file qsimcirq-0.13.1-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.13.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 18ab1743217cc0790f789c25e76e6be161594eae16696173fe92d4a17182770e
MD5 8750c53bb226d8947e5ee48ef2a3a755
BLAKE2b-256 99133022acc3001e3b5ae579adae29ce68fd0b2902a8c3217edba31116c73d7f

See more details on using hashes here.

Provenance

File details

Details for the file qsimcirq-0.13.1-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.13.1-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b823d73408e35967bb558d537cdd84771e5f3e0f96ebfed27d3f8ea8e9b36bc
MD5 2c09ec49471771c589b77e7b2d4a34f0
BLAKE2b-256 3bc4376a33a3415dc619841d02c383274b055aebfb7cb5c86b1f3254fe7598f7

See more details on using hashes here.

Provenance

File details

Details for the file qsimcirq-0.13.1-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.13.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aeea93a9a8a7b09016efe5d35c7f513cd2746ef67a44c2debed3e238489a0bc7
MD5 35496642d80dc4b348da899b617b803a
BLAKE2b-256 05de27a3307f124e24b76b4121cc5da795a8218a369ca9fcb5b0074ce2ba11d2

See more details on using hashes here.

Provenance

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