Quantum circuit simulation utilities (lossy surface-code sampling).
Project description
vsim
Loss-aware sampling for Stim circuits (surface-code workflows).
Install
Note: this package has only been tested with Python 3.14.
uv add vsim
# Or using pip
pip install vsim
Building the native C++ extension requires a C++20 compiler (GCC 10+ / Clang 12+) and CMake ≥ 3.20.
Usage
from stim import Circuit
from vsim import add_noise, FastLossyCircuit
# Generate a surface code circuit with stim
circuit = Circuit.generated(
"surface_code:rotated_memory_z",
distance=5,
rounds=5,
after_clifford_depolarization=0.01,
before_measure_flip_probability=0.01,
after_reset_flip_probability=0.01,
)
# Add loss probabilities after 2 qubit gates, and reset gates
lossy_circuit = FastLossyCircuit.from_text(
str(add_noise(circuit, p_2q = 0.01, p_reset = 0.01))
)
results = []
shots = 10_000
# this should run in less than 1s
for _ in range(shots):
results.append(
lossy_circuit.run()
)
Typical speedups vs. Python-based sampling on rotated-memory-z surface codes: ~50× at d=3, ~60× at d=5, ~75× at d=7.
Development
Clone the repository with submodules:
git clone --recurse-submodules <repo-url>
Setup the development environment:
uv sync --group dev
Note: On Python 3.14 with GCC 15+, you may need CXXFLAGS="-include cstdint" uv sync --group dev to build stim correctly.
Run tests:
uv run --group dev pytest
Benchmarks
Start with this command to see the help message:
uv run python scripts/benchmark_syndrome_vs_run.py --help
Full benchmark run:
uv run scripts/benchmark_syndrome_vs_run.py -A -B -C -D --shots 1000
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vsim-0.2.1.tar.gz.
File metadata
- Download URL: vsim-0.2.1.tar.gz
- Upload date:
- Size: 3.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1919240a1425f4f5d19d6f53cbac2f1e26714d599d1e83f143ee0769eaed424a
|
|
| MD5 |
173529401b51586a539f8c48a5813259
|
|
| BLAKE2b-256 |
cb8343c4c747f466464b24d214428da69d761ec03007879d19adc8ae79a58d6f
|
Provenance
The following attestation bundles were made for vsim-0.2.1.tar.gz:
Publisher:
publish.yml on Jaymun723/vsim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vsim-0.2.1.tar.gz -
Subject digest:
1919240a1425f4f5d19d6f53cbac2f1e26714d599d1e83f143ee0769eaed424a - Sigstore transparency entry: 1546915276
- Sigstore integration time:
-
Permalink:
Jaymun723/vsim@ddeb36aaf6fcc29dc56c1958c98ac4244a3156ad -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Jaymun723
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ddeb36aaf6fcc29dc56c1958c98ac4244a3156ad -
Trigger Event:
release
-
Statement type:
File details
Details for the file vsim-0.2.1-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: vsim-0.2.1-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 190.2 kB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
658e35b0b9141794c89b2447d37c79fab3c07dc4534737e562b48b5fcf264131
|
|
| MD5 |
6e35dac9e2e0eb72ae45959e2e6da3c3
|
|
| BLAKE2b-256 |
c4719a065e4bf9d2d26a4e6f33b5561fff1ca8ab965eaa4ca48ac712c3715803
|
Provenance
The following attestation bundles were made for vsim-0.2.1-cp314-cp314-win_amd64.whl:
Publisher:
publish.yml on Jaymun723/vsim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vsim-0.2.1-cp314-cp314-win_amd64.whl -
Subject digest:
658e35b0b9141794c89b2447d37c79fab3c07dc4534737e562b48b5fcf264131 - Sigstore transparency entry: 1546915282
- Sigstore integration time:
-
Permalink:
Jaymun723/vsim@ddeb36aaf6fcc29dc56c1958c98ac4244a3156ad -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Jaymun723
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ddeb36aaf6fcc29dc56c1958c98ac4244a3156ad -
Trigger Event:
release
-
Statement type:
File details
Details for the file vsim-0.2.1-cp314-cp314-win32.whl.
File metadata
- Download URL: vsim-0.2.1-cp314-cp314-win32.whl
- Upload date:
- Size: 162.2 kB
- Tags: CPython 3.14, Windows x86
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc516d4ae830199f927f712c7d31bcf40b91327a2bd47cb136e41dfffcfe377d
|
|
| MD5 |
13675aa5de1d75dd903dcb97b418672d
|
|
| BLAKE2b-256 |
803615e29245156c55c039a9a62cd505cfdf9f0a040d049cbf110368632e2e79
|
Provenance
The following attestation bundles were made for vsim-0.2.1-cp314-cp314-win32.whl:
Publisher:
publish.yml on Jaymun723/vsim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vsim-0.2.1-cp314-cp314-win32.whl -
Subject digest:
cc516d4ae830199f927f712c7d31bcf40b91327a2bd47cb136e41dfffcfe377d - Sigstore transparency entry: 1546915297
- Sigstore integration time:
-
Permalink:
Jaymun723/vsim@ddeb36aaf6fcc29dc56c1958c98ac4244a3156ad -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Jaymun723
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ddeb36aaf6fcc29dc56c1958c98ac4244a3156ad -
Trigger Event:
release
-
Statement type:
File details
Details for the file vsim-0.2.1-cp314-cp314-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: vsim-0.2.1-cp314-cp314-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.14, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50302f77a0c92d16c4d80da16d2910e063528bff86c0e186dab4c24c86b5b731
|
|
| MD5 |
5f471b99cf32a8b56ab0e265b955ad67
|
|
| BLAKE2b-256 |
a544d128631a98f3bbc1f69862d14d87625f0ebe609281e534143fbd32706aa5
|
Provenance
The following attestation bundles were made for vsim-0.2.1-cp314-cp314-musllinux_1_2_x86_64.whl:
Publisher:
publish.yml on Jaymun723/vsim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vsim-0.2.1-cp314-cp314-musllinux_1_2_x86_64.whl -
Subject digest:
50302f77a0c92d16c4d80da16d2910e063528bff86c0e186dab4c24c86b5b731 - Sigstore transparency entry: 1546915321
- Sigstore integration time:
-
Permalink:
Jaymun723/vsim@ddeb36aaf6fcc29dc56c1958c98ac4244a3156ad -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Jaymun723
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ddeb36aaf6fcc29dc56c1958c98ac4244a3156ad -
Trigger Event:
release
-
Statement type:
File details
Details for the file vsim-0.2.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: vsim-0.2.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 211.0 kB
- Tags: CPython 3.14, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bd0e2cfd3dba7bf79be4d702b5018cc47f3cef64010e16eaee0a1ccdf289301
|
|
| MD5 |
4d0460bb5d8a91736b8972df89db0d26
|
|
| BLAKE2b-256 |
61eb6f86866c293d1277d579606958ebf7e9480bfd68907f37579b684ecb93fc
|
Provenance
The following attestation bundles were made for vsim-0.2.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on Jaymun723/vsim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vsim-0.2.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
7bd0e2cfd3dba7bf79be4d702b5018cc47f3cef64010e16eaee0a1ccdf289301 - Sigstore transparency entry: 1546915292
- Sigstore integration time:
-
Permalink:
Jaymun723/vsim@ddeb36aaf6fcc29dc56c1958c98ac4244a3156ad -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Jaymun723
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ddeb36aaf6fcc29dc56c1958c98ac4244a3156ad -
Trigger Event:
release
-
Statement type:
File details
Details for the file vsim-0.2.1-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: vsim-0.2.1-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 166.5 kB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a1effc205f5257de394adeb4923be90ebda0860f5e05ea2a778f3ef08d18ef3
|
|
| MD5 |
d7c5a3add58bbc57138e3592e10fbb0c
|
|
| BLAKE2b-256 |
a3ee1eb4d0d2db344de7580d8793720a6922399cd27486315354b769c2ebe0d2
|
Provenance
The following attestation bundles were made for vsim-0.2.1-cp314-cp314-macosx_11_0_arm64.whl:
Publisher:
publish.yml on Jaymun723/vsim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vsim-0.2.1-cp314-cp314-macosx_11_0_arm64.whl -
Subject digest:
4a1effc205f5257de394adeb4923be90ebda0860f5e05ea2a778f3ef08d18ef3 - Sigstore transparency entry: 1546915310
- Sigstore integration time:
-
Permalink:
Jaymun723/vsim@ddeb36aaf6fcc29dc56c1958c98ac4244a3156ad -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Jaymun723
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ddeb36aaf6fcc29dc56c1958c98ac4244a3156ad -
Trigger Event:
release
-
Statement type: