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 applications 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.21.0-cp312-cp312-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.12 Windows x86-64

qsimcirq-0.21.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

qsimcirq-0.21.0-cp312-cp312-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

qsimcirq-0.21.0-cp311-cp311-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.11 Windows x86-64

qsimcirq-0.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

qsimcirq-0.21.0-cp311-cp311-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

qsimcirq-0.21.0-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.21.0-cp310-cp310-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

qsimcirq-0.21.0-cp39-cp39-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.9 Windows x86-64

qsimcirq-0.21.0-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.21.0-cp39-cp39-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

qsimcirq-0.21.0-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.21.0-cp38-cp38-macosx_10_9_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

qsimcirq-0.21.0-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.21.0-cp37-cp37m-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file qsimcirq-0.21.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d7b43c86a89c726d1d205ca833b3a98608236bfde7642f0d51648fc80d870055
MD5 13228375ee7ad421d9caf41be24b9889
BLAKE2b-256 9ebbda3beec25d7837ccba4c25ba91fbe0d6c32281252c451ad906d015eb6d20

See more details on using hashes here.

File details

Details for the file qsimcirq-0.21.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3d9a977c58f5d8a928f746ad00f7d4b7986af38b3692bc360ba6a7a44045b18d
MD5 e5345ca8cea437048d933de4be8429a6
BLAKE2b-256 191b536fc375e3c387cceca3d5e2fb511dc8bb7644284179574551059de33803

See more details on using hashes here.

File details

Details for the file qsimcirq-0.21.0-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 979f1cb1a712eafadc3269da8514e7688cf9a0013d8b9570795f6e5b73b4958a
MD5 77b024bd5f3daa72cda3720873c7c968
BLAKE2b-256 7ebf62ccdb6c9981a4a2fc1763274a6cb90df100c659d5dbbae7bba2986a5fa8

See more details on using hashes here.

File details

Details for the file qsimcirq-0.21.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2ee2e95897e5592582ebd2a600bc44d692dac3f058be745abb4e895466e38f5b
MD5 9f313ca1f00257987beba41b539e4cbf
BLAKE2b-256 8f2b17225e9a3d06733e10421e6bb47845031abc12ee77f0685620f11805fae0

See more details on using hashes here.

File details

Details for the file qsimcirq-0.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 74727df453065bd44faeb748fb54c60a5d1e571e59a8c6e7d76033c2ccb69d91
MD5 9019fe861f5e2f48cccac4b1a15f784c
BLAKE2b-256 1183dac291842f9834d7b13e4c5218f9ed1c26ede78d37b8e5ff06241a956f6a

See more details on using hashes here.

File details

Details for the file qsimcirq-0.21.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 27b2c9afcc3746ebb9e4a10043c46c16559f761f4a41b370ea70bb0954888f2b
MD5 30b8f33c9edbabfd61e616c679d056e3
BLAKE2b-256 e05671d87f211bc155e18d0a19da4741387a8046c6901ec55207021b247164d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0146e1dd3b35422f0c7e61a75378a0a97c91e9df867769a352c6b60468743fa0
MD5 f699b6bc404120c77b385a2134713586
BLAKE2b-256 e23993acab31e71454eafcab804993ffa58f624731fb81ff2e715ba49b14685b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f8b921ec75b00cd9e1cda733bdf077de88899bacec46735554a4f8178775e9b
MD5 e085d1a5249bf9faebd65565ee690113
BLAKE2b-256 e7cd09ba01467549d03adc82f00e95f7833ea5c0df3eb784f54627698977cd30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7551576e7e9a2a5ed59d4a171b27aafef286f019d1863ebc18398f7f60132633
MD5 fedfd2d17eb8285f3f603cace8158c23
BLAKE2b-256 54fed81714ccdc745420843ad5312debcb2321583819e9e2b0ef7846c6546f23

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qsimcirq-0.21.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for qsimcirq-0.21.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ffe0a6f39d837194bfcda8d7e6944a9afe4060b27d211d440413a4e6aa7d4a05
MD5 fbbf6fccb9e1d019ffd4f11700d635cc
BLAKE2b-256 62666cdde4e6dec63b34a4c6e2bb0582805f7dca748cfb2f8787789a47e3a183

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3657e6f1e949be683fdf597b8d6e15c166be39f54d260e65c25a8b82da2cb11b
MD5 8d8e782403a22d043d27586fea080b39
BLAKE2b-256 2940f0fedade176abeb2b3006ce96cbe8f18a5f6470040e17abee7c9f3265778

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8e894673090cf17e46cd27561b2cce921a81b769f88a3d028c4834cede7d0ea8
MD5 bc658598838dff05dba7607eac5dc00b
BLAKE2b-256 e576dc055df3a13846744632d875fb107d34dcd3ef2b59bc5dd6962f0090ea97

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qsimcirq-0.21.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.2 CPython/3.11.8

File hashes

Hashes for qsimcirq-0.21.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4534c08de69fe902c0707462b462ca0dd43f9cea4503879fa16641f8b2a7501f
MD5 fbb0f386ab7b3c9ab311edc03e774d5d
BLAKE2b-256 b154f7f74e4998b46c5ec08b905eadb68e1a6f5409f9fe5d42869ca36a462462

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 de72798003fa1b81ad93be04f5e03526c162770379dc6d8e5ef331a6b503ee72
MD5 0e7a345f9e463d2e004f2089f4e27df1
BLAKE2b-256 48adb257981fe94f3c0c7f728c70d1cb901304de6323259c31979a8145e695a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 26cb53d36a9c062500cab7b1f61e6de0b9493195ab36dbffc1a1400b6d0e9338
MD5 e1efa06af5bb47c62e7f11a94ec16774
BLAKE2b-256 e90d8683da74b2e2cfbb4e0469e58bc363dd2024d93173a6ae31967d4d02c294

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 195afd8104577959f9a5835e9ce1fc3df0d3dc5cabc8a98e7b89c79c7823cf49
MD5 8a97080914e532bf8ec1f7247d77a660
BLAKE2b-256 32583b13d7f1a984611b8a3521d7ee272ad1db916e47a0f91418bfc663980aa1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 01c7a0486922600f7b715724df255796cd9742417ef04aa0141bf2e3df53cafe
MD5 e5b54ec34c5134827066bbb5662116e2
BLAKE2b-256 6c779072fb746935b71612deae9dc9d4d0890a5087648569884e2f5e59f5a9e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.21.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b2ea297a41b49c2ee20a4809e300b96d23ed4741b4e72939fce675034bb8c35a
MD5 e4395ba66117736254de869c80109762
BLAKE2b-256 933eb22cc92ba637146e1b932efd42b44516f6d919158a618344e45056a20482

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