quickqudits 1.0.1__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.
Files changed (45) hide show
  1. quickqudits-1.0.1/LICENSE +202 -0
  2. quickqudits-1.0.1/NOTICE +7 -0
  3. quickqudits-1.0.1/PKG-INFO +147 -0
  4. quickqudits-1.0.1/README.md +115 -0
  5. quickqudits-1.0.1/pyproject.toml +61 -0
  6. quickqudits-1.0.1/setup.cfg +4 -0
  7. quickqudits-1.0.1/src/quickqudits/__init__.py +146 -0
  8. quickqudits-1.0.1/src/quickqudits/accelerators/__init__.py +22 -0
  9. quickqudits-1.0.1/src/quickqudits/accelerators/numba_fast.py +257 -0
  10. quickqudits-1.0.1/src/quickqudits/backend.py +73 -0
  11. quickqudits-1.0.1/src/quickqudits/circuit.py +2499 -0
  12. quickqudits-1.0.1/src/quickqudits/gate_class.py +388 -0
  13. quickqudits-1.0.1/src/quickqudits/gates.py +788 -0
  14. quickqudits-1.0.1/src/quickqudits/io/__init__.py +18 -0
  15. quickqudits-1.0.1/src/quickqudits/io/circuit_io.py +261 -0
  16. quickqudits-1.0.1/src/quickqudits/io/tableau_io.py +80 -0
  17. quickqudits-1.0.1/src/quickqudits/predefined_gates.py +73 -0
  18. quickqudits-1.0.1/src/quickqudits/tableau.py +3148 -0
  19. quickqudits-1.0.1/src/quickqudits/tableau_composite.py +504 -0
  20. quickqudits-1.0.1/src/quickqudits/utils/__init__.py +94 -0
  21. quickqudits-1.0.1/src/quickqudits/utils/circuit_utils.py +110 -0
  22. quickqudits-1.0.1/src/quickqudits/utils/density.py +158 -0
  23. quickqudits-1.0.1/src/quickqudits/utils/entanglement.py +211 -0
  24. quickqudits-1.0.1/src/quickqudits/utils/fidelity.py +212 -0
  25. quickqudits-1.0.1/src/quickqudits/utils/random_circuits.py +322 -0
  26. quickqudits-1.0.1/src/quickqudits/utils/statevector.py +543 -0
  27. quickqudits-1.0.1/src/quickqudits/utils/tableau_utils.py +149 -0
  28. quickqudits-1.0.1/src/quickqudits/visualization.py +583 -0
  29. quickqudits-1.0.1/src/quickqudits.egg-info/PKG-INFO +147 -0
  30. quickqudits-1.0.1/src/quickqudits.egg-info/SOURCES.txt +43 -0
  31. quickqudits-1.0.1/src/quickqudits.egg-info/dependency_links.txt +1 -0
  32. quickqudits-1.0.1/src/quickqudits.egg-info/requires.txt +21 -0
  33. quickqudits-1.0.1/src/quickqudits.egg-info/top_level.txt +1 -0
  34. quickqudits-1.0.1/tests/test_circuit_inverse.py +31 -0
  35. quickqudits-1.0.1/tests/test_circuit_io.py +210 -0
  36. quickqudits-1.0.1/tests/test_density_matrix_vs_statevector.py +68 -0
  37. quickqudits-1.0.1/tests/test_fidelity_tableau_vs_dm.py +133 -0
  38. quickqudits-1.0.1/tests/test_noise_dm_vs_statevector_mc.py +115 -0
  39. quickqudits-1.0.1/tests/test_noise_tableau_pf_vs_dm.py +148 -0
  40. quickqudits-1.0.1/tests/test_statevector_vs_qiskit.py +93 -0
  41. quickqudits-1.0.1/tests/test_statevector_vs_qutip.py +125 -0
  42. quickqudits-1.0.1/tests/test_tableau_gates_general.py +133 -0
  43. quickqudits-1.0.1/tests/test_tableau_io.py +20 -0
  44. quickqudits-1.0.1/tests/test_tableau_post_measure.py +109 -0
  45. quickqudits-1.0.1/tests/test_tableau_vs_statevector.py +114 -0
