Skip to main content

xtim

Python License

A fast, exact sampler for noisy quantum circuits with T, CS, CCZ and CH gates. xtim reads Stim circuits plus these non-Clifford gates and samples detectors and observables the way Stim does. It is built for magic-state preparation under circuit-level noise: distillation, cultivation, code switching and state factories.

Install

pip install xtim              # wheels for Linux x86_64 and macOS arm64 (11.0+), CPython 3.11-3.13
pip install "xtim[decode]"    # adds stim, pymatching, ldpc

From source (a C++17 compiler; the build takes a few minutes; other platforms build the sdist this way too):

git clone https://github.com/ikim-quantum/xtim.git
cd xtim
pip install -e ".[decode]"    # editable install

Platforms: Linux (primary); macOS supported for correctness; Windows not tested.

Optional GPU sampling of xdem files: pip install "xtim[metal]" on Apple silicon, or a CuPy wheel on NVIDIA. Metal tested (Apple M3 Max); CUDA experimental, validated on one NVIDIA card. See GPU sampling.

Quick start

Prepare a T state, add noise, then undo the T gate noiselessly and measure in the X basis. Without noise the observable is always 0, so every flip is a logical error:

import numpy as np
import xtim

circuit = """
RX 0
T 0
DEPOLARIZE1(0.01) 0
T_DAG 0
MX 0
OBSERVABLE_INCLUDE(0) rec[-1]
"""
sampler = xtim.compile_twirl_sampler(circuit)
dets, obs = sampler.sample(1_000_000, seed=1)     # Stim-style bit-packed uint8 arrays
flips = np.unpackbits(obs, axis=1, bitorder="little")[:, 0]
print(f"logical error rate {flips.mean():.2e}")
# logical error rate 6.78e-03

Documentation

docs/usage.md covers post-selection, threads, exact output-state fidelity, output-state helpers, decoding, xdem files with decoder feedback, the circuit language and which circuits xtim can simulate. See also examples/ and CHANGELOG.md.

How fast?

See docs/performance.md: comparisons with tsim, Clifft, SymFT, Stim and Magna on the clifft-bench workloads, on one CPU core.

Metadata

Release files for xtim 4.2.1

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

Source distribution (sdist)

Source distribution for xtim 4.2.1
File Size Uploaded Provenance Actions
xtim-4.2.1.tar.gz 2.6 MB With provenance Details for xtim-4.2.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for xtim 4.2.1
File Actions
xtim-4.2.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for xtim-4.2.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
xtim-4.2.1-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for xtim-4.2.1-cp313-cp313-macosx_11_0_arm64.whl
xtim-4.2.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for xtim-4.2.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
xtim-4.2.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for xtim-4.2.1-cp312-cp312-macosx_11_0_arm64.whl
xtim-4.2.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for xtim-4.2.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
xtim-4.2.1-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for xtim-4.2.1-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 25.8 MB

Release files / xtim-4.2.1.tar.gz

Download URL xtim-4.2.1.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
fc9f4049f5b6227d0718eb86ad01711958cf6f9236d2acf5208d7e2cadd652e3
BLAKE2b-256 checksum
How to use checksums
1b2c45f91cbdc88f4d37c7141b7b487ea6a5a9ca659219841698a1d8e9ab5e9f
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 26, 2026.

Transparency log

Release files / xtim-4.2.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL xtim-4.2.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.1 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
5ce18241e7f119df4c54a093c96364b3eb2f13533c82dd6d5f8a4ae7f40da0c7
BLAKE2b-256 checksum
How to use checksums
b7212427b9b88a90c989eab429df1a159967e896070d34b9f82c1ca3a682dac3
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 26, 2026.

Transparency log

Release files / xtim-4.2.1-cp313-cp313-macosx_11_0_arm64.whl

Download URL xtim-4.2.1-cp313-cp313-macosx_11_0_arm64.whl
Size 2.7 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
03ce14484eed78aefd138ea89b8b1d40ca0a4c182e9c729e995df29c0ed7d1d2
BLAKE2b-256 checksum
How to use checksums
95e8ad79a1534e1a8874ac13279a3c1ec1242815c08100d1f65c0878ffbbddf8
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 26, 2026.

Transparency log

Release files / xtim-4.2.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL xtim-4.2.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.1 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6056422ccc26c1d5a90d963da26b4b71424d9866d665aba5d47795b17fb95433
BLAKE2b-256 checksum
How to use checksums
e4fce22c99e0a3bf75038fa2e949d1bf0dc51c2250142d81aabdde2b3e7f2702
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 26, 2026.

Transparency log

Release files / xtim-4.2.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL xtim-4.2.1-cp312-cp312-macosx_11_0_arm64.whl
Size 2.7 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
cf7ac7d76d0f4b33c299fcd104c077ad09e1b31237d98dad9ab3fe78f258f5a9
BLAKE2b-256 checksum
How to use checksums
748c02f363bb142624b61dc82eb6ff6eb3d6e5aca23121dca2319ec0722d99be
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 26, 2026.

Transparency log

Release files / xtim-4.2.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL xtim-4.2.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.0 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b92c75d417cf55dc875629c0901b49cf8af5797967d5479cbe60c316e863fa4a
BLAKE2b-256 checksum
How to use checksums
f939b222a008d093abd8cb122a759afa8ab84ca085914d8b5a9cf6ef3f2b3366
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 26, 2026.

Transparency log

Release files / xtim-4.2.1-cp311-cp311-macosx_11_0_arm64.whl

Download URL xtim-4.2.1-cp311-cp311-macosx_11_0_arm64.whl
Size 2.7 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0a6b8e55fab6066816a06e9bc0b44746a0a0871fccd6024c3a9a2c18a2ce4b6a
BLAKE2b-256 checksum
How to use checksums
9acf840b60c59800016400b463831206333d7be14a87ff6b77b456108faafc02
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 26, 2026.

Transparency log

Security for xtim 4.2.1

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 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for xtim-4.2.1.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 26, 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.

Release history Release notifications | RSS feed

This release

4.2.1 This release

7 release files Full provenance

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