ellis-qec 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ellis_qec-0.1.0/.gitignore +5 -0
- ellis_qec-0.1.0/CMakeLists.txt +27 -0
- ellis_qec-0.1.0/LICENSE +202 -0
- ellis_qec-0.1.0/PKG-INFO +175 -0
- ellis_qec-0.1.0/README.md +146 -0
- ellis_qec-0.1.0/RELEASING.md +43 -0
- ellis_qec-0.1.0/cmake/FetchStim.cmake +18 -0
- ellis_qec-0.1.0/cmake/SelectCompiler.cmake +23 -0
- ellis_qec-0.1.0/cmake/SimdVariants.cmake +42 -0
- ellis_qec-0.1.0/docs/sampling.md +206 -0
- ellis_qec-0.1.0/pyproject.toml +85 -0
- ellis_qec-0.1.0/src/ellis/CMakeLists.txt +13 -0
- ellis_qec-0.1.0/src/ellis/frame/program.cc +218 -0
- ellis_qec-0.1.0/src/ellis/frame/program.h +39 -0
- ellis_qec-0.1.0/src/ellis/frame/rng.h +21 -0
- ellis_qec-0.1.0/src/ellis/frame/sampler.cc +259 -0
- ellis_qec-0.1.0/src/ellis/frame/sampler.h +37 -0
- ellis_qec-0.1.0/src/ellis/frame/simulator.h +456 -0
- ellis_qec-0.1.0/src/python/CMakeLists.txt +26 -0
- ellis_qec-0.1.0/src/python/bindings.cc +198 -0
- ellis_qec-0.1.0/src/python/cpu.cc +17 -0
- ellis_qec-0.1.0/src/python/ellis/__init__.py +4 -0
- ellis_qec-0.1.0/src/python/ellis/_clifft.py +62 -0
- ellis_qec-0.1.0/src/python/ellis/_core.py +35 -0
- ellis_qec-0.1.0/src/python/ellis/_core.pyi +53 -0
- ellis_qec-0.1.0/src/python/ellis/certify/__init__.py +151 -0
- ellis_qec-0.1.0/src/python/ellis/certify/blocks.py +131 -0
- ellis_qec-0.1.0/src/python/ellis/certify/constraints.py +319 -0
- ellis_qec-0.1.0/src/python/ellis/certify/frame_css.py +811 -0
- ellis_qec-0.1.0/src/python/ellis/check_exact.py +88 -0
- ellis_qec-0.1.0/src/python/ellis/frame.py +96 -0
- ellis_qec-0.1.0/src/python/ellis/gf2.py +39 -0
- ellis_qec-0.1.0/src/python/ellis/noise.py +55 -0
- ellis_qec-0.1.0/src/python/ellis/sampler.py +99 -0
- ellis_qec-0.1.0/src/python/ellis/sinter.py +72 -0
- ellis_qec-0.1.0/tests/fixtures/certify/benchmark_2q.jsonl +43 -0
- ellis_qec-0.1.0/tests/fixtures/certify/sat_2q.jsonl +5 -0
- ellis_qec-0.1.0/tests/fixtures/certify/sat_ls_2q.jsonl +1 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_bell_teleport_tg_Z___094bec91db.stim +309 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_bell_teleport_tg_Z___1a83c16cc4.stim +305 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_bell_teleport_xx_ls_X___05b604e569.stim +437 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_bell_teleport_xx_ls_X___467b507b33.stim +431 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_bell_teleport_zz_ls_Z___17758bc9d6.stim +433 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_bell_teleport_zz_ls_Z___a0dfe5a728.stim +439 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_ls_distillation_build__c0ee39667e.stim +2366 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_s_gate_teleport_rotated_injection_ZZ___1cf78a68d6.stim +174 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_s_gate_teleport_rotated_injection_ZZ___dd7dbb8532.stim +178 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_s_gate_teleport_rotated_injection_cnot_trans___0fe6c6eebb.stim +168 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_s_gate_teleport_rotated_injection_cnot_trans___10cb93b69a.stim +164 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_s_gate_teleport_unrotated_ZZ_inject___ceb924f263.stim +245 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_s_gate_teleport_unrotated_ZZ_inject___ead4f7de7a.stim +241 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_s_gate_teleport_unrotated_ZZ_logical_gate___29001235a3.stim +338 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_s_gate_teleport_unrotated_ZZ_logical_gate___379de6ab27.stim +332 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_s_gate_teleport_unrotated_cnot_trans_inject___3a00fe8e97.stim +239 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_s_gate_teleport_unrotated_cnot_trans_inject___5a7ca11029.stim +235 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_s_gate_teleport_unrotated_cnot_trans_logical_gate___bc5b05e379.stim +332 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalCircuits_test_s_gate_teleport_unrotated_cnot_trans_logical_gate___d9574c7437.stim +326 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_cnot_ls__268aca4e73.stim +439 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_cnot_ls__33408c8694.stim +433 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_cross_ls__a97859947f.stim +195 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_ghz__933bfa9770.stim +417 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_ghz__cd1051cf74.stim +423 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_logical_h__63fb397dbc.stim +158 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_logical_h__689e760d16.stim +162 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_logical_h_rotated_init_meas0___534f985e9b.stim +122 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_logical_h_rotated_init_meas0___595fe6c96b.stim +126 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_logical_h_rotated_init_meas1___741103c4f9.stim +127 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_logical_h_rotated_init_meas1___b0afd25fbc.stim +123 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_logical_s_roundtrip__208ff8fb33.stim +232 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_logical_s_roundtrip__a7680f536f.stim +226 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_logical_s_to_the_fourth_is_identity__cf3ebb08ff.stim +175 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_multi_patch_ls__37e6b5199b.stim +539 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_multi_patch_ls__619c5c5d4f.stim +543 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_state_injection_X___0f9d6b57fd.stim +67 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_state_injection_X___8b6c032d61.stim +69 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_state_injection_Y___39fdaa3261.stim +96 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_state_injection_Y___4a95a2e7d8.stim +99 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_state_injection_Z___970dca8e48.stim +67 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_state_injection_Z___df6420c88a.stim +69 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_transversal_cnot__4b749ac206.stim +230 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_transversal_cnot__51e40f8190.stim +234 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_two_patch_ls_xx__119be904a5.stim +256 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_two_patch_ls_xx__a367acf4a5.stim +260 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_two_patch_ls_zz__e62ac78d61.stim +261 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestLogicalOps_test_two_patch_ls_zz__eb6bf31e48.stim +257 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_H_code_family_X___0ac2f2ad57.stim +114 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_H_code_family_X___2868c119af.stim +119 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_H_code_family_Z___0a151e917c.stim +118 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_H_code_family_Z___7aee29ca73.stim +113 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_H_six_code_X___a580173e81.stim +103 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_H_six_code_X___fc30342197.stim +98 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_H_six_code_Z___0c11db060c.stim +102 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_H_six_code_Z___da72cd99d8.stim +97 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_bb_code__4053314ade.stim +456 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_bb_code__d5be0af3a5.stim +733 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_color_code__c9569bcea7.stim +93 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_color_code__d21e70cb26.stim +98 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_four_d_geo_code__a9dc74916b.stim +210 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_qec_patch_interface_infers_default_extraction_block__38833fb368.stim +41 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_qec_patch_interface_infers_default_extraction_block__5c2cb108bd.stim +42 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_repetition_code__1f1ae64cfc.stim +56 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_rotated_surface_code_X___3bb64286d1.stim +97 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_rotated_surface_code_X___879a94fb4e.stim +92 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_rotated_surface_code_Z___0d1467e85c.stim +96 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_rotated_surface_code_Z___b8bf982a0e.stim +91 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_rotated_surface_code_with_data_defect__11410876d1.stim +177 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_rotated_surface_code_with_data_defect__ec0bab9d45.stim +187 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_toric_code__0cc7ba7db2.stim +155 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_toric_code__51f40fbcf3.stim +160 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_two_patch_system_has_two_observables__3736cf0ab2.stim +185 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_two_patch_system_has_two_observables__579176681b.stim +190 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_unrotated_surface_code_X___7dd5ece89e.stim +129 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_unrotated_surface_code_X___fcaa7b0a49.stim +124 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_unrotated_surface_code_Z___7df6a5d77b.stim +123 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_unrotated_surface_code_Z___bda46d4396.stim +128 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_xzzx_surface_code_X___0a44ca410a.stim +98 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_xzzx_surface_code_X___2770464408.stim +93 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_xzzx_surface_code_Z___775bfa6fc0.stim +98 -0
- ellis_qec-0.1.0/tests/fixtures/lightstim/TestMemory_test_xzzx_surface_code_Z___f625ca0762.stim +93 -0
- ellis_qec-0.1.0/tests/python/frame_oracle.py +1084 -0
- ellis_qec-0.1.0/tests/python/test_certify.py +397 -0
- ellis_qec-0.1.0/tests/python/test_frame.py +224 -0
- ellis_qec-0.1.0/tests/python/test_frame_css_oracle.py +331 -0
- ellis_qec-0.1.0/tests/python/test_sampler.py +181 -0
- ellis_qec-0.1.0/tests/python/test_simd_variants.py +39 -0
- ellis_qec-0.1.0/tests/python/test_sinter.py +28 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# ELLIS: the C++ core (src/ellis) and its Python module ellis._core (src/python), built on Stim's C++ core.
|
|
2
|
+
#
|
|
3
|
+
# pip/uv: `uv sync` builds this through scikit-build-core (see pyproject.toml).
|
|
4
|
+
# by hand: cmake -S . -B build/dev -G Ninja && cmake --build build/dev -j8
|
|
5
|
+
cmake_minimum_required(VERSION 3.18)
|
|
6
|
+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
|
7
|
+
include(SelectCompiler)
|
|
8
|
+
project(ellis LANGUAGES CXX)
|
|
9
|
+
|
|
10
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
11
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
12
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
13
|
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
14
|
+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
15
|
+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
|
16
|
+
endif()
|
|
17
|
+
|
|
18
|
+
set(CMAKE_CXX_VISIBILITY_PRESET hidden) # every module keeps its own copy of Stim to itself
|
|
19
|
+
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
|
20
|
+
|
|
21
|
+
include(SimdVariants)
|
|
22
|
+
include(FetchStim)
|
|
23
|
+
|
|
24
|
+
add_subdirectory(src/ellis)
|
|
25
|
+
find_package(Python 3.10 REQUIRED COMPONENTS Interpreter Development.Module)
|
|
26
|
+
find_package(pybind11 CONFIG REQUIRED)
|
|
27
|
+
add_subdirectory(src/python)
|
ellis_qec-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 The ELLIS authors
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
ellis_qec-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ellis-qec
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: ELLIS: Efficient Loss and Leakage Invariant-reference Simulation. Exact masked Pauli-frame sampling of Clifford circuits with atom loss, and common-reference certificates.
|
|
5
|
+
Keywords: quantum error correction,stabilizer simulation,atom loss,leakage,stim,neutral atoms
|
|
6
|
+
Author: Yuewen Hou, Gokul Subramanian Ravi
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Operating System :: MacOS
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Programming Language :: C++
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
19
|
+
Project-URL: Repository, https://github.com/isaachyw/ELLIS
|
|
20
|
+
Project-URL: Documentation, https://github.com/isaachyw/ELLIS/blob/main/docs/sampling.md
|
|
21
|
+
Project-URL: Paper, https://arxiv.org/abs/2611.26173
|
|
22
|
+
Requires-Python: >=3.12
|
|
23
|
+
Requires-Dist: numpy>=2.2
|
|
24
|
+
Requires-Dist: stim<2,>=1.16
|
|
25
|
+
Requires-Dist: clifft<0.14,>=0.13
|
|
26
|
+
Provides-Extra: sinter
|
|
27
|
+
Requires-Dist: sinter<2,>=1.15; extra == "sinter"
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<img src="https://raw.githubusercontent.com/isaachyw/ELLIS/main/docs/assets/logos/ellis-logo-light.png" width="220" alt="ELLIS logo">
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
# ELLIS: Extremely Fast Quantum Circuit Simulation under Qubit Loss and Leakage
|
|
35
|
+
|
|
36
|
+
[](https://arxiv.org/abs/2611.26173)
|
|
37
|
+
|
|
38
|
+
ELLIS (Efficient Loss and Leakage Invariant-reference Simulation) samples Clifford circuits with qubit loss and leakage
|
|
39
|
+
exactly. It uses a masked Pauli frame and one shared reference record, so each shot does not need its own
|
|
40
|
+
tableau reference.
|
|
41
|
+
|
|
42
|
+
- **One sampling API.** `ellis.compile_sampler` certifies the circuit. When one reference is proven exact, it samples
|
|
43
|
+
with the C++ masked frame `ellis._core.MaskFrameSampler`, built on Stim's `FrameSimulator`. Otherwise it samples
|
|
44
|
+
with Clifft's noncomputational sampler in online mode. Both drop a lost qubit's later gates and read its
|
|
45
|
+
measurements as heralded fair coins.
|
|
46
|
+
- **Common-reference certificates.** `ellis.certify` proves that one reference is exact for every loss
|
|
47
|
+
pattern by frame-CSS relabelling or closed S/CZ blocks, or returns a signed-parity contradiction that
|
|
48
|
+
shows no such reference exists. Pass the circuit with its noise injected: losses and reloads happen at its
|
|
49
|
+
`I_ERROR[loss]` and `I_ERROR[reload]` markers. A circuit with neither marker is certified under
|
|
50
|
+
`PESSIMISTIC` (loss after every operation, |0> reload anywhere), so its reference holds under every loss
|
|
51
|
+
model. An explicit `LossModel` overrides both. `frame_css` decides frame-CSS exactly; a circuit outside the
|
|
52
|
+
assumptions that make the decision exact (classical feedback, multi-qubit measurements, a prefix with
|
|
53
|
+
too many open frame choices) gets verdict `"outside-assumptions"` instead.
|
|
54
|
+
|
|
55
|
+
## Loss instructions
|
|
56
|
+
|
|
57
|
+
ELLIS reads Stim circuits and adds two tagged `I_ERROR` instructions. Stim parses both and ignores them.
|
|
58
|
+
|
|
59
|
+
| Instruction | Meaning |
|
|
60
|
+
| --------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
61
|
+
| `I_ERROR[loss](p) q...` | Each atom `q` is lost with probability `p`. Its later gates are dropped and its readouts become fair coins. |
|
|
62
|
+
| `I_ERROR[reload](p) q...` | Each empty slot `q` gets a fresh atom in \|0> with probability `p` (default 1). A present atom is left alone. |
|
|
63
|
+
|
|
64
|
+
A reload happens only where its marker stands. To reload at a reset, write the marker just before it:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
CX 0 1
|
|
68
|
+
I_ERROR[loss](0.001) 0 1
|
|
69
|
+
M 1
|
|
70
|
+
I_ERROR[reload] 1
|
|
71
|
+
R 1
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Sampling performance
|
|
75
|
+
|
|
76
|
+
<p>
|
|
77
|
+
<img src="https://raw.githubusercontent.com/isaachyw/ELLIS/main/docs/assets/performance/sampling_single_core.png" width="49%" alt="Single-core sampling throughput for PPVM, Clifft online, and ELLIS on BB144 memory and the distance-7 transversal CNOT with atom loss.">
|
|
78
|
+
<img src="https://raw.githubusercontent.com/isaachyw/ELLIS/main/docs/assets/performance/sampling_multicore_128.png" width="49%" alt="128-thread sampling throughput for PPVM, Clifft online, and ELLIS on BB144 memory and the distance-7 transversal CNOT with atom loss.">
|
|
79
|
+
</p>
|
|
80
|
+
|
|
81
|
+
## Install
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
uv add ellis-qec # or: pip install ellis-qec
|
|
85
|
+
uv add "ellis-qec[sinter]" # also sinter, for ellis.sinter
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The distribution is `ellis-qec` and the import name is `ellis`. It installs Stim and Clifft with it. Wheels are
|
|
89
|
+
available for CPython 3.12, 3.13, and 3.14 on Linux x86-64 (manylinux_2_28) and macOS arm64 (macOS 15 or later, as
|
|
90
|
+
for Clifft). An x86-64 wheel contains two builds of the C++ core, one for CPUs with AVX2 and one for CPUs without it.
|
|
91
|
+
`import ellis` loads the faster build that the CPU runs, and `ellis._core.VARIANT` names it.
|
|
92
|
+
|
|
93
|
+
### Build from source
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
uv sync # builds ellis._core with CMake (fetches Stim 1.16.0 once)
|
|
97
|
+
uv sync --extra sinter # also sinter, for ellis.sinter
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The build needs a C++20 compiler: GCC 10 or newer, or Apple clang. A source build compiles one variant of the core,
|
|
101
|
+
the best one for the machine that runs the build (AVX2, SSE2, or 64-bit words on arm64). To build both x86-64 wheel
|
|
102
|
+
variants, run `uv sync -C cmake.define.ELLIS_SIMD="avx2;sse2"`, and then use `uv run --no-sync`, because a plain
|
|
103
|
+
`uv run` rebuilds with the default settings. To build
|
|
104
|
+
without network access, add `-C cmake.define.FETCHCONTENT_SOURCE_DIR_STIM=/path/to/Stim-1.16.0`. On Perlmutter,
|
|
105
|
+
CMake selects the `gcc-native` module's `g++` automatically. On a shared cluster, run the first build and the tests on
|
|
106
|
+
a compute node.
|
|
107
|
+
|
|
108
|
+
## Use
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
import ellis
|
|
112
|
+
from ellis.noise import surface_memory
|
|
113
|
+
|
|
114
|
+
circuit = surface_memory(d=5, rounds=5, p=1e-3, p_loss=1e-3) # I_ERROR[loss](p) marks loss sites
|
|
115
|
+
sampler = ellis.compile_sampler(circuit, seed=1) # certifies: verdict "proven", method "frame-css"
|
|
116
|
+
sampler.method # "frame"
|
|
117
|
+
r = sampler.sample(10**4) # r.measurements, r.detectors, r.observables, r.heralds
|
|
118
|
+
r = sampler.sample(10**6, bit_packed=True, threads=8) # the same fields, bit-packed, on 8 threads
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
| `compile_sampler` route | Sampler |
|
|
122
|
+
| -------------------------------------------------------- | ------------------------------------------------------------------------------------ |
|
|
123
|
+
| `method="auto"`, certificate proven without gauge Paulis | C++ masked frame with the certified reference |
|
|
124
|
+
| `method="auto"`, any other certificate | Clifft online |
|
|
125
|
+
| `method="frame"` | C++ masked frame; Stim's reference (unverified) unless a proven certificate is given |
|
|
126
|
+
| `method="clifft"` | Clifft online |
|
|
127
|
+
|
|
128
|
+
`method="auto"` certifies with `ellis.certify.certify(circuit, model=MARKED, **certify_options)` unless
|
|
129
|
+
`certificate=` is given: sampling loses atoms only at the markers.
|
|
130
|
+
`sample` returns a `SampleResult` with all four fields from one simulation pass; `bit_packed=True` uses Stim's
|
|
131
|
+
layout. Detection events are relative to the noiseless reference sample, as in Stim.
|
|
132
|
+
[docs/sampling.md](https://github.com/isaachyw/ELLIS/blob/main/docs/sampling.md) is the full reference: supported operations, loss semantics, routing, result
|
|
133
|
+
layout, heralds, and performance.
|
|
134
|
+
|
|
135
|
+
The sinter adapter `ellis.sinter` is under development.
|
|
136
|
+
|
|
137
|
+
## Layout
|
|
138
|
+
|
|
139
|
+
| Path | Contents |
|
|
140
|
+
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
141
|
+
| `src/ellis/frame/` | C++ masked frame: program compilation, `stim::FrameSimulator` with alive masks, batched sampler |
|
|
142
|
+
| `src/python/` | `bindings.cc` (the `ellis._core_<variant>` modules), `cpu.cc` (`ellis._cpu`, which picks the variant) |
|
|
143
|
+
| `src/python/ellis/` | `sampler` (`compile_sampler`), `_clifft` (Clifft route), `frame` (loss semantics), `certify/` (`frame_css`, `blocks`, `constraints`), `noise`, `sinter`, `gf2`, `check_exact` |
|
|
144
|
+
| `tests/python/` | tests against Stim on explicit lossy circuits and between the frame and Clifft routes; fixtures in `tests/fixtures/` |
|
|
145
|
+
| `tools/` | `bench/bench_frame.py` (masked frame and Stim speed), `classify_lightstim.py` (certify each LightStim protocol), fixture exporters |
|
|
146
|
+
| `cmake/` | Stim fetch, compiler selection, SIMD variants |
|
|
147
|
+
| `.github/workflows/` | `test.yml` (the tests on both x86-64 variants), `wheels.yml` (sdist and wheels; publishes to TestPyPI and PyPI on a `v*` tag, see `RELEASING.md`) |
|
|
148
|
+
|
|
149
|
+
## Test
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
uv run pytest -n 8
|
|
153
|
+
uv run python -m ellis.check_exact 'tests/fixtures/lightstim/*.stim' # sampler vs Stim on random loss patterns
|
|
154
|
+
uv run python tools/classify_lightstim.py --benchmark # paper App. C classification
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
Apache-2.0. ELLIS includes [Stim](https://github.com/quantumlib/Stim), which is also Apache-2.0.
|
|
160
|
+
|
|
161
|
+
## Citation
|
|
162
|
+
|
|
163
|
+
If you find ELLIS useful in your work, please cite our paper:
|
|
164
|
+
|
|
165
|
+
```bibtex
|
|
166
|
+
@misc{hou2026ellis,
|
|
167
|
+
title={Ellis: Extremely Fast Quantum Circuit Simulation under Qubit Loss and Leakage},
|
|
168
|
+
author={Yuewen Hou and Gokul Subramanian Ravi},
|
|
169
|
+
year={2026},
|
|
170
|
+
eprint={2611.26173},
|
|
171
|
+
archivePrefix={arXiv},
|
|
172
|
+
primaryClass={quant-ph},
|
|
173
|
+
url={https://arxiv.org/abs/2611.26173},
|
|
174
|
+
}
|
|
175
|
+
```
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/isaachyw/ELLIS/main/docs/assets/logos/ellis-logo-light.png" width="220" alt="ELLIS logo">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# ELLIS: Extremely Fast Quantum Circuit Simulation under Qubit Loss and Leakage
|
|
6
|
+
|
|
7
|
+
[](https://arxiv.org/abs/2611.26173)
|
|
8
|
+
|
|
9
|
+
ELLIS (Efficient Loss and Leakage Invariant-reference Simulation) samples Clifford circuits with qubit loss and leakage
|
|
10
|
+
exactly. It uses a masked Pauli frame and one shared reference record, so each shot does not need its own
|
|
11
|
+
tableau reference.
|
|
12
|
+
|
|
13
|
+
- **One sampling API.** `ellis.compile_sampler` certifies the circuit. When one reference is proven exact, it samples
|
|
14
|
+
with the C++ masked frame `ellis._core.MaskFrameSampler`, built on Stim's `FrameSimulator`. Otherwise it samples
|
|
15
|
+
with Clifft's noncomputational sampler in online mode. Both drop a lost qubit's later gates and read its
|
|
16
|
+
measurements as heralded fair coins.
|
|
17
|
+
- **Common-reference certificates.** `ellis.certify` proves that one reference is exact for every loss
|
|
18
|
+
pattern by frame-CSS relabelling or closed S/CZ blocks, or returns a signed-parity contradiction that
|
|
19
|
+
shows no such reference exists. Pass the circuit with its noise injected: losses and reloads happen at its
|
|
20
|
+
`I_ERROR[loss]` and `I_ERROR[reload]` markers. A circuit with neither marker is certified under
|
|
21
|
+
`PESSIMISTIC` (loss after every operation, |0> reload anywhere), so its reference holds under every loss
|
|
22
|
+
model. An explicit `LossModel` overrides both. `frame_css` decides frame-CSS exactly; a circuit outside the
|
|
23
|
+
assumptions that make the decision exact (classical feedback, multi-qubit measurements, a prefix with
|
|
24
|
+
too many open frame choices) gets verdict `"outside-assumptions"` instead.
|
|
25
|
+
|
|
26
|
+
## Loss instructions
|
|
27
|
+
|
|
28
|
+
ELLIS reads Stim circuits and adds two tagged `I_ERROR` instructions. Stim parses both and ignores them.
|
|
29
|
+
|
|
30
|
+
| Instruction | Meaning |
|
|
31
|
+
| --------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| `I_ERROR[loss](p) q...` | Each atom `q` is lost with probability `p`. Its later gates are dropped and its readouts become fair coins. |
|
|
33
|
+
| `I_ERROR[reload](p) q...` | Each empty slot `q` gets a fresh atom in \|0> with probability `p` (default 1). A present atom is left alone. |
|
|
34
|
+
|
|
35
|
+
A reload happens only where its marker stands. To reload at a reset, write the marker just before it:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
CX 0 1
|
|
39
|
+
I_ERROR[loss](0.001) 0 1
|
|
40
|
+
M 1
|
|
41
|
+
I_ERROR[reload] 1
|
|
42
|
+
R 1
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Sampling performance
|
|
46
|
+
|
|
47
|
+
<p>
|
|
48
|
+
<img src="https://raw.githubusercontent.com/isaachyw/ELLIS/main/docs/assets/performance/sampling_single_core.png" width="49%" alt="Single-core sampling throughput for PPVM, Clifft online, and ELLIS on BB144 memory and the distance-7 transversal CNOT with atom loss.">
|
|
49
|
+
<img src="https://raw.githubusercontent.com/isaachyw/ELLIS/main/docs/assets/performance/sampling_multicore_128.png" width="49%" alt="128-thread sampling throughput for PPVM, Clifft online, and ELLIS on BB144 memory and the distance-7 transversal CNOT with atom loss.">
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
uv add ellis-qec # or: pip install ellis-qec
|
|
56
|
+
uv add "ellis-qec[sinter]" # also sinter, for ellis.sinter
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The distribution is `ellis-qec` and the import name is `ellis`. It installs Stim and Clifft with it. Wheels are
|
|
60
|
+
available for CPython 3.12, 3.13, and 3.14 on Linux x86-64 (manylinux_2_28) and macOS arm64 (macOS 15 or later, as
|
|
61
|
+
for Clifft). An x86-64 wheel contains two builds of the C++ core, one for CPUs with AVX2 and one for CPUs without it.
|
|
62
|
+
`import ellis` loads the faster build that the CPU runs, and `ellis._core.VARIANT` names it.
|
|
63
|
+
|
|
64
|
+
### Build from source
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
uv sync # builds ellis._core with CMake (fetches Stim 1.16.0 once)
|
|
68
|
+
uv sync --extra sinter # also sinter, for ellis.sinter
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The build needs a C++20 compiler: GCC 10 or newer, or Apple clang. A source build compiles one variant of the core,
|
|
72
|
+
the best one for the machine that runs the build (AVX2, SSE2, or 64-bit words on arm64). To build both x86-64 wheel
|
|
73
|
+
variants, run `uv sync -C cmake.define.ELLIS_SIMD="avx2;sse2"`, and then use `uv run --no-sync`, because a plain
|
|
74
|
+
`uv run` rebuilds with the default settings. To build
|
|
75
|
+
without network access, add `-C cmake.define.FETCHCONTENT_SOURCE_DIR_STIM=/path/to/Stim-1.16.0`. On Perlmutter,
|
|
76
|
+
CMake selects the `gcc-native` module's `g++` automatically. On a shared cluster, run the first build and the tests on
|
|
77
|
+
a compute node.
|
|
78
|
+
|
|
79
|
+
## Use
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import ellis
|
|
83
|
+
from ellis.noise import surface_memory
|
|
84
|
+
|
|
85
|
+
circuit = surface_memory(d=5, rounds=5, p=1e-3, p_loss=1e-3) # I_ERROR[loss](p) marks loss sites
|
|
86
|
+
sampler = ellis.compile_sampler(circuit, seed=1) # certifies: verdict "proven", method "frame-css"
|
|
87
|
+
sampler.method # "frame"
|
|
88
|
+
r = sampler.sample(10**4) # r.measurements, r.detectors, r.observables, r.heralds
|
|
89
|
+
r = sampler.sample(10**6, bit_packed=True, threads=8) # the same fields, bit-packed, on 8 threads
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
| `compile_sampler` route | Sampler |
|
|
93
|
+
| -------------------------------------------------------- | ------------------------------------------------------------------------------------ |
|
|
94
|
+
| `method="auto"`, certificate proven without gauge Paulis | C++ masked frame with the certified reference |
|
|
95
|
+
| `method="auto"`, any other certificate | Clifft online |
|
|
96
|
+
| `method="frame"` | C++ masked frame; Stim's reference (unverified) unless a proven certificate is given |
|
|
97
|
+
| `method="clifft"` | Clifft online |
|
|
98
|
+
|
|
99
|
+
`method="auto"` certifies with `ellis.certify.certify(circuit, model=MARKED, **certify_options)` unless
|
|
100
|
+
`certificate=` is given: sampling loses atoms only at the markers.
|
|
101
|
+
`sample` returns a `SampleResult` with all four fields from one simulation pass; `bit_packed=True` uses Stim's
|
|
102
|
+
layout. Detection events are relative to the noiseless reference sample, as in Stim.
|
|
103
|
+
[docs/sampling.md](https://github.com/isaachyw/ELLIS/blob/main/docs/sampling.md) is the full reference: supported operations, loss semantics, routing, result
|
|
104
|
+
layout, heralds, and performance.
|
|
105
|
+
|
|
106
|
+
The sinter adapter `ellis.sinter` is under development.
|
|
107
|
+
|
|
108
|
+
## Layout
|
|
109
|
+
|
|
110
|
+
| Path | Contents |
|
|
111
|
+
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
112
|
+
| `src/ellis/frame/` | C++ masked frame: program compilation, `stim::FrameSimulator` with alive masks, batched sampler |
|
|
113
|
+
| `src/python/` | `bindings.cc` (the `ellis._core_<variant>` modules), `cpu.cc` (`ellis._cpu`, which picks the variant) |
|
|
114
|
+
| `src/python/ellis/` | `sampler` (`compile_sampler`), `_clifft` (Clifft route), `frame` (loss semantics), `certify/` (`frame_css`, `blocks`, `constraints`), `noise`, `sinter`, `gf2`, `check_exact` |
|
|
115
|
+
| `tests/python/` | tests against Stim on explicit lossy circuits and between the frame and Clifft routes; fixtures in `tests/fixtures/` |
|
|
116
|
+
| `tools/` | `bench/bench_frame.py` (masked frame and Stim speed), `classify_lightstim.py` (certify each LightStim protocol), fixture exporters |
|
|
117
|
+
| `cmake/` | Stim fetch, compiler selection, SIMD variants |
|
|
118
|
+
| `.github/workflows/` | `test.yml` (the tests on both x86-64 variants), `wheels.yml` (sdist and wheels; publishes to TestPyPI and PyPI on a `v*` tag, see `RELEASING.md`) |
|
|
119
|
+
|
|
120
|
+
## Test
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
uv run pytest -n 8
|
|
124
|
+
uv run python -m ellis.check_exact 'tests/fixtures/lightstim/*.stim' # sampler vs Stim on random loss patterns
|
|
125
|
+
uv run python tools/classify_lightstim.py --benchmark # paper App. C classification
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
Apache-2.0. ELLIS includes [Stim](https://github.com/quantumlib/Stim), which is also Apache-2.0.
|
|
131
|
+
|
|
132
|
+
## Citation
|
|
133
|
+
|
|
134
|
+
If you find ELLIS useful in your work, please cite our paper:
|
|
135
|
+
|
|
136
|
+
```bibtex
|
|
137
|
+
@misc{hou2026ellis,
|
|
138
|
+
title={Ellis: Extremely Fast Quantum Circuit Simulation under Qubit Loss and Leakage},
|
|
139
|
+
author={Yuewen Hou and Gokul Subramanian Ravi},
|
|
140
|
+
year={2026},
|
|
141
|
+
eprint={2611.26173},
|
|
142
|
+
archivePrefix={arXiv},
|
|
143
|
+
primaryClass={quant-ph},
|
|
144
|
+
url={https://arxiv.org/abs/2611.26173},
|
|
145
|
+
}
|
|
146
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Releasing ellis-qec
|
|
2
|
+
|
|
3
|
+
`.github/workflows/wheels.yml` builds the sdist and the wheels on every push. It publishes them only when the
|
|
4
|
+
pushed ref is a tag that starts with `v`.
|
|
5
|
+
|
|
6
|
+
## Release a version
|
|
7
|
+
|
|
8
|
+
1. Set `version` in `pyproject.toml`, for example `0.1.1`, and merge the change to `main`.
|
|
9
|
+
2. Check that the `test` and `wheels` workflows pass on that commit of `main`.
|
|
10
|
+
3. Tag the commit and push the tag. The tag must be `v` followed by the version in `pyproject.toml`.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
git tag v0.1.1
|
|
14
|
+
git push origin v0.1.1
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## What the tag starts
|
|
18
|
+
|
|
19
|
+
1. `sdist` builds `ellis_qec-<version>.tar.gz` with `uv build --sdist`.
|
|
20
|
+
2. `wheels` runs cibuildwheel for CPython 3.12, 3.13, and 3.14 on `ubuntu-latest` (manylinux_2_28 x86-64) and
|
|
21
|
+
`macos-15` (arm64). Each wheel is tested with the test suite in `tests/python` before it is uploaded. A check
|
|
22
|
+
fails the job if a wheel does not contain the expected `ellis._core` variants: `avx2` and `sse2` on Linux,
|
|
23
|
+
`polyfill` on macOS.
|
|
24
|
+
3. `testpypi` checks that the tag names the sdist's version and uploads every file to TestPyPI. It runs in the GitHub
|
|
25
|
+
environment `testpypi`.
|
|
26
|
+
4. `pypi` runs after `testpypi` succeeds and uploads the same files to PyPI. It runs in the GitHub environment `pypi`.
|
|
27
|
+
|
|
28
|
+
Both upload jobs use trusted publishing (OpenID Connect), so the repository stores no PyPI token. The pending publisher
|
|
29
|
+
on each index must name project `ellis-qec`, owner `isaachyw`, repository `ELLIS`, workflow `wheels.yml`, and the
|
|
30
|
+
environment of its job: `testpypi` on test.pypi.org and `pypi` on pypi.org.
|
|
31
|
+
|
|
32
|
+
If the `pypi` job fails, rerun the failed jobs of the workflow run. The `testpypi` job skips files that TestPyPI already
|
|
33
|
+
has. PyPI never accepts a second upload of a file, so a release that reached PyPI with a defect needs a new version.
|
|
34
|
+
|
|
35
|
+
## Check a TestPyPI release
|
|
36
|
+
|
|
37
|
+
TestPyPI does not host the dependencies, so install them from PyPI:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
python3.12 -m venv /tmp/ellis-check && . /tmp/ellis-check/bin/activate
|
|
41
|
+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ ellis-qec==0.1.1
|
|
42
|
+
python -c "import ellis, ellis._core as c; print(c.VARIANT)"
|
|
43
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Stim, pinned to the version of the `stim` Python package. To build against a local checkout instead, pass
|
|
2
|
+
# -DFETCHCONTENT_SOURCE_DIR_STIM=/path/to/Stim. Stim's own CMakeLists is not used: its libstim has one SIMD width,
|
|
3
|
+
# and ELLIS compiles Stim's sources once per SIMD variant (src/ellis/CMakeLists.txt).
|
|
4
|
+
include(FetchContent)
|
|
5
|
+
if(POLICY CMP0169)
|
|
6
|
+
cmake_policy(SET CMP0169 OLD) # FetchContent_Populate: download only, no add_subdirectory
|
|
7
|
+
endif()
|
|
8
|
+
FetchContent_Declare(
|
|
9
|
+
stim
|
|
10
|
+
URL https://github.com/quantumlib/Stim/archive/refs/tags/v1.16.0.tar.gz
|
|
11
|
+
URL_HASH SHA256=be54b3efa6f01c16a119e0db99fe1d624f448efd5ab8219cd3da2b75a900682e
|
|
12
|
+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
|
|
13
|
+
FetchContent_GetProperties(stim)
|
|
14
|
+
if(NOT stim_POPULATED)
|
|
15
|
+
FetchContent_Populate(stim)
|
|
16
|
+
endif()
|
|
17
|
+
file(STRINGS ${stim_SOURCE_DIR}/file_lists/source_files_no_main STIM_SOURCES)
|
|
18
|
+
list(TRANSFORM STIM_SOURCES PREPEND ${stim_SOURCE_DIR}/)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# CMake uses $CXX or else `c++`; on Perlmutter both mean the system GCC 7 (uv's build frontend sets
|
|
2
|
+
# CXX=c++), which has no C++20. If that compiler is older than GCC 10, take `g++` from PATH (the
|
|
3
|
+
# gcc-native module) when it is new enough. An explicit -DCMAKE_CXX_COMPILER always wins.
|
|
4
|
+
# Include this before project().
|
|
5
|
+
if(NOT DEFINED CMAKE_CXX_COMPILER)
|
|
6
|
+
set(_cxx "$ENV{CXX}")
|
|
7
|
+
if(NOT _cxx)
|
|
8
|
+
set(_cxx c++)
|
|
9
|
+
endif()
|
|
10
|
+
separate_arguments(_cxx UNIX_COMMAND "${_cxx}")
|
|
11
|
+
list(GET _cxx 0 _cxx)
|
|
12
|
+
execute_process(COMMAND "${_cxx}" -dumpversion OUTPUT_VARIABLE _cxx_version
|
|
13
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
|
14
|
+
find_program(ELLIS_GXX NAMES g++)
|
|
15
|
+
if(_cxx_version AND _cxx_version VERSION_LESS 10 AND ELLIS_GXX)
|
|
16
|
+
execute_process(COMMAND "${ELLIS_GXX}" -dumpversion OUTPUT_VARIABLE _gxx_version
|
|
17
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
|
18
|
+
if(_gxx_version VERSION_GREATER_EQUAL 10)
|
|
19
|
+
message(STATUS "${_cxx} is GCC ${_cxx_version} (no C++20); using ${ELLIS_GXX} (GCC ${_gxx_version})")
|
|
20
|
+
set(CMAKE_CXX_COMPILER "${ELLIS_GXX}")
|
|
21
|
+
endif()
|
|
22
|
+
endif()
|
|
23
|
+
endif()
|