@@ -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.
@@ -0,0 +1,7 @@
1
+ QuickQudits
2
+ Copyright 2026 Mykyta Cherniak and Nina Brandl
3
+
4
+ Developed at the Department for Quantum Computing (QUICK),
5
+ Johannes Kepler University Linz, Austria.
6
+
7
+ Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,147 @@
1
+ Metadata-Version: 2.4
2
+ Name: quickqudits
3
+ Version: 1.0.1
4
+ Summary: Simulation of noisy qudit Clifford circuits via extended stabilizer tableau formalism.
5
+ Author-email: Mykyta Cherniak <mykyta.cherniak@jku.at>, Nina Brandl <nina.brandl@jku.at>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://quick-jku.github.io/QuickQudits/
8
+ Project-URL: Repository, https://github.com/QUICK-JKU/QuickQudits
9
+ Project-URL: Documentation, https://quick-jku.github.io/QuickQudits/
10
+ Keywords: quantum,quantum computing,qudits,stabilizer formalism,Clifford circuits,noisy simulation,tableau,noise
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ License-File: NOTICE
18
+ Requires-Dist: numpy>=1.26.4; python_version < "3.13"
19
+ Requires-Dist: numpy>=2.1.0; python_version >= "3.13"
20
+ Requires-Dist: sympy>=1.14.0
21
+ Provides-Extra: numba
22
+ Requires-Dist: numba>=0.61.0; extra == "numba"
23
+ Provides-Extra: plot
24
+ Requires-Dist: matplotlib>=3.8; extra == "plot"
25
+ Provides-Extra: test
26
+ Requires-Dist: pytest>=8; extra == "test"
27
+ Requires-Dist: qutip>=5; extra == "test"
28
+ Requires-Dist: qiskit>=1.0; extra == "test"
29
+ Provides-Extra: docs
30
+ Requires-Dist: pdoc>=14; extra == "docs"
31
+ Dynamic: license-file
32
+
33
+ # quickqudits
34
+
35
+ **QuickQudits** is a Python framework for efficient classical simulation of noisy qudit Clifford circuits using stabilizer tableau formalism, with Monte Carlo sampling of Pauli/Weyl noise.
36
+
37
+ All dimensions are supported, with prime dimensions favoured.
38
+
39
+ Core Functionality:
40
+ - **Extended stabilizer tableaus** for qudits of arbitrary dimension `d`, storing X/Z exponents and a phase column, with Clifford updates over `Z_d`.
41
+ - **Measurement / post-measurement updates** via a generalized Aaronson–Gottesman (CHP-style) procedure for **prime** dimensions.
42
+ - **Measurement** for **composite** dimensions via SNF.
43
+ - **Noise modeling** as probabilistic mixtures of Weyl operators.
44
+ - **Statevector / density-matrix backends** and circuit visualization utilities.
45
+
46
+ ## Installation
47
+
48
+ - Base:
49
+ ```bash
50
+ pip install quickqudits
51
+ ```
52
+
53
+ - With JIT speedups:
54
+ ```bash
55
+ pip install "quickqudits[numba]"
56
+ ```
57
+
58
+ - With plotting:
59
+ ```bash
60
+ pip install "quickqudits[plot]"
61
+ ```
62
+
63
+ - For dev/tests:
64
+ ```bash
65
+ pip install "quickqudits[test]"
66
+ ```
67
+
68
+ - Everything:
69
+ ```bash
70
+ pip install "quickqudits[numba,plot,test]"
71
+ ```
72
+
73
+ ## Quick start
74
+
75
+ ```python
76
+ import quickqudits as qq
77
+
78
+ # initialize circuit
79
+ n, d = 5, 3 # 5 qudits of dimension 3
80
+ qc = qq.QuantumCircuit(n, d, name="example")
81
+
82
+ # add gates
83
+ qc.CXdag(2, 0)
84
+ qc.CX(1, 0)
85
+ qc.H(0)
86
+ qc.H(1)
87
+ qc.CXdag(0, 2)
88
+ qc.CX(0, 4)
89
+ qc.X(2)
90
+ qc.S(4)
91
+ qc.Hdag(4)
92
+ qc.CXdag(2, 0)
93
+ qc.Sdag(3)
94
+ qc.CX(2, 0)
95
+ qc.CZdag(4, 0)
96
+
97
+ # add global depolarizing noise
98
+ qc.add_noise_global(0.5)
99
+
100
+ # visualize circuit
101
+ qc.draw(show_info=True)
102
+ ```
103
+
104
+ ### Generated circuit
105
+
106
+ The circuit produced by `qc.draw(show_info=True)`:
107
+
108
+ ![Example circuit](images/example_circuit.png)
109
+
110
+ ```python
111
+ # initialize tableau
112
+ tab = qq.Tableau(5, 3)
113
+
114
+ # draw samples from the noisy circuit
115
+ samples = tab.sample_measurements_noisy_pf(qc=qc, shots=5, seed=42)
116
+ print(samples, end="\n\n")
117
+
118
+ # execute the circuit and obtain tableau (ignoring noise channels)
119
+ tab.apply_circuit(qc)
120
+
121
+ # visualize tableau
122
+ print(tab)
123
+ ```
124
+
125
+ ### Output
126
+
127
+ ```plaintext
128
+ [[2 0 0 0 1]
129
+ [0 2 2 0 1]
130
+ [2 2 1 1 1]
131
+ [0 1 0 0 2]
132
+ [0 1 1 0 0]]
133
+
134
+ # | x0 x1 x2 x3 x4 | z0 z1 z2 z3 z4 | τ
135
+ ────────────────────────────────────────
136
+ d0 | 0 0 0 0 0 | 1 0 0 0 0 | 0
137
+ d1 | 0 0 0 0 0 | 1 1 0 0 0 | 0
138
+ d2 | 0 0 1 0 0 | 2 0 0 0 0 | 0
139
+ d3 | 0 0 0 1 0 | 0 0 0 2 0 | 0
140
+ d4 | 0 0 0 0 1 | 2 0 0 0 2 | 4
141
+ ----------------------------------------
142
+ s0 | 2 1 1 0 2 | 2 0 1 0 2 | 2
143
+ s1 | 0 2 0 0 0 | 0 0 0 0 0 | 0
144
+ s2 | 0 0 0 0 0 | 1 0 1 0 0 | 4
145
+ s3 | 0 0 0 0 0 | 0 0 0 1 0 | 0
146
+ s4 | 0 0 0 0 1 | 1 0 0 0 0 | 0
147
+ ```
@@ -0,0 +1,115 @@
1
+ # quickqudits
2
+
3
+ **QuickQudits** is a Python framework for efficient classical simulation of noisy qudit Clifford circuits using stabilizer tableau formalism, with Monte Carlo sampling of Pauli/Weyl noise.
4
+
5
+ All dimensions are supported, with prime dimensions favoured.
6
+
7
+ Core Functionality:
8
+ - **Extended stabilizer tableaus** for qudits of arbitrary dimension `d`, storing X/Z exponents and a phase column, with Clifford updates over `Z_d`.
9
+ - **Measurement / post-measurement updates** via a generalized Aaronson–Gottesman (CHP-style) procedure for **prime** dimensions.
10
+ - **Measurement** for **composite** dimensions via SNF.
11
+ - **Noise modeling** as probabilistic mixtures of Weyl operators.
12
+ - **Statevector / density-matrix backends** and circuit visualization utilities.
13
+
14
+ ## Installation
15
+
16
+ - Base:
17
+ ```bash
18
+ pip install quickqudits
19
+ ```
20
+
21
+ - With JIT speedups:
22
+ ```bash
23
+ pip install "quickqudits[numba]"
24
+ ```
25
+
26
+ - With plotting:
27
+ ```bash
28
+ pip install "quickqudits[plot]"
29
+ ```
30
+
31
+ - For dev/tests:
32
+ ```bash
33
+ pip install "quickqudits[test]"
34
+ ```
35
+
36
+ - Everything:
37
+ ```bash
38
+ pip install "quickqudits[numba,plot,test]"
39
+ ```
40
+
41
+ ## Quick start
42
+
43
+ ```python
44
+ import quickqudits as qq
45
+
46
+ # initialize circuit
47
+ n, d = 5, 3 # 5 qudits of dimension 3
48
+ qc = qq.QuantumCircuit(n, d, name="example")
49
+
50
+ # add gates
51
+ qc.CXdag(2, 0)
52
+ qc.CX(1, 0)
53
+ qc.H(0)
54
+ qc.H(1)
55
+ qc.CXdag(0, 2)
56
+ qc.CX(0, 4)
57
+ qc.X(2)
58
+ qc.S(4)
59
+ qc.Hdag(4)
60
+ qc.CXdag(2, 0)
61
+ qc.Sdag(3)
62
+ qc.CX(2, 0)
63
+ qc.CZdag(4, 0)
64
+
65
+ # add global depolarizing noise
66
+ qc.add_noise_global(0.5)
67
+
68
+ # visualize circuit
69
+ qc.draw(show_info=True)
70
+ ```
71
+
72
+ ### Generated circuit
73
+
74
+ The circuit produced by `qc.draw(show_info=True)`:
75
+
76
+ ![Example circuit](images/example_circuit.png)
77
+
78
+ ```python
79
+ # initialize tableau
80
+ tab = qq.Tableau(5, 3)
81
+
82
+ # draw samples from the noisy circuit
83
+ samples = tab.sample_measurements_noisy_pf(qc=qc, shots=5, seed=42)
84
+ print(samples, end="\n\n")
85
+
86
+ # execute the circuit and obtain tableau (ignoring noise channels)
87
+ tab.apply_circuit(qc)
88
+
89
+ # visualize tableau
90
+ print(tab)
91
+ ```
92
+
93
+ ### Output
94
+
95
+ ```plaintext
96
+ [[2 0 0 0 1]
97
+ [0 2 2 0 1]
98
+ [2 2 1 1 1]
99
+ [0 1 0 0 2]
100
+ [0 1 1 0 0]]
101
+
102
+ # | x0 x1 x2 x3 x4 | z0 z1 z2 z3 z4 | τ
103
+ ────────────────────────────────────────
104
+ d0 | 0 0 0 0 0 | 1 0 0 0 0 | 0
105
+ d1 | 0 0 0 0 0 | 1 1 0 0 0 | 0
106
+ d2 | 0 0 1 0 0 | 2 0 0 0 0 | 0
107
+ d3 | 0 0 0 1 0 | 0 0 0 2 0 | 0
108
+ d4 | 0 0 0 0 1 | 2 0 0 0 2 | 4
109
+ ----------------------------------------
110
+ s0 | 2 1 1 0 2 | 2 0 1 0 2 | 2
111
+ s1 | 0 2 0 0 0 | 0 0 0 0 0 | 0
112
+ s2 | 0 0 0 0 0 | 1 0 1 0 0 | 4
113
+ s3 | 0 0 0 0 0 | 0 0 0 1 0 | 0
114
+ s4 | 0 0 0 0 1 | 1 0 0 0 0 | 0
115
+ ```
@@ -0,0 +1,61 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "quickqudits"
7
+ version = "1.0.1"
8
+ description = "Simulation of noisy qudit Clifford circuits via extended stabilizer tableau formalism."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "Apache-2.0" }
12
+
13
+ authors = [
14
+ { name = "Mykyta Cherniak", email = "mykyta.cherniak@jku.at" },
15
+ { name = "Nina Brandl", email = "nina.brandl@jku.at" }
16
+ ]
17
+
18
+ keywords = ["quantum", "quantum computing", "qudits", "stabilizer formalism", "Clifford circuits", "noisy simulation", "tableau", "noise"]
19
+
20
+ classifiers = [
21
+ "License :: OSI Approved :: Apache Software License",
22
+ "Programming Language :: Python :: 3",
23
+ "Operating System :: OS Independent",
24
+ ]
25
+
26
+ dependencies = [
27
+ "numpy>=1.26.4; python_version < '3.13'",
28
+ "numpy>=2.1.0; python_version >= '3.13'",
29
+ "sympy>=1.14.0",
30
+ ]
31
+
32
+ [project.optional-dependencies]
33
+ numba = [
34
+ "numba>=0.61.0",
35
+ ]
36
+
37
+ plot = [
38
+ "matplotlib>=3.8",
39
+ ]
40
+
41
+ test = [
42
+ "pytest>=8",
43
+ "qutip>=5",
44
+ "qiskit>=1.0",
45
+ ]
46
+
47
+ docs = [
48
+ "pdoc>=14",
49
+ ]
50
+
51
+ [project.urls]
52
+ Homepage = "https://quick-jku.github.io/QuickQudits/"
53
+ Repository = "https://github.com/QUICK-JKU/QuickQudits"
54
+ Documentation = "https://quick-jku.github.io/QuickQudits/"
55
+
56
+ [tool.setuptools]
57
+ package-dir = { "" = "src" }
58
+ license-files = ["LICENSE", "NOTICE"]
59
+
60
+ [tool.setuptools.packages.find]
61
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,146 @@
1
+ """
2
+ `quickqudits` is a library for the efficient classical simulation of Clifford circuits acting on d-dimensional qudits,
3
+ including Pauli/Weyl noise.
4
+
5
+ All dimensions are supported, with prime dimensions favoured.
6
+
7
+ Core features:
8
+
9
+ - Qudit stabilizer tableau simulator (`Tableau`) for `n` qudits of dimension `d`
10
+ - Tableau phases tracked as powers of `τ mod 2d` (with `τ² = ω`)
11
+ - A circuit container (`QuantumCircuit`) with Clifford/Weyl gates (allows statevector and density matrix simulation)
12
+ - Noise channels (e.g., depolarizing-style Weyl noise) and fast Monte-Carlo sampling utilities
13
+ - Optional Numba acceleration for fast tableau updates
14
+ - High-level tools and helpers for tableaus/statevectors/density matrices, fidelity estimation, random circuits, etc.
15
+
16
+ ---
17
+
18
+ ## Example
19
+
20
+ ```python
21
+ import quickqudits as qq
22
+
23
+ # initialize circuit
24
+ n, d = 5, 3 # 5 qudits of dimension 3
25
+ qc = qq.QuantumCircuit(n, d)
26
+
27
+ # add gates
28
+ qc.CXdag(2, 0)
29
+ qc.CX(1, 0)
30
+ qc.H(0)
31
+ qc.H(1)
32
+ qc.CXdag(0, 2)
33
+ qc.CX(0, 4)
34
+ qc.X(2)
35
+ qc.S(4)
36
+ qc.Hdag(4)
37
+ qc.CXdag(2, 0)
38
+ qc.Sdag(3)
39
+ qc.CX(2, 0)
40
+ qc.CZdag(4, 0)
41
+
42
+ # add global depolarizing noise
43
+ qc.add_noise_global(0.5)
44
+
45
+ # visualize circuit
46
+ qc.draw(show_info=True)
47
+
48
+ # initialize tableau
49
+ tab = qq.Tableau(5, 3)
50
+
51
+ # draw samples from the noisy circuit
52
+ samples = tab.sample_measurements_noisy_pf(qc=qc, shots=5, seed=42)
53
+ print(samples, end='\\n\\n')
54
+
55
+ # execute the circuit and obtain tableau (ignoring noise channels)
56
+ tab.apply_circuit(qc)
57
+
58
+ # visualize tableau
59
+ print(tab)
60
+ ```
61
+
62
+ Output:
63
+ ```plaintext
64
+ [[2 0 0 0 1]
65
+ [0 2 2 0 1]
66
+ [2 2 1 1 1]
67
+ [0 1 0 0 2]
68
+ [0 1 1 0 0]]
69
+
70
+ # | x0 x1 x2 x3 x4 | z0 z1 z2 z3 z4 | τ
71
+ ────────────────────────────────────────
72
+ d0 | 0 0 0 0 0 | 1 0 0 0 0 | 0
73
+ d1 | 0 0 0 0 0 | 1 1 0 0 0 | 0
74
+ d2 | 0 0 1 0 0 | 2 0 0 0 0 | 0
75
+ d3 | 0 0 0 1 0 | 0 0 0 2 0 | 0
76
+ d4 | 0 0 0 0 1 | 2 0 0 0 2 | 4
77
+ ----------------------------------------
78
+ s0 | 2 1 1 0 2 | 2 0 1 0 2 | 2
79
+ s1 | 0 2 0 0 0 | 0 0 0 0 0 | 0
80
+ s2 | 0 0 0 0 0 | 1 0 1 0 0 | 4
81
+ s3 | 0 0 0 0 0 | 0 0 0 1 0 | 0
82
+ s4 | 0 0 0 0 1 | 1 0 0 0 0 | 0
83
+ ```
84
+
85
+ ## Modules
86
+
87
+ - `circuit` — `QuantumCircuit`: build circuits, run statevector/density simulations, sampling helpers
88
+ - `tableau` — `Tableau`: stabilizer tableau evolution, measurement, conversions, noisy sampling
89
+ - `tableau_composite` — `CompositeTableau`: composite d
90
+ - `io.tableau_io` — save/load tableaus via compressed NumPy `.npz`
91
+ - `io.circuit_io` — save/load circuits via compressed NumPy `.npz`
92
+ - `accelerators.numba_fast` — Numba JIT kernels for fast tableau updates (optional)
93
+ - `backend` — global dtype/precision configuration (`set_precision`)
94
+ - `gate_class` — `Gate` and `NoiseChannel` definitions
95
+ - `gates` — numerical matrix builders for standard qudit gates
96
+ - `predefined_gates` — pre-instantiated gate objects (e.g. `H_gate`, `CNOT_gate`, …)
97
+ - `visualization` — Matplotlib circuit drawing backend
98
+ - `utils` — utilities (see below)
99
+
100
+ `utils` submodules:
101
+
102
+ - `utils.circuit_utils` — small circuit constructors (e.g. universal input-state prep)
103
+ - `utils.random_circuits` — random circuit generator (`random_circuit`)
104
+ - `utils.statevector` — statevector helpers (projection, sampling, comparisons, etc.)
105
+ - `utils.density` — density-matrix helpers (validity checks, purity, probvectors)
106
+ - `utils.fidelity` — Monte-Carlo fidelity estimators for noisy circuits
107
+ - `utils.entanglement` — Schmidt-rank utilities for stabilizer states
108
+ - `utils.tableau_utils` — Numba warmup + tableau symplectic checks
109
+
110
+ ---
111
+
112
+ ## Main classes and utilities
113
+
114
+ Classes:
115
+
116
+ - `QuantumCircuit` — build / store circuits; provides simulation + sampling routines
117
+ - `Tableau` — stabilizer tableau representation for qudit Clifford simulation
118
+ - `CompositeTableau` — stabilizer tableau for composite d
119
+ - `Gate` — gate metadata + matrix generation logic
120
+ - `NoiseChannel` — gate subclass representing noise models
121
+
122
+ Selected utilities:
123
+
124
+ - `utils.random_circuit`
125
+ - `utils.fidelity_pf`
126
+ - `utils.fidelity_np`
127
+ - `utils.check_symplectic_structure`
128
+ - `utils.get_projected_state`, `utils.compare_statevectors`, `utils.apply_unitary`, `utils.measureall`
129
+ - `utils.get_zero_density_matrix`, `utils.is_valid_density_matrix`, `utils.purity`
130
+ - ...
131
+
132
+ See utils documentation for the rest.
133
+ """
134
+
135
+ from importlib.metadata import PackageNotFoundError, version
136
+
137
+ try:
138
+ __version__ = version("quickqudits")
139
+ except PackageNotFoundError:
140
+ __version__ = "0.0.0"
141
+
142
+ from . import backend, io, utils
143
+ from .circuit import QuantumCircuit
144
+ from .predefined_gates import *
145
+ from .tableau import Tableau
146
+ from .tableau_composite import CompositeTableau