Decoder related statements and interfaces for Bloqade.
Project description
bloqade-decoders
The QEC user interface providing integration with popular open-source decoders for the Bloqade SDK.
By default, the following decoders from the ldpc package and
their corresponding interfaces are immediately available for decoding use upon installation of this package:
- BP+OSD - through
bloqade.decoders.BpOsdDecoder - BP+LSD - through
bloqade.decoders.BpLsdDecoder - Belief Find - through
bloqade.decoders.BeliefFindDecoder
Interfaces also exist for the following optional decoders, which are not included as dependencies by default:
- MWPF - through
bloqade.decoders.MWPFDecoder(MWPF) - Tesseract - through
bloqade.decoders.TesseractDecoder(Tesseract) - MLE (Gurobi) - through
bloqade.decoders.GurobiDecoder, finds the most likely error pattern via mixed-integer programming - MLD (Table Lookup) - through
bloqade.decoders.TableDecoder, builds a lookup table from sampled data
Sinter-compatible adapters for MLE and MLD are also available through bloqade.decoders.sinter_interface.
You can install them separately or specify you would like them included with the bloqade-decoders installation through the
additional instructions below.
Installation
For access to the ldpc-package originating decoders and their respective interfaces, just do the following:
pip install bloqade-decoders
To add the tesseract decoder you can do:
pip install bloqade-decoders[tesseract]
Or for MWPF do:
pip install bloqade-decoders[mwpf]
For MLE (a full Gurobi license is needed for larger problems, but small models work with the size-limited license bundled with gurobipy):
pip install bloqade-decoders[mle]
For MLD:
pip install bloqade-decoders[mld]
You can combine multiple extras:
pip install bloqade-decoders[mwpf, tesseract, mle, mld, sinter]
Usage
The decoding interfaces are designed to align as closely as possible with the decoders themselves in terms of arguments. The only major difference is you're expected to pass in a Detector Error Model (DEM) to instantiate the interface.
Furthermore, all decoder interfaces are designed to accept the detector results of a single shot
OR a batch of shots as a numpy ndarray of booleans, with the result being the observable correction (also as an ndarray of booleans).
from bloqade.decoders import BpOsdDecoder
import numpy as np
import stim
dem = stim.DetectorErrorModel("""
error(0.1) D0
error(0.1) D0 D1
error(0.1) D1 L0
""")
# Pretend that circuit was executed twice,
# with two sets of detector results.
syndromes = np.array([[False, False], [False, True]])
# instantiate decoder, passing in desired arguments as you would
# the original decoder interface.
decoder = BpOsdDecoder(dem, bp_method="product_sum")
decoded_observable = decoder.decode(syndromes)
# decoded_observable should give you
# np.array([[False], [True]])
MLE / MLD Decoders
The GurobiDecoder takes a DEM directly (note: must use decompose_errors=False):
from bloqade.decoders import GurobiDecoder
decoder = GurobiDecoder(dem)
corrections = decoder.decode(syndromes)
The TableDecoder can be constructed directly with a DEM and pre-computed counts, or
from a stim circuit which handles the sampling for you:
from bloqade.decoders import TableDecoder
# from a circuit (samples shots to build the lookup table)
decoder = TableDecoder.from_stim_circuit(circuit, num_shots=100_000)
# or from pre-sampled detector-observable shots
decoder = TableDecoder.from_det_obs_shots(dem, det_obs_shots)
corrections = decoder.decode(syndromes)
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 Distribution
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 bloqade_decoders-0.6.0.tar.gz.
File metadata
- Download URL: bloqade_decoders-0.6.0.tar.gz
- Upload date:
- Size: 152.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0579896f13b5089e1ba05e040a1f57b30c5f6acfc4cfb01b2ecf22ae63179f50
|
|
| MD5 |
e981278d7415bc280e9e558e8cd778f0
|
|
| BLAKE2b-256 |
033a4f099731a0159572f3d0ffd2fca63406e5f55de412c4e1b26fb6e4e41c4e
|
Provenance
The following attestation bundles were made for bloqade_decoders-0.6.0.tar.gz:
Publisher:
release.yml on QuEraComputing/bloqade-decoders
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bloqade_decoders-0.6.0.tar.gz -
Subject digest:
0579896f13b5089e1ba05e040a1f57b30c5f6acfc4cfb01b2ecf22ae63179f50 - Sigstore transparency entry: 1852094735
- Sigstore integration time:
-
Permalink:
QuEraComputing/bloqade-decoders@819cd3bd5035068e4206ff2effc4bb7dddbca6b4 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/QuEraComputing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@819cd3bd5035068e4206ff2effc4bb7dddbca6b4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bloqade_decoders-0.6.0-py3-none-any.whl.
File metadata
- Download URL: bloqade_decoders-0.6.0-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01cba5cdd02ce452e8252491fa9178b643fd9155413bd9c7d97a9b6052c7c571
|
|
| MD5 |
868c0df423ae9029b659e7fa5f268413
|
|
| BLAKE2b-256 |
6dd8935986caa8bc91a2be986a19f220ae894313a9ab9ebbcbeec18444358f49
|
Provenance
The following attestation bundles were made for bloqade_decoders-0.6.0-py3-none-any.whl:
Publisher:
release.yml on QuEraComputing/bloqade-decoders
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bloqade_decoders-0.6.0-py3-none-any.whl -
Subject digest:
01cba5cdd02ce452e8252491fa9178b643fd9155413bd9c7d97a9b6052c7c571 - Sigstore transparency entry: 1852094807
- Sigstore integration time:
-
Permalink:
QuEraComputing/bloqade-decoders@819cd3bd5035068e4206ff2effc4bb7dddbca6b4 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/QuEraComputing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@819cd3bd5035068e4206ff2effc4bb7dddbca6b4 -
Trigger Event:
push
-
Statement type: