GitPedia

Qsim

Fast C++ and Python library for state-vector simulation of quantum circuits.

From quantumlib·Updated June 14, 2026·View on GitHub·

High-performance quantum circuit simulator for C++ and Python. The project is written primarily in C++, distributed under the Apache License 2.0 license, first published in 2020. Key topics include: algorithms, api, cirq, cpp, google-quantum.

Latest release: v0.22.0qsim v0.22.0
June 24, 2025View Changelog →
<div align="center">

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

Features
Usage
Documentation
Citing qsim
Contact

</div>

qsim is a state-vector simulator for quantum circuits. Also known as a
Schrödinger simulator, it represents a quantum state as a vector of
complex-valued amplitudes (a state vector) and applies matrix-vector
multiplication to simulate transformations that evolve the state over time.

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

Features

Being a full state-vector simulator means that qsim computes all the
2<sup> n</sup> amplitudes of the state vector, where n is the number of
qubits. The total runtime is proportional to g2<sup>n</sup>, 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 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 includes a Cirq interface (qsimcirq)
    and can be used to simulate quantum circuits written in Cirq.

Usage

C++ usage

The code is designed as a library that can be included in users' applications.
The sample applications provided in the qsim
apps directory can be used
as starting points. More information about the sample applications can be found
in the qsim
documentation.

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:

shell
pip install 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.

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:

shell
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

Documentation

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

How to cite qsim<a name="citing-qsim"></a><a name="how-to-cite"></a>

When publishing articles or otherwise writing about qsim, please cite the qsim
version you use – it will help others reproduce your results. We use Zenodo to
preserve releases. The following links let you download the bibliographic
record for the latest stable release of qsim in some popular formats:

<div align="center">

Download BibTeX bibliography record for latest qsim
release  
Download CSL JSON bibliography record for latest qsim
release

</div>

For formatted citations and records in other formats, as well as records for all
releases of qsim past and present, please visit the qsim page on
Zenodo
.

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.

<div align="center"> <a href="https://quantumai.google"> <img width="15%" alt="Google Quantum AI" src="https://raw.githubusercontent.com/quantumlib/Cirq/refs/heads/main/docs/images/quantum-ai-vertical.svg"> </a> </div>

Contributors

Showing top 12 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from quantumlib/qsim via the GitHub API.Last fetched: 6/17/2026