qevedo-simulator
Python bindings of Qevedo, 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, and correlated_error for any Pauli mixture on any
number of qubits; 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 all of Stim's Clifford gates (ISWAP, SQRT_XX,
XCY, CXSWAP, ...), 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) and parity measurements (MXX, MYY, MZZ),
SPP/SPP_DAG, the Pauli channels including PAULI_CHANNEL_2,
correlated errors (E, ELSE_CORRELATED_ERROR), heralded errors
(HERALDED_ERASE, HERALDED_PAULI_CHANNEL_1), tags, DETECTOR,
OBSERVABLE_INCLUDE, nested REPEAT blocks and classical feedback
(CX rec[-1] 5, CY, CZ, XCZ, YCZ; sweep bits read 0, as in
Stim without sweep data). A circuit with heralded errors gets one extra
qubit, after Stim's, that records the heralds; so does one with feedback
and flipped measurements (M(0.01)), whose flips then happen in the shot,
where feedback reads them. A Qevedo circuit takes feedback with
circuit.feedback("X", qubit, clbit) (X on qubit if bit clbit is
1), on the stabilizer and state-vector backends. 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, with Pauli noise | 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.]
-
QevedoSimulatorruns circuits withrun, so it picks the method the same way and reports it inresult.results[i].metadata["method"]. Options:shots,seed_simulator,method(Qevedo's or Aer's names),precision,max_bond_dimension,truncation_threshold,threads,memory,noise_model(below). Qiskit'sBackendSamplerV2andBackendEstimatorV2work on it too. -
QevedoSamplerreturns oneBitArrayper classical register. Measurements may be anywhere in the circuit, and resets are allowed. -
QevedoEstimatorevaluates every observable exactly on the state vector up tostatevector_max_qubits(24) qubits, and by Pauli propagation beyond that, up to 1024 qubits. Propagation drops small Pauli coefficients (min_abs_coefficient), anddata.truncated_one_normbounds 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. Unbound parameters are rejected. -
Qiskit Aer noise models run when their errors are Pauli channels:
QevedoSimulator(noise_model=noise)(orrun(..., noise_model=noise), orQevedoSampler(options={"noise_model": noise})).pauli_error,depolarizing_error,phase_damping_errorand Kraus errors that are Pauli mixtures become Pauli channels, placed where Aer applies them (after gates and resets, before measurements, local errors replacing all-qubit ones), so noisy Clifford circuits run on the stabilizer backend and noisy Clifford+T ones on the near-Clifford backend. Readout errors flip the recorded bit: symmetric ones inside the shot (soif_testreads the flipped bit, as in Aer), asymmetric ones on the results (not allowed withif_test). Amplitude damping, thermal relaxation, reset errors, coherent rotations and correlated readout errors are rejected, naming the gate.from qiskit_aer.noise import NoiseModel, ReadoutError, depolarizing_error noise = NoiseModel() noise.add_all_qubit_quantum_error(depolarizing_error(0.001, 2), ["cx"]) noise.add_all_qubit_readout_error(ReadoutError([[0.99, 0.01], [0.01, 0.99]])) counts = QevedoSimulator(noise_model=noise).run(qc, shots=10_000).result().get_counts()
-
Dynamic circuits run when their feed-forward is Pauli corrections:
if_test(with or withoutelse) on one classical bit or one-bit register, whose bodies apply only Pauli gates, becomes classical feedback, so a Clifford dynamic circuit (teleportation, resets by measurement, IBM's constant-depth GHZ) runs on the stabilizer backend. Other control flow (loops,switch, conditions on several bits, other gates in the body) is rejected. -
run,statevectorandexpectationalso take aQuantumCircuitdirectly.statevectorkeeps its global phase.
From Cirq
pip install qevedo-simulator[cirq]. qevedo.simulator.cirq has a
cirq.Sampler and the converter:
import cirq
from qevedo.simulator.cirq import QevedoSampler, final_state_vector, from_cirq
a, b = cirq.LineQubit.range(2)
bell = cirq.Circuit(cirq.H(a), cirq.CNOT(a, b))
sampler = QevedoSampler(seed=1)
result = sampler.run(bell + cirq.measure(a, b, key="m"), repetitions=1000) # cirq.Result
result.histogram(key="m") # Counter({0: ..., 3: ...})
sampler.last_methods # ['stabilizer']
state = final_state_vector(bell) # as cirq.final_state_vector, global phase included
noisy = QevedoSampler(noise=cirq.depolarize(0.001)) # any cirq.NOISE_MODEL_LIKE
QevedoSampleris acirq.Sampler, sorun_sweepover parameter sweeps,sample(a pandas frame),run_batchandsample_expectation_valueswork. It picks the method asrundoes and lists it inlast_methods. Options:method,noise,seed(a seed or random state),precision,max_bond_dimension,truncation_threshold,threads.- Gates are matched to the simulator's own gates by their matrices, up to a
global phase that is kept aside (and returned by
final_state_vector):X**0.5,rx(π/2)andPhasedXPowGate(0, 0.5)are allsx,CZ**tis a controlled phase, a controlled one-qubit gate becomescp,crx,cryandcrz. Other Clifford gates (ISWAP, CliffordMatrixGates) are rebuilt from their stabilizer tableaux, so a Clifford circuit is recognised as one whatever gate family it is written in, and runs on the stabilizer backend. Other gates on up to four qubits (FSimGate,ISwapPowGate,MatrixGate, ...) run as their exact matrices; larger ones through their Cirq decompositions. Unresolved parameters are rejected. cirq.measureon any qubits with any key, withinvert_mask, anywhere in the circuit; a key measured again (as inCircuitOperationloops) becomes Cirq's records, one instance per measurement.cirq.reset.op.with_classical_controls(key)on a key of one measured qubit, with a Pauli body, becomes classical feedback (teleportation and resets by measurement stay on the stabilizer backend). Other conditions and bodies are rejected.- Noise channels that are Pauli channels, whatever they are written as
(
depolarizeon any number of qubits,bit_flip,phase_flip,asymmetric_depolarize,phase_damp, Kraus channels whose chi matrix is diagonal), run on the stabilizer and near-Clifford backends; amplitude damping and readout confusion matrices are rejected, naming the operation. from_cirq(circuit)returns(Circuit, keys, global_phase): the Qevedo circuit, each key's classical bits per measurement, and the phase dropped. Qubits are ordered byqubit_order(Cirq's default: sorted), the first being the most significant bit offinal_state_vector's index, as in Cirq.
License: MIT.
Metadata
Release files for qevedo-simulator 0.1.20
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qevedo_simulator-0.1.20.tar.gz | 622.7 kB | With provenance | Details for qevedo_simulator-0.1.20.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| qevedo_simulator-0.1.20-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for qevedo_simulator-0.1.20-cp310-abi3-win_amd64.whl |
| qevedo_simulator-0.1.20-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.20-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| qevedo_simulator-0.1.20-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ ARM64 | Details for qevedo_simulator-0.1.20-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| qevedo_simulator-0.1.20-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for qevedo_simulator-0.1.20-cp310-abi3-macosx_11_0_arm64.whl |
| qevedo_simulator-0.1.20-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details for qevedo_simulator-0.1.20-cp310-abi3-macosx_10_12_x86_64.whl |
Total release size: 8.9 MB
Release files / qevedo_simulator-0.1.20.tar.gz
| Download URL | qevedo_simulator-0.1.20.tar.gz |
|---|---|
| Size | 622.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17ce5e7d77d07e46e17f4b3851beaa8c4714c56c0e0447325e36e9524b142b38
|
|
BLAKE2b-256 checksum How to use checksums |
975a3bb233e640539d54cad73da95a325205a946f83e6eb1ed844d314b5d0704
|
| 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 Dec 2, 2026.
Transparency logRelease files / qevedo_simulator-0.1.20-cp310-abi3-win_amd64.whl
| Download URL | qevedo_simulator-0.1.20-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
687b73b84014bd3ec613f4287a34ca58bda58f3b68c2f9ec71e1c43db3bee70e
|
|
BLAKE2b-256 checksum How to use checksums |
ac8d0526d5e55053a1258e1cb3330e086566a6f597dd507d4e14f53f3704ca8e
|
| 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 Dec 2, 2026.
Transparency logRelease files / qevedo_simulator-0.1.20-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | qevedo_simulator-0.1.20-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0946caf5e3ecb81e645fc275c625a2e6b76df1cf48e10392741cc074389f29c5
|
|
BLAKE2b-256 checksum How to use checksums |
d65ef04ca500fff79d3a3aca4abffd41158fa07dafed2cf8af9607c232a11deb
|
| 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 Dec 2, 2026.
Transparency logRelease files / qevedo_simulator-0.1.20-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | qevedo_simulator-0.1.20-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
814768b6878d6432a6d49b02e7547474145eac74229df7a0c3ecf2a891ab7dca
|
|
BLAKE2b-256 checksum How to use checksums |
ba93b5e7d241ebc3bf34475a5ff3a645f3921379be1494ccf2366b74ee367de9
|
| 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 Dec 2, 2026.
Transparency logRelease files / qevedo_simulator-0.1.20-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | qevedo_simulator-0.1.20-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
aa29adf5d50df31b22b7ff5e18ba9ce5e68b1e14f20994b46bd8f7b233e0165a
|
|
BLAKE2b-256 checksum How to use checksums |
f986ccffcd1f89f3a2f866a81b11337f3177393f74eddb1b5f2eb16b02903b02
|
| 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 Dec 2, 2026.
Transparency logRelease files / qevedo_simulator-0.1.20-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | qevedo_simulator-0.1.20-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
bcb3d62ed416237dc7cbe2d1d7ce91094da2ab25a6271ffb309d21d2a7a7d2b1
|
|
BLAKE2b-256 checksum How to use checksums |
609c926692f23975e03cb0f09da46b5f264d21d96f1d74e0935819ef790b7f9d
|
| 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 Dec 2, 2026.
Transparency logSecurity for qevedo-simulator 0.1.20
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.
Attestation for qevedo_simulator-0.1.20.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 Dec 2, 2026.
Transparency logA 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.