Skip to content

Commit 5541833

Browse files
authored
Merge branch 'main' into u/ab/fix_qubit_id_pauli_keys
2 parents 03dbe13 + 75d9cb1 commit 5541833

File tree

94 files changed

+6714
-359
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+6714
-359
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ AllowShortLoopsOnASingleLine: false
1111
AllowShortLambdasOnASingleLine: None
1212
BinPackArguments: false
1313
BinPackParameters: false
14+
PointerAlignment: Right
1415

1516
IncludeCategories:
1617
- Regex: '^<.*>$'

.github/workflows/ci.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,14 @@ jobs:
2929
fail-fast: false
3030
matrix:
3131
os_dist: [
32-
{os: ubuntu-24.04, dist: cp36-manylinux_x86_64},
33-
{os: ubuntu-24.04, dist: cp37-manylinux_x86_64},
3432
{os: ubuntu-24.04, dist: cp38-manylinux_x86_64},
3533
{os: ubuntu-24.04, dist: cp39-manylinux_x86_64},
3634
{os: ubuntu-24.04, dist: cp310-manylinux_x86_64},
3735
{os: ubuntu-24.04, dist: cp311-manylinux_x86_64},
3836
{os: ubuntu-24.04, dist: cp312-manylinux_x86_64},
3937
{os: ubuntu-24.04, dist: cp313-manylinux_x86_64},
38+
{os: ubuntu-24.04, dist: cp314-manylinux_x86_64},
4039

41-
{os: ubuntu-24.04, dist: cp36-manylinux_i686},
42-
{os: ubuntu-24.04, dist: cp37-manylinux_i686},
4340
# cp38-manylinux_i686 disabled because pandas isn't prebuilt and takes 20 minutes to build.
4441
# {os: ubuntu-latest, dist: cp38-manylinux_i686},
4542
# cp39-manylinux_i686 disabled because pandas isn't prebuilt and takes 20 minutes to build.
@@ -88,21 +85,21 @@ jobs:
8885
# {os: ubuntu-latest, dist: cp39-musllinux_i686},
8986
# {os: ubuntu-latest, dist: cp310-musllinux_i686},
9087

91-
{os: macos-14, dist: cp36-macosx_x86_64, macosarch: x86_64},
92-
{os: macos-14, dist: cp37-macosx_x86_64, macosarch: x86_64},
9388
{os: macos-14, dist: cp38-macosx_x86_64, macosarch: x86_64},
9489
{os: macos-14, dist: cp39-macosx_x86_64, macosarch: x86_64},
9590
{os: macos-14, dist: cp310-macosx_x86_64, macosarch: x86_64},
9691
{os: macos-14, dist: cp311-macosx_x86_64, macosarch: x86_64},
9792
{os: macos-14, dist: cp312-macosx_x86_64, macosarch: x86_64},
9893
{os: macos-14, dist: cp313-macosx_x86_64, macosarch: x86_64},
94+
{os: macos-14, dist: cp314-macosx_x86_64, macosarch: x86_64},
9995

10096
{os: macos-14, dist: cp38-macosx_arm64, macosarch: arm64},
10197
{os: macos-14, dist: cp39-macosx_arm64, macosarch: arm64},
10298
{os: macos-14, dist: cp310-macosx_arm64, macosarch: arm64},
10399
{os: macos-14, dist: cp311-macosx_arm64, macosarch: arm64},
104100
{os: macos-14, dist: cp312-macosx_arm64, macosarch: arm64},
105101
{os: macos-14, dist: cp313-macosx_arm64, macosarch: arm64},
102+
{os: macos-14, dist: cp314-macosx_arm64, macosarch: arm64},
106103

107104
# pypy OSX builds disabled because numpy isn't prebuilt and fails to build.
108105
#
@@ -119,19 +116,14 @@ jobs:
119116
# {os: macOS-10.15, dist: pp38-macosx_x86_64},
120117
# {os: macOS-10.15, dist: pp39-macosx_x86_64},
121118

122-
{os: windows-2025, dist: cp36-win_amd64},
123-
{os: windows-2025, dist: cp37-win_amd64},
124119
{os: windows-2025, dist: cp38-win_amd64},
125120
{os: windows-2025, dist: cp39-win_amd64},
126121
{os: windows-2025, dist: cp310-win_amd64},
127122
{os: windows-2025, dist: cp311-win_amd64},
128123
{os: windows-2025, dist: cp312-win_amd64},
124+
{os: windows-2025, dist: cp313-win_amd64},
125+
{os: windows-2025, dist: cp314-win_amd64},
129126

130-
# (April 2024) disabled because numpy fails to build. Unsure why it's not using a prebuilt wheel.
131-
# {os: windows-2025, dist: cp313-win_amd64},
132-
133-
{os: windows-2025, dist: cp36-win32},
134-
{os: windows-2025, dist: cp37-win32},
135127
# cp38-win32 and cp39-win32 disabled because scipy fails to build.
136128
#
137129
# The actual error seen in github actions:
@@ -159,7 +151,7 @@ jobs:
159151
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
160152
- uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3
161153
- run: python dev/overwrite_dev_versions_with_date.py
162-
- run: python -m pip install pybind11~=2.11.1 cibuildwheel~=2.23.2 setuptools wheel
154+
- run: python -m pip install pybind11~=2.11.1 cibuildwheel~=3.3.1 setuptools wheel
163155
- run: python -m cibuildwheel --print-build-identifiers
164156
- run: python -m cibuildwheel --output-dir dist
165157
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
@@ -204,7 +196,7 @@ jobs:
204196
steps:
205197
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
206198
- uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3
207-
- run: python -m pip install pybind11~=2.11.1 cibuildwheel~=2.23.2 setuptools wheel
199+
- run: python -m pip install pybind11~=2.11.1 cibuildwheel~=3.3.1 setuptools wheel
208200
- run: python setup.py sdist
209201
- run: pip install dist/*.tar.gz
210202
check_sdist_installs_sinter:
@@ -411,6 +403,9 @@ jobs:
411403
- uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e # v1
412404
with:
413405
node-version: 16.x
406+
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
407+
with:
408+
python-version: '3.13'
414409
- run: bazel build :stim_dev_wheel
415410
- run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
416411
- run: diff <(python dev/gen_stim_api_reference.py -dev) doc/python_api_reference_vDev.md

dev/gen_stim_stub_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def main():
2020
"""Stim {version}: a fast quantum stabilizer circuit library."""
2121
# (This is a stubs file describing the classes and methods in stim.)
2222
from __future__ import annotations
23-
from typing import overload, TYPE_CHECKING, List, Dict, Tuple, Any, Union, Iterable, Optional
23+
from typing import overload, TYPE_CHECKING, List, Dict, Tuple, Any, Union, Iterable, Optional, Sequence, Literal
2424
if TYPE_CHECKING:
2525
import io
2626
import pathlib

dev/util_gen_stub_file.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
keep = {
1010
"__add__",
11+
"__ipow__",
1112
"__radd__",
1213
"__eq__",
1314
"__call__",
@@ -36,6 +37,8 @@
3637
"__next__",
3738
}
3839
skip = {
40+
"__annotate_func__",
41+
"__annotations_cache__",
3942
"__firstlineno__",
4043
"__static_attributes__",
4144
"__replace__",
@@ -72,6 +75,8 @@
7275
"__post_init__",
7376
"__weakref__",
7477
"__abstractmethods__",
78+
"__annotate_func__",
79+
"__annotations_cache__",
7580
}
7681

7782

doc/circuit_data_references.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,18 @@
3333
- [arXiv:2408.00758](https://arxiv.org/abs/2408.00758)[Stim circuits for ``To reset, or not to reset -- that is the question" manuscript](https://zenodo.org/records/13152440)
3434
- [arXiv:2408.11894](https://arxiv.org/abs/2408.11894)[Stim circuits for 'Automated Synthesis of Fault-Tolerant State Preparation Circuits for Quantum Error Correction Codes'](https://github.com/cda-tum/mqt-qecc/tree/main/src/mqt/qecc/ft_stateprep/eval/circuits)
3535
- [arXiv:2408.13687](https://arxiv.org/abs/2408.13687)[Data for "Quantum error correction below the surface code threshold"](https://zenodo.org/records/13273331)
36+
- [arXiv:2409.04628](https://arxiv.org/abs/2409.04628)[Stim implementation of the [[16,4,4]] Tesseract Code](https://github.com/DeDuckProject/tesseract-code-stim) (circuits are in the stim_circuits/ directory)
3637
- [arXiv:2409.17595](https://arxiv.org/abs/2409.17595)[Data for "Magic state cultivation: growing T states as cheap as CNOT gates"](https://zenodo.org/records/13777072)
3738
- [arXiv:2412.01391](https://arxiv.org/abs/2412.01391)[GitHub repo for "Transversal Logical Clifford gates on rotated surface codes with reconfigurable neutral atom arrays"](https://github.com/Zihan-Chen-PhMA/Dynamical-S-gate-decoding/) (circuits are in the circuit_garage/ directory)
3839
- [arXiv:2412.14256](https://arxiv.org/abs/2412.14256)[Data for "Scaling and logic in the color code on a superconducting quantum processor"](https://zenodo.org/records/14238944)
3940
- [arXiv:2412.14360](https://arxiv.org/abs/2412.14360)[Data for "Demonstrating dynamic surface codes"](https://zenodo.org/records/14238907)
41+
- [arXiv:2412.15187](https://arxiv.org/abs/2412.15187)[Stim circuits and results for "Universal quantum computation via scalable measurement-free error correction"](https://zenodo.org/records/15707012)
4042

4143
## 2025
4244

4345
- [arXiv:2503.04968](https://arxiv.org/abs/2503.04968)[GitHub repo for "Optimized Noise-Resilient Surface Code Teleportation Interfaces"](https://github.com/QEC-pages/Modular-Surface-code-simulations/) (circuits are in the out/ directory)
4446
- [arXiv:2503.18657](https://arxiv.org/abs/2503.18657)[GitHub repo for "Efficient Magic State Cultivation on RP^2"](https://github.com/Zihan-Chen-PhMA/Cultiv_T_RP2/) (circuits are in the circuit_garage/ directory)
47+
- [arXiv:2504.02935](https://arxiv.org/abs/2504.02935)[Scripts, Stim circuits and simulation results for "Magic State Injection with Erasure Qubits"](https://zenodo.org/records/15874462)
4548
- [arXiv:2507.08069](https://arxiv.org/abs/2507.08069)[Stim circuits and simulation results for "A dynamic circuit for the honeycomb Floquet code"](https://zenodo.org/records/15854678)
4649
- [arXiv:2507.19430](https://arxiv.org/abs/2507.19430)[Stim circuits and parity check matrices for "Directional Codes: a new family of quantum LDPC codes on hexagonal- and square-grid connectivity hardware" manuscript](https://zenodo.org/records/16422162)
50+
- [arXiv:2512.17999](https://arxiv.org/abs/2512.17999)[Stim circuits for "Logical gates on Floquet codes via folds and twists"](https://zenodo.org/records/17966122)

doc/developer_documentation.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,7 @@ include(FetchContent)
202202
FetchContent_Declare(stim
203203
GIT_REPOSITORY https://github.com/quantumlib/stim.git
204204
GIT_TAG v1.4.0) # [[[<<<<<<< customize the version you want!!]]]
205-
FetchContent_GetProperties(stim)
206-
if(NOT stim_POPULATED)
207-
FetchContent_Populate(stim)
208-
add_subdirectory(${stim_SOURCE_DIR})
209-
endif()
205+
FetchContent_MakeAvailable(stim)
210206
```
211207

212208
(Replace `v1.4.0` with another version tag as appropriate.)

doc/file_format_stim_circuit.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ and annotations for tasks such as detection event sampling and drawing the circu
2525
## Encoding
2626

2727
Stim circuit files are always encoded using UTF-8.
28-
Furthermore, the only place in the file where non-ASCII characters are permitted is inside of comments.
28+
29+
(Also, the only place in the file where non-ASCII characters can validly appear is inside of comments and tags.)
2930

3031
## Syntax
3132

doc/gates.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1784,7 +1784,7 @@ Example:
17841784
# Apply Y to qubit 5 controlled by qubit 2.
17851785
CY 2 5
17861786

1787-
# Perform CY 2 5 then CX 4 2.
1787+
# Perform CY 2 5 then CY 4 2.
17881788
CY 2 5 4 2
17891789

17901790
# Apply Y to qubit 6 if the most recent measurement result was TRUE.
@@ -3579,7 +3579,7 @@ Example:
35793579

35803580
# Sample errors from the distribution 10% XX, 20% YZ, 70% II.
35813581
# Apply independently to qubit pairs (1,2), (5,6), and (8,3)
3582-
PAULI_CHANNEL_2(0,0,0, 0.1,0,0,0, 0,0,0,0.2, 0,0,0,0) 1 2 5 6 8 3
3582+
PAULI_CHANNEL_2(0,0,0, 0,0.1,0,0, 0,0,0,0.2, 0,0,0,0) 1 2 5 6 8 3
35833583

35843584
Pauli Mixture:
35853585

@@ -4879,13 +4879,19 @@ detection event simulations and affect whether the observable is included in err
48794879
makes it easier to benchmark all observables of a code, without having to introduce noiseless qubits entangled with the
48804880
logical qubit to avoid the testing of the X observable anticommuting with the testing of the Z observable.
48814881

4882+
Unlike a `DETECTOR` instruction which provides a complete description of a detector by listing all its constituent
4883+
measurement records, an individual `OBSERVABLE_INCLUDE` instruction is not required to (and generally does not) fully
4884+
describe a logical observable. Instead, measurement records or Pauli targets are added to it incrementally. A logical
4885+
observable can be given both types of description: as a collection of Pauli targets and as a collection of measurement
4886+
record targets.
4887+
48824888
Parens Arguments:
48834889

48844890
A non-negative integer specifying the index of the logical observable to add the measurement records to.
48854891

48864892
Targets:
48874893

4888-
The measurement records to add to the specified observable.
4894+
The measurement records or Pauli terms to add to the specified observable.
48894895

48904896
Example:
48914897

@@ -4921,6 +4927,12 @@ Example:
49214927
OBSERVABLE_INCLUDE(0) X0 X1
49224928
OBSERVABLE_INCLUDE(1) Z0 Z2
49234929

4930+
# Stim circuit may include a description of an observable in terms of Pauli targets
4931+
# alongside a description in terms of measurement records.
4932+
OBSERVABLE_INCLUDE(0) Z0 Z1
4933+
M 0 1
4934+
OBSERVABLE_INCLUDE(0) rec[-2] rec[-1]
4935+
49244936
<a name="QUBIT_COORDS"></a>
49254937
### The 'QUBIT_COORDS' Instruction
49264938

0 commit comments

Comments
 (0)