Skip to main content

qevedo-simulator

Python bindings of qvd, a fast quantum circuit simulator written in Rust. It installs as qevedo-simulator and imports as qevedo.simulator.

pip install qevedo-simulator          # add [numpy] for NumPy state vectors
from qevedo.simulator import Circuit, expectation, run, statevector

bell = Circuit(2).h(0).cx(0, 1).measure_all()
result = run(bell, shots=1000, seed=1)
print(result.counts, result.backend)  # {'00': ..., '11': ...} stabilizer

# OpenQASM 2 or 3 text works anywhere a circuit does.
result = run("""
OPENQASM 3.0;
include "stdgates.inc";
qubit[3] q;
bit[3] c;
h q[0];
cx q[0], q[1];
ccx q[0], q[1], q[2];
c = measure q;
""", shots=1000)

state = statevector(Circuit(3).h(0).cx(0, 1).t(2))  # NumPy complex128 array

# Expectation values by Pauli propagation, far beyond a state vector:
# a Pauli string, a {string: coefficient} dict or a Qiskit SparsePauliOp.
e = expectation(Circuit(2).h(0).cx(0, 1), {"Z0 Z1": 1.0, "X0 X1": 0.5})
print(e.value, e.truncated_one_norm)  # 1.5, and a bound on its error (0)

