fuqit 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.
fuqit-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tabby Lickman, Ben Hancock and Diyaco Shwany
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ include tests/reference_simulator.py
fuqit-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,196 @@
1
+ Metadata-Version: 2.4
2
+ Name: fuqit
3
+ Version: 0.1.0
4
+ Summary: An educational quantum circuit simulator, with a GUI, for people who know quantum mechanics.
5
+ Author: Tabby Lickman, Ben Hancock, Diyaco Shwany
6
+ License-Expression: MIT
7
+ Project-URL: Repository, https://github.com/QC2-python-SE/FUQIT
8
+ Project-URL: Issues, https://github.com/QC2-python-SE/FUQIT/issues
9
+ Keywords: quantum computing,quantum circuits,qubits,education,simulator
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Education
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Physics
18
+ Classifier: Topic :: Education
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: numpy
23
+ Requires-Dist: matplotlib
24
+ Requires-Dist: pillow
25
+ Provides-Extra: test
26
+ Requires-Dist: pytest; extra == "test"
27
+ Provides-Extra: docs
28
+ Requires-Dist: mkdocs<2; extra == "docs"
29
+ Requires-Dist: mkdocs-material; extra == "docs"
30
+ Requires-Dist: mkdocstrings[python]; extra == "docs"
31
+ Requires-Dist: mkdocs-jupyter; extra == "docs"
32
+ Dynamic: license-file
33
+
34
+ # FUQIT
35
+
36
+ **FUQIT** is an educational Python package for simulating small quantum circuits.
37
+
38
+ It is written for students who have a working knowledge of non-relativistic quantum mechanics
39
+ up to a Masters' level (bra-ket notation, states, unitary evolution, measurement, tensor products, transformations etc.) but are new to quantum *computing*. FUQIT aims to prepare students for the transition into industry.
40
+ One can build circuits in code or by clicking gates onto a board in a graphical interface, and see the resulting state, measurement probabilities and simulated measurement counts.
41
+
42
+ FUQIT is a teaching tool, not a high-performance simulator: it stores every gate
43
+ as a full matrix, which keeps the linear algebra transparent and is fast enough
44
+ for the small circuits (a handful of qubits) that are useful for learning.
45
+
46
+ ## Features
47
+
48
+ - **States** of any number of qubits: from amplitudes, labels such as `"01"` or `"+-"`,
49
+ Bell states and GHZ states, with reduced density matrices, entanglement checks
50
+ and fidelity.
51
+ - **Gates**: X, Y, Z, H, S, T, rotations Rx/Ry/Rz, CNOT, CZ, SWAP and Toffoli, on any
52
+ qubit(s), plus your own gates from any unitary matrix.
53
+ - **Circuits**: chain gates together, run them, get the overall unitary, invert them,
54
+ and simulate measurements with a chosen number of shots.
55
+ - **Graphical interface**: choose initial states, build circuits by clicking, step
56
+ through them in time, compare exact probabilities with simulated measurements, and
57
+ save, reopen and export circuits.
58
+
59
+ ## Installation
60
+
61
+ FUQIT needs Python 3.10 or newer.
62
+
63
+ ### From PyPI
64
+
65
+ ```bash
66
+ pip install fuqit
67
+ ```
68
+
69
+ ### From the source code (for development)
70
+
71
+ 1. Clone the repository and move into it:
72
+
73
+ ```bash
74
+ git clone https://github.com/QC2-python-SE/FUQIT.git
75
+ cd FUQIT
76
+ ```
77
+
78
+ 2. Install the package (this also installs its dependencies: numpy, matplotlib and pillow):
79
+
80
+ ```bash
81
+ pip install -e .
82
+ ```
83
+
84
+ The `-e` ("editable") flag means Python uses the code in this folder directly,
85
+ so any changes you make take effect without reinstalling.
86
+
87
+ To also install the tools for running the tests, use:
88
+
89
+ ```bash
90
+ pip install -e ".[test]"
91
+ ```
92
+
93
+ 3. Check it worked:
94
+
95
+ ```bash
96
+ python -c "import fuqit; print(fuqit.__version__)"
97
+ ```
98
+
99
+ This should print the version number, e.g. `0.1.0`.
100
+
101
+ The graphical interface uses Tkinter, which comes with Python on Windows and macOS.
102
+ On some Linux distributions it is a separate package (e.g. `sudo apt install python3-tk`).
103
+
104
+ ## Quick start
105
+
106
+ ### In code
107
+
108
+ Build a Bell state with a Hadamard and a CNOT:
109
+
110
+ ```python
111
+ from fuqit import Circuit
112
+
113
+ bell = Circuit(2).h(0).cnot(0, 1)
114
+
115
+ state = bell.run() # starts from |00> by default
116
+ print(state) # 0.707|00⟩ + 0.707|11⟩
117
+ print(state.probabilities()) # 0.5 for '00' and '11', 0 for '01' and '10'
118
+ print(state.is_entangled()) # True
119
+
120
+ counts = bell.measure(shots=1000) # simulate 1000 measurements
121
+ print(counts) # e.g. {'00': 503, '01': 0, '10': 0, '11': 497}
122
+ ```
123
+
124
+ States can also be created directly:
125
+
126
+ ```python
127
+ from fuqit import QubitState
128
+
129
+ QubitState.from_label("+0") # |+>|0>
130
+ QubitState.bell("psi-") # (|01> - |10>)/sqrt(2)
131
+ QubitState([1, 0, 0, 1]) # amplitudes, normalised automatically
132
+ ```
133
+
134
+ ### Graphical interface
135
+
136
+ Launch it with:
137
+
138
+ ```bash
139
+ python -m fuqit.gui
140
+ ```
141
+
142
+ Click a qubit's label (e.g. `|0⟩`) to choose its initial state, pick a gate from the
143
+ sidebar and click a slot on the board to place it; click a placed gate to remove it.
144
+ For a CNOT, click the control qubit first and then the target qubit in the same
145
+ column. For rotation gates, type the angle as a multiple of π in the θ box (e.g. `1/2`
146
+ for π/2). The time axis and slider under the board step through the circuit, the
147
+ Measurement box simulates a chosen number of shots, and circuits can be saved,
148
+ reopened and exported as images. See the documentation's GUI guide for details.
149
+
150
+ ## Conventions
151
+
152
+ - **Qubit ordering:** qubit 0 is the *leftmost* symbol in a ket. So `|10⟩` means
153
+ qubit 0 is in `|1⟩` and qubit 1 is in `|0⟩`, and a gate U acting on qubit 0 of a
154
+ two-qubit register is U ⊗ I. This matches most textbooks (e.g. Nielsen & Chuang),
155
+ but differs from some software such as Qiskit.
156
+ - **Rotation gates:** R_σ(θ) = exp(−iθσ/2) for σ = X, Y, Z, with θ in radians.
157
+ - **States are immutable:** applying a gate returns a new state and never changes
158
+ the original.
159
+
160
+ ## Documentation
161
+
162
+ The full documentation (installation, a quantum-computing primer for physicists,
163
+ a GUI guide, tutorials as Jupyter notebooks, and the API reference) is built with
164
+ MkDocs. To view it locally:
165
+
166
+ ```bash
167
+ pip install -e ".[docs]"
168
+ mkdocs serve
169
+ ```
170
+
171
+ then open the address it prints (usually <http://127.0.0.1:8000>).
172
+
173
+ ## Running the tests
174
+
175
+ After installing with the test extras (see above), run from the repository folder:
176
+
177
+ ```bash
178
+ pytest
179
+ ```
180
+
181
+ The tests also run automatically on GitHub for every pull request.
182
+
183
+ ## Project structure
184
+
185
+ ```
186
+ src/fuqit/
187
+ states.py QubitState: quantum states of n qubits
188
+ gates.py Gate class and the standard gates
189
+ circuit.py Circuit: sequences of gates, running and measuring
190
+ gui/ the graphical circuit builder
191
+ tests/ the test suite
192
+ ```
193
+
194
+ ## Authors
195
+
196
+ Tabby Lickman, Ben Hancock and Diyaco Shwany.
fuqit-0.1.0/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # FUQIT
2
+
3
+ **FUQIT** is an educational Python package for simulating small quantum circuits.
4
+
5
+ It is written for students who have a working knowledge of non-relativistic quantum mechanics
6
+ up to a Masters' level (bra-ket notation, states, unitary evolution, measurement, tensor products, transformations etc.) but are new to quantum *computing*. FUQIT aims to prepare students for the transition into industry.
7
+ One can build circuits in code or by clicking gates onto a board in a graphical interface, and see the resulting state, measurement probabilities and simulated measurement counts.
8
+
9
+ FUQIT is a teaching tool, not a high-performance simulator: it stores every gate
10
+ as a full matrix, which keeps the linear algebra transparent and is fast enough
11
+ for the small circuits (a handful of qubits) that are useful for learning.
12
+
13
+ ## Features
14
+
15
+ - **States** of any number of qubits: from amplitudes, labels such as `"01"` or `"+-"`,
16
+ Bell states and GHZ states, with reduced density matrices, entanglement checks
17
+ and fidelity.
18
+ - **Gates**: X, Y, Z, H, S, T, rotations Rx/Ry/Rz, CNOT, CZ, SWAP and Toffoli, on any
19
+ qubit(s), plus your own gates from any unitary matrix.
20
+ - **Circuits**: chain gates together, run them, get the overall unitary, invert them,
21
+ and simulate measurements with a chosen number of shots.
22
+ - **Graphical interface**: choose initial states, build circuits by clicking, step
23
+ through them in time, compare exact probabilities with simulated measurements, and
24
+ save, reopen and export circuits.
25
+
26
+ ## Installation
27
+
28
+ FUQIT needs Python 3.10 or newer.
29
+
30
+ ### From PyPI
31
+
32
+ ```bash
33
+ pip install fuqit
34
+ ```
35
+
36
+ ### From the source code (for development)
37
+
38
+ 1. Clone the repository and move into it:
39
+
40
+ ```bash
41
+ git clone https://github.com/QC2-python-SE/FUQIT.git
42
+ cd FUQIT
43
+ ```
44
+
45
+ 2. Install the package (this also installs its dependencies: numpy, matplotlib and pillow):
46
+
47
+ ```bash
48
+ pip install -e .
49
+ ```
50
+
51
+ The `-e` ("editable") flag means Python uses the code in this folder directly,
52
+ so any changes you make take effect without reinstalling.
53
+
54
+ To also install the tools for running the tests, use:
55
+
56
+ ```bash
57
+ pip install -e ".[test]"
58
+ ```
59
+
60
+ 3. Check it worked:
61
+
62
+ ```bash
63
+ python -c "import fuqit; print(fuqit.__version__)"
64
+ ```
65
+
66
+ This should print the version number, e.g. `0.1.0`.
67
+
68
+ The graphical interface uses Tkinter, which comes with Python on Windows and macOS.
69
+ On some Linux distributions it is a separate package (e.g. `sudo apt install python3-tk`).
70
+
71
+ ## Quick start
72
+
73
+ ### In code
74
+
75
+ Build a Bell state with a Hadamard and a CNOT:
76
+
77
+ ```python
78
+ from fuqit import Circuit
79
+
80
+ bell = Circuit(2).h(0).cnot(0, 1)
81
+
82
+ state = bell.run() # starts from |00> by default
83
+ print(state) # 0.707|00⟩ + 0.707|11⟩
84
+ print(state.probabilities()) # 0.5 for '00' and '11', 0 for '01' and '10'
85
+ print(state.is_entangled()) # True
86
+
87
+ counts = bell.measure(shots=1000) # simulate 1000 measurements
88
+ print(counts) # e.g. {'00': 503, '01': 0, '10': 0, '11': 497}
89
+ ```
90
+
91
+ States can also be created directly:
92
+
93
+ ```python
94
+ from fuqit import QubitState
95
+
96
+ QubitState.from_label("+0") # |+>|0>
97
+ QubitState.bell("psi-") # (|01> - |10>)/sqrt(2)
98
+ QubitState([1, 0, 0, 1]) # amplitudes, normalised automatically
99
+ ```
100
+
101
+ ### Graphical interface
102
+
103
+ Launch it with:
104
+
105
+ ```bash
106
+ python -m fuqit.gui
107
+ ```
108
+
109
+ Click a qubit's label (e.g. `|0⟩`) to choose its initial state, pick a gate from the
110
+ sidebar and click a slot on the board to place it; click a placed gate to remove it.
111
+ For a CNOT, click the control qubit first and then the target qubit in the same
112
+ column. For rotation gates, type the angle as a multiple of π in the θ box (e.g. `1/2`
113
+ for π/2). The time axis and slider under the board step through the circuit, the
114
+ Measurement box simulates a chosen number of shots, and circuits can be saved,
115
+ reopened and exported as images. See the documentation's GUI guide for details.
116
+
117
+ ## Conventions
118
+
119
+ - **Qubit ordering:** qubit 0 is the *leftmost* symbol in a ket. So `|10⟩` means
120
+ qubit 0 is in `|1⟩` and qubit 1 is in `|0⟩`, and a gate U acting on qubit 0 of a
121
+ two-qubit register is U ⊗ I. This matches most textbooks (e.g. Nielsen & Chuang),
122
+ but differs from some software such as Qiskit.
123
+ - **Rotation gates:** R_σ(θ) = exp(−iθσ/2) for σ = X, Y, Z, with θ in radians.
124
+ - **States are immutable:** applying a gate returns a new state and never changes
125
+ the original.
126
+
127
+ ## Documentation
128
+
129
+ The full documentation (installation, a quantum-computing primer for physicists,
130
+ a GUI guide, tutorials as Jupyter notebooks, and the API reference) is built with
131
+ MkDocs. To view it locally:
132
+
133
+ ```bash
134
+ pip install -e ".[docs]"
135
+ mkdocs serve
136
+ ```
137
+
138
+ then open the address it prints (usually <http://127.0.0.1:8000>).
139
+
140
+ ## Running the tests
141
+
142
+ After installing with the test extras (see above), run from the repository folder:
143
+
144
+ ```bash
145
+ pytest
146
+ ```
147
+
148
+ The tests also run automatically on GitHub for every pull request.
149
+
150
+ ## Project structure
151
+
152
+ ```
153
+ src/fuqit/
154
+ states.py QubitState: quantum states of n qubits
155
+ gates.py Gate class and the standard gates
156
+ circuit.py Circuit: sequences of gates, running and measuring
157
+ gui/ the graphical circuit builder
158
+ tests/ the test suite
159
+ ```
160
+
161
+ ## Authors
162
+
163
+ Tabby Lickman, Ben Hancock and Diyaco Shwany.
@@ -0,0 +1,75 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "fuqit"
7
+ version = "0.1.0"
8
+ description = "An educational quantum circuit simulator, with a GUI, for people who know quantum mechanics."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ { name = "Tabby Lickman" },
15
+ { name = "Ben Hancock" },
16
+ { name = "Diyaco Shwany" },
17
+ ]
18
+ keywords = ["quantum computing", "quantum circuits", "qubits", "education", "simulator"]
19
+ classifiers = [
20
+ "Development Status :: 3 - Alpha",
21
+ "Intended Audience :: Education",
22
+ "Intended Audience :: Science/Research",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Topic :: Scientific/Engineering :: Physics",
28
+ "Topic :: Education",
29
+ ]
30
+ dependencies = [
31
+ "numpy",
32
+ "matplotlib",
33
+ "pillow",
34
+ ]
35
+
36
+ [project.urls]
37
+ Repository = "https://github.com/QC2-python-SE/FUQIT"
38
+ Issues = "https://github.com/QC2-python-SE/FUQIT/issues"
39
+
40
+ [project.optional-dependencies]
41
+ test = [
42
+ "pytest",
43
+ ]
44
+ docs = [
45
+ "mkdocs<2",
46
+ "mkdocs-material",
47
+ "mkdocstrings[python]",
48
+ "mkdocs-jupyter",
49
+ ]
50
+
51
+ [dependency-groups]
52
+ dev = [
53
+ "pytest",
54
+ "ruff",
55
+ "mkdocs<2",
56
+ "mkdocs-material",
57
+ "mkdocstrings[python]",
58
+ "mkdocs-jupyter",
59
+ ]
60
+
61
+ [tool.pytest.ini_options]
62
+ testpaths = ["tests", "src/fuqit"]
63
+ addopts = "--doctest-modules --ignore=src/fuqit/gui"
64
+
65
+ [tool.ruff]
66
+ target-version = "py310"
67
+ extend-exclude = ["docs"]
68
+
69
+ [tool.ruff.lint]
70
+ # pyflakes (F), the core pycodestyle errors (E4/E7/E9), import sorting (I)
71
+ # and pyupgrade (UP). Line length is not enforced.
72
+ select = ["E4", "E7", "E9", "F", "I", "UP"]
73
+
74
+ [tool.ruff.lint.isort]
75
+ known-first-party = ["fuqit", "reference_simulator"]
fuqit-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,9 @@
1
+ """FUQIT: an educational quantum circuit simulator."""
2
+
3
+ from . import gates
4
+ from .circuit import Circuit
5
+ from .states import QubitState
6
+
7
+ __version__ = "0.1.0"
8
+
9
+ __all__ = ["Circuit", "QubitState", "__version__", "gates"]