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.14.1.dev20220804-cp310-cp310-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

qsimcirq-0.14.1.dev20220804-cp310-cp310-macosx_10_9_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

qsimcirq-0.14.1.dev20220804-cp39-cp39-macosx_10_9_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

qsimcirq-0.14.1.dev20220804-cp38-cp38-macosx_10_9_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

qsimcirq-0.14.1.dev20220804-cp37-cp37m-macosx_10_9_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file qsimcirq-0.14.1.dev20220804-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.14.1.dev20220804-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b8a738cbe61bc287bbb84125347e3106c1be4fead89557c438f725795e480c03
MD5 63164d655e48545416a08306bfecb9b9
BLAKE2b-256 d8fc1ebadfb92e7df03505fedbfccd7d91116ce5c86e5fbd024b17fce21ec3d0

See more details on using hashes here.

File details

Details for the file qsimcirq-0.14.1.dev20220804-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.14.1.dev20220804-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3fb9a7e878e87c972ecac224edadf5ef88c468402a823f5c1521d26fba9088b8
MD5 6101d74ab430467957e5d1f1b9f3ed6d
BLAKE2b-256 14e9ac873258368b477ed2ed06bccd4000e1ab8d450e9a0699fa841dc820dd19

See more details on using hashes here.

File details

Details for the file qsimcirq-0.14.1.dev20220804-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.14.1.dev20220804-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3ef8e8a1d02c7c4f431db9dac6a99d4afa3dd24e545f437baaceceb2ab9677f9
MD5 2ad47138c05076648375914de0c032ad
BLAKE2b-256 5bb9d2d1a0a675586b0aacdc037ca8d247c4ba84f2a4dde282b6ab125ee5280c

See more details on using hashes here.

File details

Details for the file qsimcirq-0.14.1.dev20220804-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.14.1.dev20220804-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a8abbf8e73371e7a247e3640c9b24578864915d73e4b4c2633c85cc3d6fc5115
MD5 2685e11eb7ecea3826905f915f639436
BLAKE2b-256 639057ec2306e05548d22cc254b3f042cabeef4d4c5fd100c41a8c5fd39e333c

See more details on using hashes here.

File details

Details for the file qsimcirq-0.14.1.dev20220804-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.14.1.dev20220804-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 186671eccd3b9fb5ee6c74bfda6decf6dce88e47516348984f62a014eb3ed24e
MD5 d6305b5412af2f2e8fad3aa774537275
BLAKE2b-256 98249672c1d90dfd0770b7665b71e7a9fa40cc01e20e835d42735d8365716a3c

See more details on using hashes here.

File details

Details for the file qsimcirq-0.14.1.dev20220804-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.14.1.dev20220804-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 638babb46b0afde6592a888b360c6cde2bee4d781e19bd991c16950fd1054d76
MD5 8c322ff9fcddfb3a5583dbabeaf4f4ba
BLAKE2b-256 80a3b1b3ee313802eeaec57d73251fa4e24ffab90a32cea8da5212c97494e717

See more details on using hashes here.

File details

Details for the file qsimcirq-0.14.1.dev20220804-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.14.1.dev20220804-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ade02266e29280f7c075bd254893bd3232f7b364c0b81b3f7c73420556a1b1b4
MD5 0c18375973c4c0ba1047b960cb01a3d3
BLAKE2b-256 80952961db57045cf4c07f7e91b8ffc8a3e6e6b9f5140401ee5718d0c3bf84ea

See more details on using hashes here.

File details

Details for the file qsimcirq-0.14.1.dev20220804-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.14.1.dev20220804-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9df10372c842344fab782422d8dfa2e719d372f04e2de3caf748d00c3ca82b8d
MD5 976b25bc493b60506cd7454b4682c922
BLAKE2b-256 752f30ac329711842d8c15c3529a7e824f6b568e8f47aa5fcaaa44d54a551280

See more details on using hashes here.

File details

Details for the file qsimcirq-0.14.1.dev20220804-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.14.1.dev20220804-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 066e0e3a10378a617e3b2e674d2d907fd91d8d252fc6c2782eebd737a5f9463d
MD5 059b0bc6f76b7cc7297d47422fe689fb
BLAKE2b-256 ab291013c80d01764010fb0bc5dcb5d93ce8ac6de5c2747388be681155a78713

See more details on using hashes here.

File details

Details for the file qsimcirq-0.14.1.dev20220804-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.14.1.dev20220804-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 0960e829e47ea90e84568f4d46deacd3a3882949198bbcc26eef6e202a91df08
MD5 d1eaa7a2a750fda72c4c780b82af8d9d
BLAKE2b-256 d41485c5b50ce4bec4c799de8744226ad04a8d9c263ce08ef485a2a01e2b9168

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.14.1.dev20220804-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cad8688c8a8e818b4fb9af67c2b9fbddc53dd94b7282f1f9f171df506d7c1753
MD5 fe2a564b1eb9522f43e17f44e3840fb0
BLAKE2b-256 a69826f52cc6360e4cde3a0a6a75b6f267074ea0a7fd53265e3efe5a0cef689d

See more details on using hashes here.

File details

Details for the file qsimcirq-0.14.1.dev20220804-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.14.1.dev20220804-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ac22242dd50ddd5abd89ae5028f40136cabd3c92438de42e7367a13ab2de9a4b
MD5 e37be4737a621d1555e472dd8d376fe4
BLAKE2b-256 ab05bf964c786699a194162908bcff6ca779240edfd38a238f9fcfff79556984

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