Clifford circuits can carry Pauli noise channels (x_error, y_error, z_error, pauli_channel_1, depolarize1, depolarize2, pauli_channel_2, Stim's channels), sampled independently in every shot by the stabilizer backend. sample returns the raw measurement records, measurement-major like Stim's FlipSimulator, and to_stim writes the same circuit for Stim:

from qevedo.simulator import Circuit, sample

c = Circuit(3)
for _ in range(10):                      # a small repetition code
    c.reset(1).x_error(1, 0.001)
    c.cx(0, 1).depolarize2(0, 1, 0.001).cx(2, 1).depolarize2(2, 1, 0.001)
    c.x_error(1, 0.001).measure(1, c.num_clbits)
bits = sample(c, 100_000, seed=1)        # NumPy bool array, (10, 100000)
print(c.to_stim().splitlines()[:3])      # ['R 1', 'X_ERROR(0.001) 1', 'CX 0 1']

Error-correction circuits written in Stim's format (text or a stim.Circuit, for example from stim.Circuit.generated) run directly. sample_detectors returns detection events and observable flips, shot-major as Stim's detector sampler returns them and as decoders take them; from_stim gives the Circuit with its detectors and observables as lists of measurement indices, and sample takes Stim text too:

import pymatching, stim
from qevedo.simulator import sample_detectors

circuit = stim.Circuit.generated("surface_code:rotated_memory_z", distance=5, rounds=5,
                                 after_clifford_depolarization=0.003)
detectors, observables = sample_detectors(circuit, 100_000, seed=1)  # (100000, 120), (100000, 1)
matching = pymatching.Matching.from_detector_error_model(circuit.detector_error_model(decompose_errors=True))
logical_error_rate = (matching.decode_batch(detectors) != observables).any(axis=1).mean()

bit_packed=True returns uint8 arrays with eight detectors per byte (detector d in bit d % 8 of byte d // 8), Stim's packing and an eighth of the memory, as decoders that take packed input expect; sample(..., bit_packed=True) packs eight shots per byte. All of these are written by Rust into the array's memory, without a copy in Python.

The reader takes Stim's Clifford gates, M/MX/MY/MR/MRX/MRY with measurement-flip probabilities (M(0.01)) and inverted targets (M !3), R/RX/RY, MPAD, Pauli product measurements (MPP X0*Y1*Z2, MPP(0.01) !Z3*Z4), the Pauli channels including PAULI_CHANNEL_2, correlated errors (E, ELSE_CORRELATED_ERROR), DETECTOR, OBSERVABLE_INCLUDE and nested REPEAT blocks; anything else (heralded errors, MXX/MZZ, classical control, ...) is an error naming the line. A chain of correlated errors read from Stim appears in instructions() as one correlated_error with each product's unconditional probability; to_stim() writes it back as the chain.

run chooses the simulation method automatically:

Backend For Scale on one workstation
stabilizer Clifford circuits, with Pauli noise tens of thousands of qubits
near_clifford Clifford circuits with few non-Clifford gates hundreds of qubits, ~30 active
statevector anything that fits in memory (AVX2 kernels, gate fusion) ~32 qubits
mps low-entanglement circuits 100+ qubits, approximate beyond χ

Pass backend= to force one. The result reports the method that ran, its timings, and the MPS fidelity estimate or the near-Clifford peak active qubits. Simulations release the GIL.

expectation propagates the observable backwards through the circuit (Cliffords for free, small coefficients dropped), for up to 1024 qubits: <Z62> of IBM's 127-qubit, 20-step kicked Ising circuit takes 0.25–9.6 s at the thresholds in the main README's benchmark.

x86-64 wheels are built for AVX2 + FMA processors (2013–2015 or newer); other x86-64 machines can build from source with a Rust toolchain.

From Qiskit

pip install qevedo-simulator[qiskit] (Qiskit 2.x). qevedo.simulator.qiskit has a backend and the V2 primitives:

from qiskit import QuantumCircuit, transpile
from qevedo.simulator.qiskit import QevedoEstimator, QevedoSampler, QevedoSimulator

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)

backend = QevedoSimulator()              # BackendV2: any standard gate, no coupling map
measured = qc.measure_all(inplace=False)
counts = backend.run(transpile(measured, backend), shots=1000).result().get_counts()

bits = QevedoSampler(seed=1).run([measured], shots=1000).result()[0].data.meas    # BitArray
evs = QevedoEstimator().run([(qc, ["ZZ", "XX"])]).result()[0].data.evs            # [1. 1.]
  • QevedoSimulator runs circuits with run, so it picks the method the same way and reports it in result.results[i].metadata["method"]. Options: shots, seed_simulator, method (qvd's or Aer's names), precision, max_bond_dimension, truncation_threshold, threads, memory. Qiskit's BackendSamplerV2 and BackendEstimatorV2 work on it too.
  • QevedoSampler returns one BitArray per classical register. Measurements may be anywhere in the circuit, and resets are allowed.
  • QevedoEstimator evaluates every observable exactly on the state vector up to statevector_max_qubits (24) qubits, and by Pauli propagation beyond that, up to 1024 qubits. Propagation drops small Pauli coefficients (min_abs_coefficient), and data.truncated_one_norm bounds the error.
  • Every standard Qiskit gate runs. Gates without a kernel of their own (ecr, iswap, ryy, ...) run as their exact matrices, and others (QFT, MCX, UnitaryGate, PauliEvolutionGate, ...) through their definitions. Control flow and unbound parameters are rejected. Aer noise models are not read.
  • run, statevector and expectation also take a QuantumCircuit directly. statevector keeps its global phase.

License: MIT.

Metadata

Release files for qevedo-simulator 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qevedo-simulator 0.1.6
File Size Uploaded Provenance Actions
qevedo_simulator-0.1.6.tar.gz 452.3 kB With provenance Details for qevedo_simulator-0.1.6.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for qevedo-simulator 0.1.6
File Actions
qevedo_simulator-0.1.6-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for qevedo_simulator-0.1.6-cp310-abi3-win_amd64.whl
qevedo_simulator-0.1.6-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for qevedo_simulator-0.1.6-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
qevedo_simulator-0.1.6-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for qevedo_simulator-0.1.6-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
qevedo_simulator-0.1.6-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for qevedo_simulator-0.1.6-cp310-abi3-macosx_11_0_arm64.whl
qevedo_simulator-0.1.6-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for qevedo_simulator-0.1.6-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 8.2 MB

Release files / qevedo_simulator-0.1.6.tar.gz

Download URL qevedo_simulator-0.1.6.tar.gz
Size 452.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b458c1bb919f83d5a3e8fb3b5f2741b85dc199676ac5593ec7a234ba28f79575
BLAKE2b-256 checksum
How to use checksums
ba296d181a927e8f863c4d8cad6337d25e2907924a2a9ecf129e2386866496b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / qevedo_simulator-0.1.6-cp310-abi3-win_amd64.whl

Download URL qevedo_simulator-0.1.6-cp310-abi3-win_amd64.whl
Size 1.6 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
bf99f7719cfb794327f0fe7daa9a299f0ecb541732d29e178f5fb259649655f6
BLAKE2b-256 checksum
How to use checksums
446d8af7e44c4e2b26c4e24192d6622ad9488dc5599f41e8915b2f30c120ad9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / qevedo_simulator-0.1.6-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL qevedo_simulator-0.1.6-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 1.8 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
b6c3eb076f46008ecbec4ab40a4e28b72114096d198a219116da750886001aef
BLAKE2b-256 checksum
How to use checksums
ea77ef542bd5262010658e7cc81554d70a16388e396d3e08513df8a6dfcb5a60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / qevedo_simulator-0.1.6-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL qevedo_simulator-0.1.6-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 1.5 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
3cd089c9063d550680021db0a369e9a10aa22622eaafe2153c197da425620fd9
BLAKE2b-256 checksum
How to use checksums
21109fc93a1a519c05920aa32a07052735349630b9c453ec218f247add6cef29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / qevedo_simulator-0.1.6-cp310-abi3-macosx_11_0_arm64.whl

Download URL qevedo_simulator-0.1.6-cp310-abi3-macosx_11_0_arm64.whl
Size 1.3 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7508d71c7b854a0b889d74c182bda2e141da7e1b631e19302cb8b6a697887fc3
BLAKE2b-256 checksum
How to use checksums
466f43ac89cabb808893cc74c02963876fae6883761b816df3b3172db1356d42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / qevedo_simulator-0.1.6-cp310-abi3-macosx_10_12_x86_64.whl

Download URL qevedo_simulator-0.1.6-cp310-abi3-macosx_10_12_x86_64.whl
Size 1.6 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ae3a294ba807dd59a0f81621b8f28743c99772202f749d901f0de21d62072f3e
BLAKE2b-256 checksum
How to use checksums
b63d8a6a6b74de5cb5ca0b5c93b120235a8c6d55c3100240af25522fcdbe5ca3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for qevedo-simulator 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for qevedo_simulator-0.1.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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