Skip to main content

qsim

High-performance quantum circuit simulator for C++ and Python.

Licensed under the Apache 2.0 license C++ qsim project on PyPI Compatible with Python versions 3.10 and higher Archived in Zenodo

FeaturesUsageDocumentationCiting qsimContact

qsim is a state-vector simulator for quantum circuits. It is highly tuned to take advantage of vector arithmetic instruction sets and multithreading on computers that provide them, as well as GPUs when available. qsim also provides a Cirq interface (qsimcirq) and can be used to simulate quantum circuits written in Cirq.

Introduction

qsim is a Schrödinger full state-vector simulator: it models quantum computations by representing the quantum state of a system as a vector of complex numbers (a state vector) and evolving it through the application of quantum gates. One matrix-vector multiplication corresponds to the application of one gate. Essentially, the simulator performs matrix-vector multiplications repeatedly.

Being a full state-vector simulator means that qsim computes all the 2 n amplitudes of the state vector, where n is the number of qubits. The total runtime is proportional to g2 n, where g is the number of 2-qubit gates. To speed up simulation, qsim uses gate fusion (Smelyanskiy et al., arXiv:1601.07195, 2016; Häner and Steiger, arXiv:1704.01127, 2017), single-precision arithmetic, AVX/FMA instructions for vectorization, and OpenMP for multithreading (on hardware that provides those features).

qsim was used to produce landmark cross-entropy benchmarking results published in 2019 (Arute et al., "Quantum Supremacy Using a Programmable Superconducting Processor", Nature vol. 574, 2019).

Usage

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.

Python usage

The qsim-Cirq Python interface is called qsimcirq and is available as a PyPI package for Linux, MacOS and Windows users. It can be installed by using the following command:

pip install qsimcirq

qsimcirq is also available for Conda for Linux and MacOS. To install it from conda-forge, you can use the following command:

conda install -c conda-forge qsimcirq

Note: The core qsim library (located in the source repository under the lib/ subdirectory) can be included directly in C++ programs without installing the Python interface.

Cirq usage

Cirq is a framework for modeling and invoking Noisy Intermediate-Scale Quantum (NISQ) circuits. Cirq can use qsim as its simulation library. To get started with simulating Cirq circuits using qsim, please refer to the tutorial.

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

Input format

[!WARNING] This format is deprecated, and no longer actively maintained.

The circuit input format is described in the docs.

Sample circuits

A number of sample circuits are provided in circuits.

Unit tests

Unit tests for C++ libraries use the GoogleTest 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

qsim documentation

Please visit the qsim documentation site guides, tutorials, and API reference documentation.

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}
}

Contact

For any questions or concerns not addressed here, please email quantum-oss-maintainers@google.com.

Disclaimer

This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.

Copyright 2019 Google LLC.

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.22.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

qsimcirq-0.22.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

qsimcirq-0.22.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

qsimcirq-0.22.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

File details

Details for the file qsimcirq-0.22.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.22.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1c2f5d8f38ba2cc2a808bb6e6ccb91701b11d810357eeb4d888a664ba45bb395
MD5 760c570841325061981d91f6420709d0
BLAKE2b-256 864a125c20cdd83587c9cf95f1f8345375547b3c8f590348552012ebbe703f76

See more details on using hashes here.

File details

Details for the file qsimcirq-0.22.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for qsimcirq-0.22.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3519287025c3ae876500b563a16e046c3f7ff4629f42307a499f7bd9377af221
MD5 974d12e35d70db700cb1c6d834a20c30
BLAKE2b-256 3daed2b6e9e3e4e2169c59573f30b3be787e0cc1d0e2602763a310c6b8d66988

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.22.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 82dc81fc1be7941abd77696dcd278a4aede785798b6d3ebd9291be686882e193
MD5 05cfdd79c35fa60518097482caa236d1
BLAKE2b-256 70298763650166b4b0c81431ed93e0c2d34faa597d55cab763224a69e19e88dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.22.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 97dd7c804a46f3b241b3932f9ee0e5a4f1fc342ba716cc116a730808b0332c82
MD5 d09b3691285762e6f9606f52435dbd7f
BLAKE2b-256 5f610dbebecc7b338efec7be7f5cefbf097905d8c306a4d70c5cbcb28b0502a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qsimcirq-0.22.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 86937420a97718415fef23bcbec0013fb3eb28f2d81a5113aab74e91bcf060a0
MD5 d510c01a1debc9dfc47ae062f7c29394
BLAKE2b-256 36ac2a6f8ca532a8487de2d2595e0b76a43fd9992bec3e40878166effc61e627

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.22.1 This release

5 files

0.22.0

21 files

0.21.0

18 files

0.20.2

18 files

0.20.0

18 files

0.19.0

15 files

0.18.0

15 files

0.17.0

15 files

0.16.3

15 files

0.16.2

12 files

0.16.1

12 files

0.16.0

12 files

0.15.0

12 files

0.14.1

12 files

0.14.0

12 files

0.13.3

12 files

0.13.1

12 files

0.13.0

12 files

0.12.1

12 files

0.12.0

12 files

0.11.1

12 files

0.10.3

12 files

0.10.2

12 files

0.10.0

4 files

0.9.5

1 file

0.9.2

1 file

0.9.0

1 file

0.8.0

1 file

0.7.1

1 file

0.7.0

1 file

0.6.0

1 file

0.5.1

1 file

0.5.0

1 file

0.4.1

1 file

0.3.1

1 file

0.3.0

1 file

0.2.0

1 file

0.1.0

1 file

0.0.3

1 file

0.0.2

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page