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, navigate to the test directory and run:

make run-all

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.

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.11.2.dev20220104-cp39-cp39-win_amd64.whl (973.6 kB view details)

Uploaded CPython 3.9 Windows x86-64

qsimcirq-0.11.2.dev20220104-cp39-cp39-macosx_10_9_universal2.whl (1.2 MB view details)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

qsimcirq-0.11.2.dev20220104-cp38-cp38-win_amd64.whl (973.6 kB view details)

Uploaded CPython 3.8 Windows x86-64

qsimcirq-0.11.2.dev20220104-cp38-cp38-macosx_10_9_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

qsimcirq-0.11.2.dev20220104-cp37-cp37m-win_amd64.whl (968.4 kB view details)

Uploaded CPython 3.7m Windows x86-64

qsimcirq-0.11.2.dev20220104-cp37-cp37m-macosx_10_9_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

qsimcirq-0.11.2.dev20220104-cp36-cp36m-win_amd64.whl (968.3 kB view details)

Uploaded CPython 3.6m Windows x86-64

qsimcirq-0.11.2.dev20220104-cp36-cp36m-macosx_10_9_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

Details for the file qsimcirq-0.11.2.dev20220104-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: qsimcirq-0.11.2.dev20220104-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 973.6 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for qsimcirq-0.11.2.dev20220104-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 23bdadf23f39869c7f686bcb65fbc7e0d3adb3a21c61d8dbb0dfbbe31c1419c1
MD5 38525dc6c3a4273bfc80c9388afb68f1
BLAKE2b-256 094588aad9ab20b7c0b0ef4e4764e11f12f424bd4a6359964dcfc4bad2ea00bd

See more details on using hashes here.

File details

Details for the file qsimcirq-0.11.2.dev20220104-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.11.2.dev20220104-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2c2c9b17ef22f2b81afb446702b8f81b26ac4ed5741b338296daef5f56a3c291
MD5 700398423019a7d8407a05f342030f9b
BLAKE2b-256 a42abba5221fe41db8fa7893b44d8dd239efc761a6bc4b7b4c42521cb96910b6

See more details on using hashes here.

File details

Details for the file qsimcirq-0.11.2.dev20220104-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

  • Download URL: qsimcirq-0.11.2.dev20220104-cp39-cp39-macosx_10_9_universal2.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.9, macOS 10.9+ universal2 (ARM64, x86-64)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for qsimcirq-0.11.2.dev20220104-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 bffd7239730f58f2cdbc5940d10068ccec5bfffbe6b4e814a220f81e094f10e0
MD5 6f2f4a6e3afd76c5da9d1f858bee661a
BLAKE2b-256 1fcc9d02f4c78c0732109ee8661c6fdc7209f4437229c822bec68278fbcda66e

See more details on using hashes here.

File details

Details for the file qsimcirq-0.11.2.dev20220104-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: qsimcirq-0.11.2.dev20220104-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 973.6 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for qsimcirq-0.11.2.dev20220104-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 34f1d788d47c8b7ecd472d07a79599d4f59ee55504d6e58f83ff84ee70e17a81
MD5 80bc8b36e1a47af61ac0c3ca6fc34642
BLAKE2b-256 80372ff353cb1aa64ddc6c9cc51cf0819399c9ae747c63b27b563d5f205c6fa2

See more details on using hashes here.

File details

Details for the file qsimcirq-0.11.2.dev20220104-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.11.2.dev20220104-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 590d0ff01efa2688a3f71734afd9e7095704afae71b512fcf4bbc7440702915c
MD5 184a2017b3485ce926f38981aa1265fa
BLAKE2b-256 6623e8a0fba3a6652a62f9376b48bb15b77284ac316b4735a86a80bbf8f00bd6

See more details on using hashes here.

File details

Details for the file qsimcirq-0.11.2.dev20220104-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: qsimcirq-0.11.2.dev20220104-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for qsimcirq-0.11.2.dev20220104-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 48192c7c1cb7de9eb1b5022e38719678aedd8b9419f2d619fe8eb9112f0a14ba
MD5 f230e7bc2f7473cab788cbd1ff1d2992
BLAKE2b-256 6f4d2be4afea2fc6b89ee0e581df0df8213352b1889b3fcbc583cc7176676c8d

See more details on using hashes here.

File details

Details for the file qsimcirq-0.11.2.dev20220104-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: qsimcirq-0.11.2.dev20220104-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 968.4 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for qsimcirq-0.11.2.dev20220104-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c1e87ec78570fee8ed660abde62d4d209906b9be79b09903ec5a9fff5bce5bc2
MD5 36522e48489d95e33a61df3bac6d79cb
BLAKE2b-256 5bf2ba313816d198c0fff822272ccf89052cbe1fc1a31b6c796dd5ce41e6415a

See more details on using hashes here.

File details

Details for the file qsimcirq-0.11.2.dev20220104-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.11.2.dev20220104-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2aa8213d455eb659d5fbd9882eacec20eb60c9075e3814c8feb94af1c4634c71
MD5 959268fc21cc9fcc686a3d28788b4f65
BLAKE2b-256 3e8ed2d14292f03594a3bb3bd12e2a1c87efd86a690e6a0f7a0ba082ab3c3375

See more details on using hashes here.

File details

Details for the file qsimcirq-0.11.2.dev20220104-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: qsimcirq-0.11.2.dev20220104-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for qsimcirq-0.11.2.dev20220104-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 da43f402144f897eb8543340c8efe093ccdebc8705f307560aa9ef557b79fa11
MD5 fd9efe89b26976273c38438928a22b23
BLAKE2b-256 92f0e59771b587670e2e06aa82d9b94b6830f0086683d3b8367d3d789afb6c6e

See more details on using hashes here.

File details

Details for the file qsimcirq-0.11.2.dev20220104-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: qsimcirq-0.11.2.dev20220104-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 968.3 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for qsimcirq-0.11.2.dev20220104-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 90be4cea86a8f0ff16da078bf25a6ca007858f28f68e828718226aa5312c5ceb
MD5 2829163bce5e5beceafded42033b24a7
BLAKE2b-256 578dbf1e0bdbc5cb35960a6016ef6d75f7fb09f0432423be3b880244b1758586

See more details on using hashes here.

File details

Details for the file qsimcirq-0.11.2.dev20220104-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.11.2.dev20220104-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 63b9dcea21f59f203f16939ab016bb5a140c8f0b3a9c791c4dad2f22a065b0a5
MD5 fe1655e59f20247b5ba1d13d35d85138
BLAKE2b-256 fc038ae82b9b59622094bf2c3c9dc002038e31bb944b1213f13d9c7c21b57c8e

See more details on using hashes here.

File details

Details for the file qsimcirq-0.11.2.dev20220104-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: qsimcirq-0.11.2.dev20220104-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for qsimcirq-0.11.2.dev20220104-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b45b8ceaa1cb3c1522c76d6db0014897d85dc744842675f55462250a079347e8
MD5 ed6e0b50a262ada825b375d0505083d9
BLAKE2b-256 5abbf040e3f9b30847564e58e11a44204161844fefcc7682289a24043e5534f1

See more details on using hashes here.

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