Package: qsimcirq
qsim and qsimhQuantum 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).qsimqsim is a Schrödinger full state-vector simulator. It computes all the2namplitudes of the state vector, wherenis 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 tog2n, wheregis 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).qsimhqsimh 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 ismand the number of gates on
the cut iskthen there aremkpaths. To simulate a circuit with
fidelity one, one needs to simulate all themkpaths and sum the results.
The total runtime is proportional to(2n1+ 2n2)mk, wheren1andn2are 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 fidelityF < 1just by summing over a fractionFof all the paths.A two level checkpointing scheme is used to improve performance. Say, there
arekgates on the cut. We split those into three parts:p+r+s=k, wherepis the number of "prefix" gates,ris the number of "root" gates andsis 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.Ifp>0then one such simulation givesF ≈ m-p(for all the
prefix gates having the same Schmidt rankm). One needs to runmpsimulations with different prefix paths and sum the results to getF = 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++ UsageThe code is basically designed as a library. The user can modify sample
applications inappsto meet their own needs. The usage of sample applications is described in thedocs.Input formatThe circuit input format is described in thedocs.NOTE: This format is deprecated, and no longer actively maintained.Sample CircuitsA number of sample circuits are provided incircuits.Unit testsUnit tests for C++ libraries use the Google test framework, and are
located intests.
Python tests use pytest, and are located inqsimcirq_tests.To build and run all tests, run:make run-testsThis will compile all test binaries to files with.xextensions, and run each
test in series. Testing will stop early if a test fails. It will also run tests
of theqsimcirqpython interface. To run C++ or python tests only, runmake run-cxx-testsormake run-py-tests, respectively.To clean up generated test files, runmake cleanfrom the test directory.Cirq UsageCirqis a framework for modeling and
invoking Noisy Intermediate Scale Quantum (NISQ) circuits.To get started simulating Google Cirq circuits with qsim, see thetutorial.More detailed information about the qsim-Cirq API can be found in thedocs.DisclaimerThis is not an officially supported Google product.How to cite qsimQsim is uploaded to Zenodo automatically. Click on this badgeto 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}
}