qLDPC 0.3.2__tar.gz → 0.4.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.
- qldpc-0.4.0/COPYRIGHT +11 -0
- qldpc-0.4.0/LICENSE +202 -0
- qldpc-0.4.0/PKG-INFO +259 -0
- qldpc-0.4.0/README.md +199 -0
- qldpc-0.4.0/pyproject.toml +149 -0
- qldpc-0.4.0/pyproject.toml.orig +141 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/__init__.py +4 -1
- qldpc-0.4.0/src/qldpc/_util.py +180 -0
- qldpc-0.4.0/src/qldpc/_util_test.py +118 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/abstract/__init__.py +48 -14
- qldpc-0.4.0/src/qldpc/abstract/_monomials.py +49 -0
- qldpc-0.4.0/src/qldpc/abstract/_monomials_test.py +35 -0
- qldpc-0.4.0/src/qldpc/abstract/groups.py +1430 -0
- qldpc-0.4.0/src/qldpc/abstract/groups_test.py +643 -0
- qldpc-0.4.0/src/qldpc/abstract/linalg.py +315 -0
- qldpc-0.4.0/src/qldpc/abstract/linalg_test.py +232 -0
- qldpc-0.4.0/src/qldpc/abstract/ring_array.py +923 -0
- qldpc-0.4.0/src/qldpc/abstract/ring_array_test.py +400 -0
- qldpc-0.4.0/src/qldpc/abstract/rings.py +550 -0
- qldpc-0.4.0/src/qldpc/abstract/rings_test.py +193 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/abstract/wedderburn_artin.py +331 -239
- qldpc-0.4.0/src/qldpc/abstract/wedderburn_artin_test.py +223 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/cache.py +3 -16
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/cache_test.py +6 -16
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/__init__.py +38 -22
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/benchmarking.py +77 -52
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/benchmarking_test.py +85 -16
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/bookkeeping.py +96 -42
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/bookkeeping_test.py +39 -20
- qldpc-0.4.0/src/qldpc/circuits/common.py +210 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/common_test.py +22 -22
- qldpc-0.4.0/src/qldpc/circuits/conftest.py +35 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/encoding.py +80 -72
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/encoding_test.py +75 -16
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/memory/__init__.py +7 -3
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/memory/alpha_syndrome.py +95 -56
- qldpc-0.4.0/src/qldpc/circuits/memory/alpha_syndrome_test.py +201 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/memory/memory.py +161 -103
- qldpc-0.4.0/src/qldpc/circuits/memory/memory_test.py +203 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/memory/syndrome_measurement.py +63 -44
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/memory/syndrome_measurement_test.py +41 -17
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/noise_model.py +522 -205
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/noise_model_test.py +329 -68
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/transversal.py +114 -76
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/circuits/transversal_test.py +91 -19
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/codes/__init__.py +37 -17
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/codes/classical.py +170 -53
- qldpc-0.4.0/src/qldpc/codes/classical_test.py +214 -0
- qldpc-0.4.0/src/qldpc/codes/code_capacity.py +413 -0
- qldpc-0.4.0/src/qldpc/codes/code_capacity_test.py +511 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/codes/common.py +1435 -732
- qldpc-0.4.0/src/qldpc/codes/common_test.py +1974 -0
- qldpc-0.4.0/src/qldpc/codes/distance.py +1099 -0
- qldpc-0.4.0/src/qldpc/codes/distance_test.py +1058 -0
- qldpc-0.4.0/src/qldpc/codes/monte_carlo.py +412 -0
- qldpc-0.4.0/src/qldpc/codes/monte_carlo_test.py +429 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/codes/quantum.py +784 -373
- qldpc-0.4.0/src/qldpc/codes/quantum_test.py +1427 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/conftest.py +52 -0
- qldpc-0.4.0/src/qldpc/decoders/__init__.py +223 -0
- qldpc-0.4.0/src/qldpc/decoders/adapters/__init__.py +28 -0
- qldpc-0.4.0/src/qldpc/decoders/adapters/error_decoders.py +116 -0
- qldpc-0.4.0/src/qldpc/decoders/adapters/error_decoders_test.py +85 -0
- qldpc-0.4.0/src/qldpc/decoders/adapters/observable_decoders.py +128 -0
- qldpc-0.4.0/src/qldpc/decoders/adapters/observable_decoders_test.py +102 -0
- qldpc-0.4.0/src/qldpc/decoders/capabilities.py +87 -0
- qldpc-0.4.0/src/qldpc/decoders/capabilities_test.py +113 -0
- qldpc-0.4.0/src/qldpc/decoders/common.py +98 -0
- qldpc-0.4.0/src/qldpc/decoders/common_test.py +88 -0
- qldpc-0.4.0/src/qldpc/decoders/conftest.py +42 -0
- qldpc-0.4.0/src/qldpc/decoders/construction/__init__.py +92 -0
- qldpc-0.4.0/src/qldpc/decoders/construction/legacy.py +291 -0
- qldpc-0.4.0/src/qldpc/decoders/construction/legacy_test.py +164 -0
- qldpc-0.4.0/src/qldpc/decoders/construction/resolution.py +136 -0
- qldpc-0.4.0/src/qldpc/decoders/construction/resolution_test.py +456 -0
- qldpc-0.4.0/src/qldpc/decoders/construction/specs.py +453 -0
- qldpc-0.4.0/src/qldpc/decoders/construction/specs_test.py +258 -0
- qldpc-0.4.0/src/qldpc/decoders/custom/__init__.py +48 -0
- qldpc-0.4.0/src/qldpc/decoders/custom/composition.py +167 -0
- qldpc-0.4.0/src/qldpc/decoders/custom/composition_test.py +101 -0
- qldpc-0.4.0/src/qldpc/decoders/custom/guf.py +193 -0
- qldpc-0.4.0/src/qldpc/decoders/custom/guf_test.py +91 -0
- qldpc-0.4.0/src/qldpc/decoders/custom/ilp.py +172 -0
- qldpc-0.4.0/src/qldpc/decoders/custom/ilp_test.py +146 -0
- qldpc-0.4.0/src/qldpc/decoders/custom/lookup.py +1167 -0
- qldpc-0.4.0/src/qldpc/decoders/custom/lookup_test.py +639 -0
- qldpc-0.4.0/src/qldpc/decoders/custom_test.py +20 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/decoders/dems.py +273 -65
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/decoders/dems_test.py +196 -15
- qldpc-0.4.0/src/qldpc/decoders/external/__init__.py +31 -0
- qldpc-0.4.0/src/qldpc/decoders/external/ldpc.py +219 -0
- qldpc-0.4.0/src/qldpc/decoders/external/ldpc_test.py +100 -0
- qldpc-0.4.0/src/qldpc/decoders/external/pymatching.py +267 -0
- qldpc-0.4.0/src/qldpc/decoders/external/pymatching_test.py +111 -0
- qldpc-0.4.0/src/qldpc/decoders/external/relay_bp.py +374 -0
- qldpc-0.4.0/src/qldpc/decoders/external/relay_bp_test.py +156 -0
- qldpc-0.4.0/src/qldpc/decoders/protocols.py +183 -0
- qldpc-0.4.0/src/qldpc/decoders/protocols_test.py +120 -0
- qldpc-0.4.0/src/qldpc/decoders/sinter/__init__.py +56 -0
- qldpc-0.4.0/src/qldpc/decoders/sinter/core.py +417 -0
- qldpc-0.4.0/src/qldpc/decoders/sinter/core_test.py +368 -0
- qldpc-0.4.0/src/qldpc/decoders/sinter/subgraph.py +256 -0
- qldpc-0.4.0/src/qldpc/decoders/sinter/subgraph_test.py +148 -0
- qldpc-0.4.0/src/qldpc/decoders/sinter/window.py +488 -0
- qldpc-0.4.0/src/qldpc/decoders/sinter/window_test.py +299 -0
- qldpc-0.4.0/src/qldpc/decoders/sinter_test.py +21 -0
- qldpc-0.4.0/src/qldpc/decoders_test.py +41 -0
- qldpc-0.4.0/src/qldpc/experimental/__init__.py +11 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/__init__.py +41 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/_compiler.py +327 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/_compiler_test.py +452 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/bridge.py +489 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/bridge_test.py +788 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/cheeger.py +502 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/cheeger_test.py +608 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/circuit.py +1379 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/circuit_test.py +2287 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/conftest.py +274 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/construction.py +246 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/construction_test.py +240 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/gadget.py +357 -0
- qldpc-0.4.0/src/qldpc/experimental/surgery/gadget_test.py +737 -0
- qldpc-0.4.0/src/qldpc/external/__init__.py +5 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/external/codes.py +57 -29
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/external/codes_test.py +48 -21
- qldpc-0.4.0/src/qldpc/external/gap.py +425 -0
- qldpc-0.4.0/src/qldpc/external/gap_test.py +607 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/external/groups.py +144 -33
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/external/groups_test.py +73 -20
- qldpc-0.4.0/src/qldpc/external/sqetch.py +153 -0
- qldpc-0.4.0/src/qldpc/external/sqetch_test.py +229 -0
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/math.py +120 -54
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/math_test.py +72 -17
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/objects.py +81 -68
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/objects_test.py +34 -18
- qldpc-0.3.2/PKG-INFO +0 -151
- qldpc-0.3.2/README.md +0 -111
- qldpc-0.3.2/pyproject.toml +0 -89
- qldpc-0.3.2/src/qldpc/abstract/groups.py +0 -974
- qldpc-0.3.2/src/qldpc/abstract/groups_test.py +0 -297
- qldpc-0.3.2/src/qldpc/abstract/linalg.py +0 -183
- qldpc-0.3.2/src/qldpc/abstract/linalg_test.py +0 -122
- qldpc-0.3.2/src/qldpc/abstract/rings.py +0 -1115
- qldpc-0.3.2/src/qldpc/abstract/rings_test.py +0 -318
- qldpc-0.3.2/src/qldpc/abstract/wedderburn_artin_test.py +0 -172
- qldpc-0.3.2/src/qldpc/circuits/common.py +0 -164
- qldpc-0.3.2/src/qldpc/circuits/conftest_probe.py +0 -13
- qldpc-0.3.2/src/qldpc/circuits/memory/alpha_syndrome_test.py +0 -79
- qldpc-0.3.2/src/qldpc/circuits/memory/memory_test.py +0 -112
- qldpc-0.3.2/src/qldpc/codes/classical_test.py +0 -115
- qldpc-0.3.2/src/qldpc/codes/common_test.py +0 -795
- qldpc-0.3.2/src/qldpc/codes/distance.py +0 -349
- qldpc-0.3.2/src/qldpc/codes/distance_test.py +0 -616
- qldpc-0.3.2/src/qldpc/codes/quantum_test.py +0 -776
- qldpc-0.3.2/src/qldpc/decoders/__init__.py +0 -75
- qldpc-0.3.2/src/qldpc/decoders/custom.py +0 -924
- qldpc-0.3.2/src/qldpc/decoders/custom_test.py +0 -302
- qldpc-0.3.2/src/qldpc/decoders/retrieval.py +0 -314
- qldpc-0.3.2/src/qldpc/decoders/retrieval_test.py +0 -82
- qldpc-0.3.2/src/qldpc/decoders/sinter.py +0 -788
- qldpc-0.3.2/src/qldpc/decoders/sinter_test.py +0 -250
- qldpc-0.3.2/src/qldpc/external/__init__.py +0 -3
- qldpc-0.3.2/src/qldpc/external/gap.py +0 -190
- qldpc-0.3.2/src/qldpc/external/gap_test.py +0 -161
- {qldpc-0.3.2 → qldpc-0.4.0}/src/qldpc/py.typed +0 -0
qldpc-0.4.0/COPYRIGHT
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
qLDPC Copyright Notice
|
|
2
|
+
|
|
3
|
+
Portions of qLDPC authored before June 2024 are:
|
|
4
|
+
|
|
5
|
+
Copyright 2023-2024 The qLDPC Authors and Infleqtion Inc.
|
|
6
|
+
|
|
7
|
+
Portions authored on or after June 2024 are:
|
|
8
|
+
|
|
9
|
+
Copyright 2024-present The qLDPC Authors.
|
|
10
|
+
|
|
11
|
+
Individual files and third-party components may carry additional or different copyright notices.
|
qldpc-0.4.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 [yyyy] [name of copyright owner]
|
|
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.
|
qldpc-0.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qldpc
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Tools for constructing and analyzing quantum low density parity check (qLDPC) codes.
|
|
5
|
+
Keywords: LDPC,low density parity check codes,quantum computing,quantum error correction
|
|
6
|
+
Author: Michael A. Perlin
|
|
7
|
+
Author-email: Michael A. Perlin <mika.perlin@gmail.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: COPYRIGHT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
21
|
+
Requires-Dist: cvxpy>=1.3.2
|
|
22
|
+
Requires-Dist: diskcache>=5
|
|
23
|
+
Requires-Dist: galois>=0.4.2
|
|
24
|
+
Requires-Dist: ldpc>=2.4.1
|
|
25
|
+
Requires-Dist: networkx>=2.6.2
|
|
26
|
+
Requires-Dist: numpy>=1.24
|
|
27
|
+
Requires-Dist: platformdirs>=4
|
|
28
|
+
Requires-Dist: pymatching>=2.3
|
|
29
|
+
Requires-Dist: pyperclip>=1.11
|
|
30
|
+
Requires-Dist: scipy>=1.14.1
|
|
31
|
+
Requires-Dist: sinter>=1.16
|
|
32
|
+
Requires-Dist: stim>=1.16
|
|
33
|
+
Requires-Dist: sympy>=1.12
|
|
34
|
+
Requires-Dist: tqdm>=4
|
|
35
|
+
Requires-Dist: checks-superstaq>=0.5.67 ; extra == 'dev'
|
|
36
|
+
Requires-Dist: jupyter>=1.1.1 ; extra == 'dev'
|
|
37
|
+
Requires-Dist: pypandoc-binary>=1.13 ; extra == 'dev'
|
|
38
|
+
Requires-Dist: pyproject-fmt>=2 ; extra == 'dev'
|
|
39
|
+
Requires-Dist: pytest>=8 ; extra == 'dev'
|
|
40
|
+
Requires-Dist: pytest-randomly>=3.10 ; extra == 'dev'
|
|
41
|
+
Requires-Dist: pytest-socket>=0.7 ; extra == 'dev'
|
|
42
|
+
Requires-Dist: python-lsp-server[all]>=1.14 ; extra == 'dev'
|
|
43
|
+
Requires-Dist: qldpc[docs,gap,relay-bp] ; extra == 'dev'
|
|
44
|
+
Requires-Dist: ipython>=8 ; extra == 'docs'
|
|
45
|
+
Requires-Dist: nbsphinx>=0.9 ; extra == 'docs'
|
|
46
|
+
Requires-Dist: sphinx>=7 ; extra == 'docs'
|
|
47
|
+
Requires-Dist: sphinx-autoapi>=3 ; extra == 'docs'
|
|
48
|
+
Requires-Dist: sphinx-rtd-theme>=2 ; extra == 'docs'
|
|
49
|
+
Requires-Dist: passagemath-gap==10.8.12 ; python_full_version < '3.15' and sys_platform != 'win32' and extra == 'gap'
|
|
50
|
+
Requires-Dist: relay-bp[stim]==0.2.2 ; extra == 'relay-bp'
|
|
51
|
+
Requires-Python: >=3.11
|
|
52
|
+
Project-URL: Documentation, https://qldpc.readthedocs.io/
|
|
53
|
+
Project-URL: Issues, https://github.com/qLDPCOrg/qLDPC/issues
|
|
54
|
+
Project-URL: Repository, https://github.com/qLDPCOrg/qLDPC
|
|
55
|
+
Provides-Extra: dev
|
|
56
|
+
Provides-Extra: docs
|
|
57
|
+
Provides-Extra: gap
|
|
58
|
+
Provides-Extra: relay-bp
|
|
59
|
+
Description-Content-Type: text/markdown
|
|
60
|
+
|
|
61
|
+
# qLDPC
|
|
62
|
+
|
|
63
|
+
`qLDPC` is a Python toolkit for constructing and analyzing finite-size [quantum low-density parity-check codes](https://errorcorrectionzoo.org/c/qldpc), as well as stabilizer and subsystem codes more broadly.
|
|
64
|
+
The goal is simple: make the quantum error-correction literature easier to explore, reproduce, and build on.
|
|
65
|
+
Codes can start from parity-check matrices or from higher-level ingredients such as polynomials, group rings, Tanner graphs, and chain complexes.
|
|
66
|
+
Once a code is built, you can inspect its logical operators, compute or bound its distance, plug in a decoder, estimate logical error rates, and—for qubit codes—build [`stim`](https://github.com/quantumlib/Stim) circuits.
|
|
67
|
+
|
|
68
|
+
Most code-level tools work over arbitrary finite fields.
|
|
69
|
+
Circuit tools currently only support qubit codes.
|
|
70
|
+
|
|
71
|
+
## ✨ A taste of qLDPC
|
|
72
|
+
|
|
73
|
+
- **From textbook codes to the research frontier.**
|
|
74
|
+
Build familiar surface, toric, Hamming, and Reed–Muller codes alongside hypergraph-product, lifted-product, bivariate-bicycle, quantum Tanner, SHYPS, GALA, and other modern families.
|
|
75
|
+
- **Go beyond binary.**
|
|
76
|
+
Many constructions and core algorithms work over arbitrary prime-power finite fields, not just qubits.
|
|
77
|
+
- **Ask more of a code than `[[n, k, d]]`.**
|
|
78
|
+
Work with check matrices, Tanner graphs, canonical logical operators, subsystem gauges, exact distances, upper bounds, and code-capacity error estimates.
|
|
79
|
+
- **Move from codes to circuits.**
|
|
80
|
+
Build memory experiments, encoding circuits, Pauli noise models, state-preparation diagnostics, Sinter decoders, sliding-window decoders, and transversal Clifford searches.
|
|
81
|
+
- **Use the algebra that modern constructions need.**
|
|
82
|
+
qLDPC includes finite groups, group rings, lifted matrices, Cayley complexes, chain complexes, and optional GAP integration.
|
|
83
|
+
- **Steal from the examples.**
|
|
84
|
+
The notebooks progress from the basics to circuit-level logical error rates, custom noise, transversal gates, and experimental lattice surgery.
|
|
85
|
+
|
|
86
|
+
qLDPC is still research software, and it is honest about the tradeoffs.
|
|
87
|
+
Some searches are expensive, some bounds are heuristic, experimental APIs can change, and optional tools may have side effects.
|
|
88
|
+
|
|
89
|
+
## 📦 Installation
|
|
90
|
+
|
|
91
|
+
### Standard installation
|
|
92
|
+
|
|
93
|
+
qLDPC requires Python 3.11 or later:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
python -m pip install qldpc
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Optional extras
|
|
100
|
+
|
|
101
|
+
#### Relay-BP decoder
|
|
102
|
+
|
|
103
|
+
Install the optional Relay-BP decoder with:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
python -m pip install 'qldpc[relay-bp]'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### GAP integration
|
|
110
|
+
|
|
111
|
+
Some algebra tools, code lookups, and distance estimates require [GAP](https://www.gap-system.org).
|
|
112
|
+
For the recommended in-process integration, install qLDPC with its maintained libgap extra:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
python -m pip install 'qldpc[gap]'
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
qLDPC uses `passagemath-gap` when it is installed, so supported GAP operations do not launch a separate process.
|
|
119
|
+
If the extra is unavailable, qLDPC still supports a GAP executable on `PATH` (`conda install -c conda-forge gap` is one option) and retains its documented manual copy/paste fallback.
|
|
120
|
+
If a package such as GUAVA or QDistRnd is absent from the in-process binding, qLDPC asks for permission to install it through GAP's PackageManager.
|
|
121
|
+
If that attempt fails and a separate GAP executable is available, qLDPC prints instructions for installing the package for libgap before using the executable instead.
|
|
122
|
+
GAP integration on Windows remains limited; see [issue #294](https://github.com/qLDPCOrg/qLDPC/issues/294).
|
|
123
|
+
|
|
124
|
+
#### `sqetch` distance estimation
|
|
125
|
+
|
|
126
|
+
You can install the optional `sqetch` distance-estimation backend with:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
python -m pip install 'sqetch[gpu] @ git+https://github.com/a7b/yarn.git@e9ce9d0fcecc973988558bfee27fab6d6b8d7f97#subdirectory=sqetch'
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
This command installs the upstream version of `sqetch` that qLDPC is tested against, with GPU support.
|
|
133
|
+
`sqetch` is not published on PyPI, so it is not available as a qLDPC extra.
|
|
134
|
+
For binary CSS codes, select it with `code.get_distance_bound(backend="sqetch")`.
|
|
135
|
+
|
|
136
|
+
### Troubleshooting
|
|
137
|
+
|
|
138
|
+
On macOS, you may need to install `cvxpy` manually by following its [installation instructions](https://www.cvxpy.org/install) before installing qLDPC.
|
|
139
|
+
If you use Conda to manage your Python environment, install `cvxpy` with:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
conda install -c conda-forge cvxpy
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Development installation
|
|
146
|
+
|
|
147
|
+
For a development installation:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
git clone https://github.com/qLDPCOrg/qLDPC.git
|
|
151
|
+
cd qLDPC
|
|
152
|
+
python -m pip install -e '.[dev]'
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## 🚀 Quickstart
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
from sympy.abc import x, y
|
|
159
|
+
|
|
160
|
+
from qldpc import codes
|
|
161
|
+
|
|
162
|
+
# The [[144, 12, 12]] bivariate bicycle "gross code".
|
|
163
|
+
code = codes.BBCode({x: 12, y: 6}, x**3 + y + y**2, y**3 + x + x**2)
|
|
164
|
+
|
|
165
|
+
print(code)
|
|
166
|
+
print("physical qubits:", len(code))
|
|
167
|
+
print("logical qubits:", code.dimension)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
That object is ready for more than a parameter check: inspect its parity checks and logical operators, choose a decoder, estimate a logical error rate, or use it in a memory experiment.
|
|
171
|
+
|
|
172
|
+
### Go deeper: a subsystem lifted-product code
|
|
173
|
+
|
|
174
|
+
For a more technical taste, the next example builds a parity-check matrix over the group algebra `GF(2)[C₅]`, lifts each group-ring entry to a 5×5 binary block, and hands the result to `SLPCode`.
|
|
175
|
+
The [subsystem lifted-product construction](https://arxiv.org/abs/2404.18302) produces an 80-qubit CSS subsystem code with 5 logical qubits and 45 gauge qubits.
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
from qldpc import abstract, codes
|
|
179
|
+
|
|
180
|
+
group = abstract.CyclicGroup(5)
|
|
181
|
+
ring = abstract.GroupRing(group)
|
|
182
|
+
x = ring.generators[0]
|
|
183
|
+
|
|
184
|
+
repetition = abstract.RingArray.build(
|
|
185
|
+
[[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 1, 1]],
|
|
186
|
+
ring,
|
|
187
|
+
)
|
|
188
|
+
connections = abstract.RingArray.build(
|
|
189
|
+
[[0, x, 0, 0], [0, 0, x, 0], [0, 0, 0, x]],
|
|
190
|
+
ring,
|
|
191
|
+
)
|
|
192
|
+
code = codes.SLPCode(repetition + connections)
|
|
193
|
+
|
|
194
|
+
print("physical qubits:", len(code)) # 80
|
|
195
|
+
print("logical qubits:", code.dimension) # 5
|
|
196
|
+
print("gauge qubits:", code.gauge_dimension) # 45
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Continue with the [library map](https://qldpc.readthedocs.io/library_map.html) for the data model and package structure, or open the [example notebooks](https://qldpc.readthedocs.io/examples/index.html) for complete workflows.
|
|
200
|
+
|
|
201
|
+
## 🧭 Find your way around
|
|
202
|
+
|
|
203
|
+
| Goal | Start here |
|
|
204
|
+
| --- | --- |
|
|
205
|
+
| Understand code representations and how packages fit together | [Library map](https://qldpc.readthedocs.io/library_map.html) |
|
|
206
|
+
| Learn by running complete workflows | [Examples](https://qldpc.readthedocs.io/examples/index.html) |
|
|
207
|
+
| Browse code families, functions, and exact signatures | [API reference](https://qldpc.readthedocs.io/autoapi/index.html) |
|
|
208
|
+
| Construct and analyze a first code | [qLDPC basics](https://qldpc.readthedocs.io/examples/basics.html) |
|
|
209
|
+
| Estimate logical error rates | [Logical-error-rate examples](https://qldpc.readthedocs.io/examples/index.html#logical-error-rates) |
|
|
210
|
+
| Build memory circuits or noise models | [Circuit examples](https://qldpc.readthedocs.io/examples/index.html) |
|
|
211
|
+
| Change or extend qLDPC safely | [Agent and contributor guide](https://github.com/qLDPCOrg/qLDPC/blob/main/AGENTS.md) |
|
|
212
|
+
|
|
213
|
+
For the complete list of classes and functions, including construction-specific literature, use the API reference and source docstrings.
|
|
214
|
+
This README focuses on getting started and finding the right documentation.
|
|
215
|
+
|
|
216
|
+
## ⚠️ Limitations and caveats
|
|
217
|
+
|
|
218
|
+
- Circuit and tableau tools only work with qubit codes, even though other parts of qLDPC support prime-power-dimensional qudits.
|
|
219
|
+
- Circuits returned by `get_encoding_circuit` are not fault-tolerant.
|
|
220
|
+
Fault-tolerant encoding is tracked in [issue #327](https://github.com/qLDPCOrg/qLDPC/issues/327).
|
|
221
|
+
- Exact distance calculations and transversal-gate searches can be exponential.
|
|
222
|
+
When a method returns a bound rather than an exact distance, its docstring explains what kind of bound it is.
|
|
223
|
+
- Features that use GAP may start subprocesses, use local disk caches, access online resources, or ask for manual input or permission to install a package.
|
|
224
|
+
- Everything under `qldpc.experimental` has an unstable public API and may change without deprecation.
|
|
225
|
+
In particular, lattice-surgery support has not yet received independent expert review; validate its results independently and pin the qLDPC version if you depend on it.
|
|
226
|
+
|
|
227
|
+
## 📚 Documentation and support
|
|
228
|
+
|
|
229
|
+
- [Documentation](https://qldpc.readthedocs.io/)
|
|
230
|
+
- [Examples](https://github.com/qLDPCOrg/qLDPC/tree/main/examples)
|
|
231
|
+
- [API reference](https://qldpc.readthedocs.io/autoapi/index.html)
|
|
232
|
+
- [Agent and contributor guide](https://github.com/qLDPCOrg/qLDPC/blob/main/AGENTS.md)
|
|
233
|
+
- [Issue tracker](https://github.com/qLDPCOrg/qLDPC/issues)
|
|
234
|
+
|
|
235
|
+
Questions, feedback, and ideas are welcome through [GitHub issues](https://github.com/qLDPCOrg/qLDPC/issues/new) or by email at [mika.perlin@gmail.com](mailto:mika.perlin@gmail.com).
|
|
236
|
+
|
|
237
|
+
## ⚓ Attribution
|
|
238
|
+
|
|
239
|
+
If you use this software in your work, please cite with:
|
|
240
|
+
|
|
241
|
+
```bibtex
|
|
242
|
+
@misc{perlin2023qldpc,
|
|
243
|
+
author = {Perlin, Michael A.},
|
|
244
|
+
title = {{qLDPC}},
|
|
245
|
+
year = {2023},
|
|
246
|
+
publisher = {GitHub},
|
|
247
|
+
journal = {GitHub repository},
|
|
248
|
+
howpublished = {\url{https://github.com/qLDPCOrg/qLDPC}},
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
This may require adding `\usepackage{url}` to your LaTeX file header.
|
|
253
|
+
Alternatively:
|
|
254
|
+
|
|
255
|
+
```text
|
|
256
|
+
Michael A. Perlin. qLDPC. https://github.com/qLDPCOrg/qLDPC, 2023.
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
qLDPC is distributed under the [Apache License 2.0](https://github.com/qLDPCOrg/qLDPC/blob/main/LICENSE).
|
qldpc-0.4.0/README.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# qLDPC
|
|
2
|
+
|
|
3
|
+
`qLDPC` is a Python toolkit for constructing and analyzing finite-size [quantum low-density parity-check codes](https://errorcorrectionzoo.org/c/qldpc), as well as stabilizer and subsystem codes more broadly.
|
|
4
|
+
The goal is simple: make the quantum error-correction literature easier to explore, reproduce, and build on.
|
|
5
|
+
Codes can start from parity-check matrices or from higher-level ingredients such as polynomials, group rings, Tanner graphs, and chain complexes.
|
|
6
|
+
Once a code is built, you can inspect its logical operators, compute or bound its distance, plug in a decoder, estimate logical error rates, and—for qubit codes—build [`stim`](https://github.com/quantumlib/Stim) circuits.
|
|
7
|
+
|
|
8
|
+
Most code-level tools work over arbitrary finite fields.
|
|
9
|
+
Circuit tools currently only support qubit codes.
|
|
10
|
+
|
|
11
|
+
## ✨ A taste of qLDPC
|
|
12
|
+
|
|
13
|
+
- **From textbook codes to the research frontier.**
|
|
14
|
+
Build familiar surface, toric, Hamming, and Reed–Muller codes alongside hypergraph-product, lifted-product, bivariate-bicycle, quantum Tanner, SHYPS, GALA, and other modern families.
|
|
15
|
+
- **Go beyond binary.**
|
|
16
|
+
Many constructions and core algorithms work over arbitrary prime-power finite fields, not just qubits.
|
|
17
|
+
- **Ask more of a code than `[[n, k, d]]`.**
|
|
18
|
+
Work with check matrices, Tanner graphs, canonical logical operators, subsystem gauges, exact distances, upper bounds, and code-capacity error estimates.
|
|
19
|
+
- **Move from codes to circuits.**
|
|
20
|
+
Build memory experiments, encoding circuits, Pauli noise models, state-preparation diagnostics, Sinter decoders, sliding-window decoders, and transversal Clifford searches.
|
|
21
|
+
- **Use the algebra that modern constructions need.**
|
|
22
|
+
qLDPC includes finite groups, group rings, lifted matrices, Cayley complexes, chain complexes, and optional GAP integration.
|
|
23
|
+
- **Steal from the examples.**
|
|
24
|
+
The notebooks progress from the basics to circuit-level logical error rates, custom noise, transversal gates, and experimental lattice surgery.
|
|
25
|
+
|
|
26
|
+
qLDPC is still research software, and it is honest about the tradeoffs.
|
|
27
|
+
Some searches are expensive, some bounds are heuristic, experimental APIs can change, and optional tools may have side effects.
|
|
28
|
+
|
|
29
|
+
## 📦 Installation
|
|
30
|
+
|
|
31
|
+
### Standard installation
|
|
32
|
+
|
|
33
|
+
qLDPC requires Python 3.11 or later:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
python -m pip install qldpc
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Optional extras
|
|
40
|
+
|
|
41
|
+
#### Relay-BP decoder
|
|
42
|
+
|
|
43
|
+
Install the optional Relay-BP decoder with:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
python -m pip install 'qldpc[relay-bp]'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### GAP integration
|
|
50
|
+
|
|
51
|
+
Some algebra tools, code lookups, and distance estimates require [GAP](https://www.gap-system.org).
|
|
52
|
+
For the recommended in-process integration, install qLDPC with its maintained libgap extra:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
python -m pip install 'qldpc[gap]'
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
qLDPC uses `passagemath-gap` when it is installed, so supported GAP operations do not launch a separate process.
|
|
59
|
+
If the extra is unavailable, qLDPC still supports a GAP executable on `PATH` (`conda install -c conda-forge gap` is one option) and retains its documented manual copy/paste fallback.
|
|
60
|
+
If a package such as GUAVA or QDistRnd is absent from the in-process binding, qLDPC asks for permission to install it through GAP's PackageManager.
|
|
61
|
+
If that attempt fails and a separate GAP executable is available, qLDPC prints instructions for installing the package for libgap before using the executable instead.
|
|
62
|
+
GAP integration on Windows remains limited; see [issue #294](https://github.com/qLDPCOrg/qLDPC/issues/294).
|
|
63
|
+
|
|
64
|
+
#### `sqetch` distance estimation
|
|
65
|
+
|
|
66
|
+
You can install the optional `sqetch` distance-estimation backend with:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
python -m pip install 'sqetch[gpu] @ git+https://github.com/a7b/yarn.git@e9ce9d0fcecc973988558bfee27fab6d6b8d7f97#subdirectory=sqetch'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This command installs the upstream version of `sqetch` that qLDPC is tested against, with GPU support.
|
|
73
|
+
`sqetch` is not published on PyPI, so it is not available as a qLDPC extra.
|
|
74
|
+
For binary CSS codes, select it with `code.get_distance_bound(backend="sqetch")`.
|
|
75
|
+
|
|
76
|
+
### Troubleshooting
|
|
77
|
+
|
|
78
|
+
On macOS, you may need to install `cvxpy` manually by following its [installation instructions](https://www.cvxpy.org/install) before installing qLDPC.
|
|
79
|
+
If you use Conda to manage your Python environment, install `cvxpy` with:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
conda install -c conda-forge cvxpy
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Development installation
|
|
86
|
+
|
|
87
|
+
For a development installation:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git clone https://github.com/qLDPCOrg/qLDPC.git
|
|
91
|
+
cd qLDPC
|
|
92
|
+
python -m pip install -e '.[dev]'
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## 🚀 Quickstart
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from sympy.abc import x, y
|
|
99
|
+
|
|
100
|
+
from qldpc import codes
|
|
101
|
+
|
|
102
|
+
# The [[144, 12, 12]] bivariate bicycle "gross code".
|
|
103
|
+
code = codes.BBCode({x: 12, y: 6}, x**3 + y + y**2, y**3 + x + x**2)
|
|
104
|
+
|
|
105
|
+
print(code)
|
|
106
|
+
print("physical qubits:", len(code))
|
|
107
|
+
print("logical qubits:", code.dimension)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
That object is ready for more than a parameter check: inspect its parity checks and logical operators, choose a decoder, estimate a logical error rate, or use it in a memory experiment.
|
|
111
|
+
|
|
112
|
+
### Go deeper: a subsystem lifted-product code
|
|
113
|
+
|
|
114
|
+
For a more technical taste, the next example builds a parity-check matrix over the group algebra `GF(2)[C₅]`, lifts each group-ring entry to a 5×5 binary block, and hands the result to `SLPCode`.
|
|
115
|
+
The [subsystem lifted-product construction](https://arxiv.org/abs/2404.18302) produces an 80-qubit CSS subsystem code with 5 logical qubits and 45 gauge qubits.
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from qldpc import abstract, codes
|
|
119
|
+
|
|
120
|
+
group = abstract.CyclicGroup(5)
|
|
121
|
+
ring = abstract.GroupRing(group)
|
|
122
|
+
x = ring.generators[0]
|
|
123
|
+
|
|
124
|
+
repetition = abstract.RingArray.build(
|
|
125
|
+
[[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 1, 1]],
|
|
126
|
+
ring,
|
|
127
|
+
)
|
|
128
|
+
connections = abstract.RingArray.build(
|
|
129
|
+
[[0, x, 0, 0], [0, 0, x, 0], [0, 0, 0, x]],
|
|
130
|
+
ring,
|
|
131
|
+
)
|
|
132
|
+
code = codes.SLPCode(repetition + connections)
|
|
133
|
+
|
|
134
|
+
print("physical qubits:", len(code)) # 80
|
|
135
|
+
print("logical qubits:", code.dimension) # 5
|
|
136
|
+
print("gauge qubits:", code.gauge_dimension) # 45
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Continue with the [library map](https://qldpc.readthedocs.io/library_map.html) for the data model and package structure, or open the [example notebooks](https://qldpc.readthedocs.io/examples/index.html) for complete workflows.
|
|
140
|
+
|
|
141
|
+
## 🧭 Find your way around
|
|
142
|
+
|
|
143
|
+
| Goal | Start here |
|
|
144
|
+
| --- | --- |
|
|
145
|
+
| Understand code representations and how packages fit together | [Library map](https://qldpc.readthedocs.io/library_map.html) |
|
|
146
|
+
| Learn by running complete workflows | [Examples](https://qldpc.readthedocs.io/examples/index.html) |
|
|
147
|
+
| Browse code families, functions, and exact signatures | [API reference](https://qldpc.readthedocs.io/autoapi/index.html) |
|
|
148
|
+
| Construct and analyze a first code | [qLDPC basics](https://qldpc.readthedocs.io/examples/basics.html) |
|
|
149
|
+
| Estimate logical error rates | [Logical-error-rate examples](https://qldpc.readthedocs.io/examples/index.html#logical-error-rates) |
|
|
150
|
+
| Build memory circuits or noise models | [Circuit examples](https://qldpc.readthedocs.io/examples/index.html) |
|
|
151
|
+
| Change or extend qLDPC safely | [Agent and contributor guide](https://github.com/qLDPCOrg/qLDPC/blob/main/AGENTS.md) |
|
|
152
|
+
|
|
153
|
+
For the complete list of classes and functions, including construction-specific literature, use the API reference and source docstrings.
|
|
154
|
+
This README focuses on getting started and finding the right documentation.
|
|
155
|
+
|
|
156
|
+
## ⚠️ Limitations and caveats
|
|
157
|
+
|
|
158
|
+
- Circuit and tableau tools only work with qubit codes, even though other parts of qLDPC support prime-power-dimensional qudits.
|
|
159
|
+
- Circuits returned by `get_encoding_circuit` are not fault-tolerant.
|
|
160
|
+
Fault-tolerant encoding is tracked in [issue #327](https://github.com/qLDPCOrg/qLDPC/issues/327).
|
|
161
|
+
- Exact distance calculations and transversal-gate searches can be exponential.
|
|
162
|
+
When a method returns a bound rather than an exact distance, its docstring explains what kind of bound it is.
|
|
163
|
+
- Features that use GAP may start subprocesses, use local disk caches, access online resources, or ask for manual input or permission to install a package.
|
|
164
|
+
- Everything under `qldpc.experimental` has an unstable public API and may change without deprecation.
|
|
165
|
+
In particular, lattice-surgery support has not yet received independent expert review; validate its results independently and pin the qLDPC version if you depend on it.
|
|
166
|
+
|
|
167
|
+
## 📚 Documentation and support
|
|
168
|
+
|
|
169
|
+
- [Documentation](https://qldpc.readthedocs.io/)
|
|
170
|
+
- [Examples](https://github.com/qLDPCOrg/qLDPC/tree/main/examples)
|
|
171
|
+
- [API reference](https://qldpc.readthedocs.io/autoapi/index.html)
|
|
172
|
+
- [Agent and contributor guide](https://github.com/qLDPCOrg/qLDPC/blob/main/AGENTS.md)
|
|
173
|
+
- [Issue tracker](https://github.com/qLDPCOrg/qLDPC/issues)
|
|
174
|
+
|
|
175
|
+
Questions, feedback, and ideas are welcome through [GitHub issues](https://github.com/qLDPCOrg/qLDPC/issues/new) or by email at [mika.perlin@gmail.com](mailto:mika.perlin@gmail.com).
|
|
176
|
+
|
|
177
|
+
## ⚓ Attribution
|
|
178
|
+
|
|
179
|
+
If you use this software in your work, please cite with:
|
|
180
|
+
|
|
181
|
+
```bibtex
|
|
182
|
+
@misc{perlin2023qldpc,
|
|
183
|
+
author = {Perlin, Michael A.},
|
|
184
|
+
title = {{qLDPC}},
|
|
185
|
+
year = {2023},
|
|
186
|
+
publisher = {GitHub},
|
|
187
|
+
journal = {GitHub repository},
|
|
188
|
+
howpublished = {\url{https://github.com/qLDPCOrg/qLDPC}},
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
This may require adding `\usepackage{url}` to your LaTeX file header.
|
|
193
|
+
Alternatively:
|
|
194
|
+
|
|
195
|
+
```text
|
|
196
|
+
Michael A. Perlin. qLDPC. https://github.com/qLDPCOrg/qLDPC, 2023.
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
qLDPC is distributed under the [Apache License 2.0](https://github.com/qLDPCOrg/qLDPC/blob/main/LICENSE).
|