Skip to main content

Schrödinger and Schrödinger-Feynman simulators for quantum circuits.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qsimcirq-0.22.0.tar.gz (133.6 kB view details)

Uploaded Source

File details

Details for the file qsimcirq-0.22.0.tar.gz.

File metadata

  • Download URL: qsimcirq-0.22.0.tar.gz
  • Upload date:
  • Size: 133.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.0

File hashes

Hashes for qsimcirq-0.22.0.tar.gz
Algorithm Hash digest
SHA256 90326abcfdfacd840cff61ca6c559ffc06ccf3bf6e631a5e44118894ff3109cb
MD5 7140c8bdc55bf421eb0940348ee744fa
BLAKE2b-256 509d9f97f878b0aca4098cec7c9838e92b52af9e2290211bd0961fa9c38c8646

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page