qitker 1.0.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.
- qitker-1.0.0/LICENSE +21 -0
- qitker-1.0.0/PKG-INFO +169 -0
- qitker-1.0.0/README.md +154 -0
- qitker-1.0.0/pyproject.toml +28 -0
- qitker-1.0.0/qitker/ExportCode/exportCode.py +135 -0
- qitker-1.0.0/qitker/QuantumMath/HilbertSpace.py +816 -0
- qitker-1.0.0/qitker/QuantumMath/constant.py +133 -0
- qitker-1.0.0/qitker/__init__.py +12 -0
- qitker-1.0.0/qitker/anyons/Anyon.py +133 -0
- qitker-1.0.0/qitker/anyons/AnyonOperation.py +51 -0
- qitker-1.0.0/qitker/anyons/AnyonicQubit.py +79 -0
- qitker-1.0.0/qitker/anyons/FusionBasis.py +707 -0
- qitker-1.0.0/qitker/anyons/FusionCache.py +251 -0
- qitker-1.0.0/qitker/anyons/FusionSystem.py +1604 -0
- qitker-1.0.0/qitker/anyons/FusionTree.py +449 -0
- qitker-1.0.0/qitker/compiler/circuit.py +499 -0
- qitker-1.0.0/qitker/compiler/operations/opClasses.py +139 -0
- qitker-1.0.0/qitker/compiler/operations/operation.py +478 -0
- qitker-1.0.0/qitker/compiler/qRegister.py +638 -0
- qitker-1.0.0/qitker/compiler/qubit.py +762 -0
- qitker-1.0.0/qitker/compiler/reporter/reporterObject.py +196 -0
- qitker-1.0.0/qitker/compiler/validation.py +191 -0
- qitker-1.0.0/qitker/parser/braid_sequences.json +486 -0
- qitker-1.0.0/qitker/parser/execution.py +244 -0
- qitker-1.0.0/qitker/parser/routing.py +312 -0
- qitker-1.0.0/qitker/parser/sequenceOperation.py +42 -0
- qitker-1.0.0/qitker.egg-info/PKG-INFO +169 -0
- qitker-1.0.0/qitker.egg-info/SOURCES.txt +30 -0
- qitker-1.0.0/qitker.egg-info/dependency_links.txt +1 -0
- qitker-1.0.0/qitker.egg-info/requires.txt +4 -0
- qitker-1.0.0/qitker.egg-info/top_level.txt +1 -0
- qitker-1.0.0/setup.cfg +4 -0
qitker-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 nitayB14
|
|
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.
|
qitker-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qitker
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Qitker bridges intuitive, high-level quantum programming with topological quantum computation, translating readable quantum logic into Fibonacci-anyon braiding.
|
|
5
|
+
Author: Nitay Bahliker
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/nitayB14/Qitker
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: numpy<3,>=2.4
|
|
12
|
+
Provides-Extra: qiskit
|
|
13
|
+
Requires-Dist: qiskit<3,>=2.3.1; extra == "qiskit"
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# Qitker
|
|
17
|
+
|
|
18
|
+
Qitker explores quantum computation with Fibonacci anyons. It connects a simple circuit interface `circuit`, `qubit`, and `qRegister` to a backend that represents states in fusion spaces and performs braiding through F- and R-moves. Circuits can also be exported to Qiskit.
|
|
19
|
+
|
|
20
|
+
For the complete circuit-building API, see the [API reference (D5)](https://github.com/nitayB14/Qitker/blob/main/Documentation/English/D5_API_Reference.md).
|
|
21
|
+
|
|
22
|
+
## Current status
|
|
23
|
+
|
|
24
|
+
- The version 1 frontend and Qiskit export are implemented and tested.
|
|
25
|
+
- The anyonic backend models computational and leakage states and supports physical cross-qubit braiding.
|
|
26
|
+
- Normal backend execution includes stored braid sequences for CX, CY, CZ, CS, CT, CCX, CCY, CCZ, CCS, and CCT.
|
|
27
|
+
- The circuit API and Qiskit export impose no fixed limit on the number of controls per gate. Version 1 anyonic execution supports up to two controls per gate; this does not limit the total number of qubits in a circuit.
|
|
28
|
+
- The physical backend represents Fibonacci anyons in a fusion-tree basis and tracks both computational and leakage states.
|
|
29
|
+
- It applies physical braids through F and R moves, including braids across qubit boundaries, and reports fidelity and leakage relative to the ideal logical result.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Qitker requires Python 3.11 or newer. Run the installation commands with the same Python interpreter that you use to run your programs. Installation is needed once per Python environment.
|
|
34
|
+
|
|
35
|
+
### Install from PyPI
|
|
36
|
+
|
|
37
|
+
Install Qitker version `1.0.0` and its NumPy dependency from PyPI:
|
|
38
|
+
|
|
39
|
+
```powershell
|
|
40
|
+
python -m pip install "qitker==1.0.0"
|
|
41
|
+
python -m pip check
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For Qiskit export support, install the optional dependency:
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
python -m pip install "qitker[qiskit]==1.0.0"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Install from source
|
|
51
|
+
|
|
52
|
+
From a checkout of this repository, install Qitker and its NumPy dependency with:
|
|
53
|
+
|
|
54
|
+
```powershell
|
|
55
|
+
python -m pip install .
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
For Qiskit export support, use this command instead:
|
|
59
|
+
|
|
60
|
+
```powershell
|
|
61
|
+
python -m pip install ".[qiskit]"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Install dependencies for examples and plots
|
|
65
|
+
|
|
66
|
+
After installing Qitker by either method above, run the following from the repository root:
|
|
67
|
+
|
|
68
|
+
```powershell
|
|
69
|
+
python -m pip install -r requirements.txt
|
|
70
|
+
python -m pip check
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`requirements.txt` installs Qiskit with its visualization dependencies, Qiskit Aer for simulation, SciPy for optimization, and Matplotlib for plots. The `qiskit[visualization]` extra also installs `pylatexenc`, which is required by `draw("mpl")`. In Python, `plt` is an alias for `matplotlib.pyplot`, not a separate package.
|
|
74
|
+
|
|
75
|
+
The `qitker[qiskit]` extra provides circuit export; use `requirements.txt` for the simulation and plotting examples below. This requirements file installs dependencies only. Qitker itself must be installed separately using one of the commands above.
|
|
76
|
+
|
|
77
|
+
The example scripts and `requirements.txt` are available in this repository and are not included in the installed Qitker wheel. Download them or clone the repository to run the examples. For testing the published release on another computer, use the PyPI installation commands above rather than installing from source.
|
|
78
|
+
|
|
79
|
+
## Quick start: anyonic execution
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from qitker import circuit, qubit
|
|
83
|
+
|
|
84
|
+
party = circuit()
|
|
85
|
+
aliza = qubit(party)
|
|
86
|
+
baruch = qubit(party)
|
|
87
|
+
|
|
88
|
+
aliza.mix()
|
|
89
|
+
baruch.flipIf(aliza)
|
|
90
|
+
|
|
91
|
+
result = party.measure(shots=1024)
|
|
92
|
+
print(result)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`measure()` executes the circuit through Qitker's anyonic backend and returns a report containing measurements, fidelity, and leakage.
|
|
96
|
+
|
|
97
|
+
## Export to Qiskit
|
|
98
|
+
|
|
99
|
+
With the Qiskit dependency installed, export a circuit as a Qiskit `QuantumCircuit`:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from qitker import circuit, qubit
|
|
103
|
+
|
|
104
|
+
sample = circuit()
|
|
105
|
+
qubit(sample).mix()
|
|
106
|
+
|
|
107
|
+
qiskit_circuit = sample.exportCircuit("qiskit")
|
|
108
|
+
print(qiskit_circuit)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Qiskit export also preserves rotation angles and controlled rotations, which are not supported by the current anyonic execution path.
|
|
112
|
+
|
|
113
|
+
Export converts the circuit's gates; it does not run the anyonic backend or add Qiskit measurement instructions. Add those instructions explicitly before sampling with Qiskit Aer.
|
|
114
|
+
|
|
115
|
+
## Simulate and plot with Qiskit Aer
|
|
116
|
+
|
|
117
|
+
Install `requirements.txt` before running this example. It exports a Bell circuit, draws it with Matplotlib, samples it in Aer, and displays a histogram:
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
from qitker import circuit, qubit
|
|
121
|
+
from qiskit import transpile
|
|
122
|
+
from qiskit_aer import Aer
|
|
123
|
+
from qiskit.visualization import plot_histogram
|
|
124
|
+
import matplotlib.pyplot as plt
|
|
125
|
+
|
|
126
|
+
party = circuit()
|
|
127
|
+
aliza = qubit(party)
|
|
128
|
+
baruch = qubit(party)
|
|
129
|
+
aliza.mix()
|
|
130
|
+
baruch.flipIf(aliza)
|
|
131
|
+
|
|
132
|
+
qc = party.exportCircuit("qiskit")
|
|
133
|
+
qc.measure(*party.getMeasuredLists())
|
|
134
|
+
qc.draw("mpl")
|
|
135
|
+
|
|
136
|
+
simulator = Aer.get_backend("qasm_simulator")
|
|
137
|
+
compiled = transpile(qc, simulator)
|
|
138
|
+
counts = simulator.run(compiled, shots=1024).result().get_counts()
|
|
139
|
+
|
|
140
|
+
# Display the first Qitker qubit on the left of each bitstring.
|
|
141
|
+
qitker_counts = {bits[::-1]: count for bits, count in counts.items()}
|
|
142
|
+
print(qitker_counts)
|
|
143
|
+
plot_histogram(qitker_counts)
|
|
144
|
+
plt.show()
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Aer simulates the exported logical gates. Its results do not include Qitker's physical braiding fidelity or leakage. Use `party.measure()` for those quantities. `plt.show()` displays figures in a desktop environment with a graphical Matplotlib backend.
|
|
148
|
+
|
|
149
|
+
## Examples and tests
|
|
150
|
+
|
|
151
|
+
Start with the [project overview (D0)](https://github.com/nitayB14/Qitker/blob/main/Documentation/English/D0_Project_Overview.md) for the motivation, execution paths, and current limitations. The guides below explain each example.
|
|
152
|
+
|
|
153
|
+
After installing the example dependencies, run an example from the repository root:
|
|
154
|
+
|
|
155
|
+
```powershell
|
|
156
|
+
python -B Examples/EX3_advanced_grover.py
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
| Example | Guide | Execution and output |
|
|
160
|
+
| --- | --- | --- |
|
|
161
|
+
| [Bell and GHZ states](https://github.com/nitayB14/Qitker/blob/main/Examples/EX1_Bell_State.py) | [D1](https://github.com/nitayB14/Qitker/blob/main/Documentation/English/D1_Bell_and_GHZ_States.md) | Qitker anyonic execution, text circuit drawings, and measurement reports |
|
|
162
|
+
| [Simple Grover search](https://github.com/nitayB14/Qitker/blob/main/Examples/EX2_simple_grover.py) | [D2](https://github.com/nitayB14/Qitker/blob/main/Documentation/English/D2_Simple_Grover.md) | Qitker anyonic execution and text output |
|
|
163
|
+
| [Advanced Grover search](https://github.com/nitayB14/Qitker/blob/main/Examples/EX3_advanced_grover.py) | [D3](https://github.com/nitayB14/Qitker/blob/main/Documentation/English/D3_advanced_grover.md) | Qiskit Aer simulation, circuit drawing, and a Matplotlib histogram |
|
|
164
|
+
| [Sudoku with QAOA](https://github.com/nitayB14/Qitker/blob/main/Examples/EX4_sudoku3x3.py) | [D4](https://github.com/nitayB14/Qitker/blob/main/Documentation/English/D4_sudoku3x3.md) | Qiskit Aer simulation and SciPy optimization |
|
|
165
|
+
|
|
166
|
+
- [Frontend tests](https://github.com/nitayB14/Qitker/blob/main/version_testing/Frontend/README.md)
|
|
167
|
+
- [Backend tests](https://github.com/nitayB14/Qitker/blob/main/version_testing/Backend/README.md)
|
|
168
|
+
|
|
169
|
+
Licensed under the [MIT License](https://github.com/nitayB14/Qitker/blob/main/LICENSE).
|
qitker-1.0.0/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Qitker
|
|
2
|
+
|
|
3
|
+
Qitker explores quantum computation with Fibonacci anyons. It connects a simple circuit interface `circuit`, `qubit`, and `qRegister` to a backend that represents states in fusion spaces and performs braiding through F- and R-moves. Circuits can also be exported to Qiskit.
|
|
4
|
+
|
|
5
|
+
For the complete circuit-building API, see the [API reference (D5)](https://github.com/nitayB14/Qitker/blob/main/Documentation/English/D5_API_Reference.md).
|
|
6
|
+
|
|
7
|
+
## Current status
|
|
8
|
+
|
|
9
|
+
- The version 1 frontend and Qiskit export are implemented and tested.
|
|
10
|
+
- The anyonic backend models computational and leakage states and supports physical cross-qubit braiding.
|
|
11
|
+
- Normal backend execution includes stored braid sequences for CX, CY, CZ, CS, CT, CCX, CCY, CCZ, CCS, and CCT.
|
|
12
|
+
- The circuit API and Qiskit export impose no fixed limit on the number of controls per gate. Version 1 anyonic execution supports up to two controls per gate; this does not limit the total number of qubits in a circuit.
|
|
13
|
+
- The physical backend represents Fibonacci anyons in a fusion-tree basis and tracks both computational and leakage states.
|
|
14
|
+
- It applies physical braids through F and R moves, including braids across qubit boundaries, and reports fidelity and leakage relative to the ideal logical result.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Qitker requires Python 3.11 or newer. Run the installation commands with the same Python interpreter that you use to run your programs. Installation is needed once per Python environment.
|
|
19
|
+
|
|
20
|
+
### Install from PyPI
|
|
21
|
+
|
|
22
|
+
Install Qitker version `1.0.0` and its NumPy dependency from PyPI:
|
|
23
|
+
|
|
24
|
+
```powershell
|
|
25
|
+
python -m pip install "qitker==1.0.0"
|
|
26
|
+
python -m pip check
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
For Qiskit export support, install the optional dependency:
|
|
30
|
+
|
|
31
|
+
```powershell
|
|
32
|
+
python -m pip install "qitker[qiskit]==1.0.0"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Install from source
|
|
36
|
+
|
|
37
|
+
From a checkout of this repository, install Qitker and its NumPy dependency with:
|
|
38
|
+
|
|
39
|
+
```powershell
|
|
40
|
+
python -m pip install .
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
For Qiskit export support, use this command instead:
|
|
44
|
+
|
|
45
|
+
```powershell
|
|
46
|
+
python -m pip install ".[qiskit]"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Install dependencies for examples and plots
|
|
50
|
+
|
|
51
|
+
After installing Qitker by either method above, run the following from the repository root:
|
|
52
|
+
|
|
53
|
+
```powershell
|
|
54
|
+
python -m pip install -r requirements.txt
|
|
55
|
+
python -m pip check
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`requirements.txt` installs Qiskit with its visualization dependencies, Qiskit Aer for simulation, SciPy for optimization, and Matplotlib for plots. The `qiskit[visualization]` extra also installs `pylatexenc`, which is required by `draw("mpl")`. In Python, `plt` is an alias for `matplotlib.pyplot`, not a separate package.
|
|
59
|
+
|
|
60
|
+
The `qitker[qiskit]` extra provides circuit export; use `requirements.txt` for the simulation and plotting examples below. This requirements file installs dependencies only. Qitker itself must be installed separately using one of the commands above.
|
|
61
|
+
|
|
62
|
+
The example scripts and `requirements.txt` are available in this repository and are not included in the installed Qitker wheel. Download them or clone the repository to run the examples. For testing the published release on another computer, use the PyPI installation commands above rather than installing from source.
|
|
63
|
+
|
|
64
|
+
## Quick start: anyonic execution
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from qitker import circuit, qubit
|
|
68
|
+
|
|
69
|
+
party = circuit()
|
|
70
|
+
aliza = qubit(party)
|
|
71
|
+
baruch = qubit(party)
|
|
72
|
+
|
|
73
|
+
aliza.mix()
|
|
74
|
+
baruch.flipIf(aliza)
|
|
75
|
+
|
|
76
|
+
result = party.measure(shots=1024)
|
|
77
|
+
print(result)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`measure()` executes the circuit through Qitker's anyonic backend and returns a report containing measurements, fidelity, and leakage.
|
|
81
|
+
|
|
82
|
+
## Export to Qiskit
|
|
83
|
+
|
|
84
|
+
With the Qiskit dependency installed, export a circuit as a Qiskit `QuantumCircuit`:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from qitker import circuit, qubit
|
|
88
|
+
|
|
89
|
+
sample = circuit()
|
|
90
|
+
qubit(sample).mix()
|
|
91
|
+
|
|
92
|
+
qiskit_circuit = sample.exportCircuit("qiskit")
|
|
93
|
+
print(qiskit_circuit)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Qiskit export also preserves rotation angles and controlled rotations, which are not supported by the current anyonic execution path.
|
|
97
|
+
|
|
98
|
+
Export converts the circuit's gates; it does not run the anyonic backend or add Qiskit measurement instructions. Add those instructions explicitly before sampling with Qiskit Aer.
|
|
99
|
+
|
|
100
|
+
## Simulate and plot with Qiskit Aer
|
|
101
|
+
|
|
102
|
+
Install `requirements.txt` before running this example. It exports a Bell circuit, draws it with Matplotlib, samples it in Aer, and displays a histogram:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from qitker import circuit, qubit
|
|
106
|
+
from qiskit import transpile
|
|
107
|
+
from qiskit_aer import Aer
|
|
108
|
+
from qiskit.visualization import plot_histogram
|
|
109
|
+
import matplotlib.pyplot as plt
|
|
110
|
+
|
|
111
|
+
party = circuit()
|
|
112
|
+
aliza = qubit(party)
|
|
113
|
+
baruch = qubit(party)
|
|
114
|
+
aliza.mix()
|
|
115
|
+
baruch.flipIf(aliza)
|
|
116
|
+
|
|
117
|
+
qc = party.exportCircuit("qiskit")
|
|
118
|
+
qc.measure(*party.getMeasuredLists())
|
|
119
|
+
qc.draw("mpl")
|
|
120
|
+
|
|
121
|
+
simulator = Aer.get_backend("qasm_simulator")
|
|
122
|
+
compiled = transpile(qc, simulator)
|
|
123
|
+
counts = simulator.run(compiled, shots=1024).result().get_counts()
|
|
124
|
+
|
|
125
|
+
# Display the first Qitker qubit on the left of each bitstring.
|
|
126
|
+
qitker_counts = {bits[::-1]: count for bits, count in counts.items()}
|
|
127
|
+
print(qitker_counts)
|
|
128
|
+
plot_histogram(qitker_counts)
|
|
129
|
+
plt.show()
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Aer simulates the exported logical gates. Its results do not include Qitker's physical braiding fidelity or leakage. Use `party.measure()` for those quantities. `plt.show()` displays figures in a desktop environment with a graphical Matplotlib backend.
|
|
133
|
+
|
|
134
|
+
## Examples and tests
|
|
135
|
+
|
|
136
|
+
Start with the [project overview (D0)](https://github.com/nitayB14/Qitker/blob/main/Documentation/English/D0_Project_Overview.md) for the motivation, execution paths, and current limitations. The guides below explain each example.
|
|
137
|
+
|
|
138
|
+
After installing the example dependencies, run an example from the repository root:
|
|
139
|
+
|
|
140
|
+
```powershell
|
|
141
|
+
python -B Examples/EX3_advanced_grover.py
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
| Example | Guide | Execution and output |
|
|
145
|
+
| --- | --- | --- |
|
|
146
|
+
| [Bell and GHZ states](https://github.com/nitayB14/Qitker/blob/main/Examples/EX1_Bell_State.py) | [D1](https://github.com/nitayB14/Qitker/blob/main/Documentation/English/D1_Bell_and_GHZ_States.md) | Qitker anyonic execution, text circuit drawings, and measurement reports |
|
|
147
|
+
| [Simple Grover search](https://github.com/nitayB14/Qitker/blob/main/Examples/EX2_simple_grover.py) | [D2](https://github.com/nitayB14/Qitker/blob/main/Documentation/English/D2_Simple_Grover.md) | Qitker anyonic execution and text output |
|
|
148
|
+
| [Advanced Grover search](https://github.com/nitayB14/Qitker/blob/main/Examples/EX3_advanced_grover.py) | [D3](https://github.com/nitayB14/Qitker/blob/main/Documentation/English/D3_advanced_grover.md) | Qiskit Aer simulation, circuit drawing, and a Matplotlib histogram |
|
|
149
|
+
| [Sudoku with QAOA](https://github.com/nitayB14/Qitker/blob/main/Examples/EX4_sudoku3x3.py) | [D4](https://github.com/nitayB14/Qitker/blob/main/Documentation/English/D4_sudoku3x3.md) | Qiskit Aer simulation and SciPy optimization |
|
|
150
|
+
|
|
151
|
+
- [Frontend tests](https://github.com/nitayB14/Qitker/blob/main/version_testing/Frontend/README.md)
|
|
152
|
+
- [Backend tests](https://github.com/nitayB14/Qitker/blob/main/version_testing/Backend/README.md)
|
|
153
|
+
|
|
154
|
+
Licensed under the [MIT License](https://github.com/nitayB14/Qitker/blob/main/LICENSE).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "qitker"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Qitker bridges intuitive, high-level quantum programming with topological quantum computation, translating readable quantum logic into Fibonacci-anyon braiding."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Nitay Bahliker" }]
|
|
14
|
+
dependencies = ["numpy>=2.4,<3"]
|
|
15
|
+
|
|
16
|
+
[project.optional-dependencies]
|
|
17
|
+
qiskit = ["qiskit>=2.3.1,<3"]
|
|
18
|
+
|
|
19
|
+
[project.urls]
|
|
20
|
+
Repository = "https://github.com/nitayB14/Qitker"
|
|
21
|
+
|
|
22
|
+
[tool.setuptools.packages.find]
|
|
23
|
+
where = ["."]
|
|
24
|
+
include = ["qitker", "qitker.*"]
|
|
25
|
+
namespaces = true
|
|
26
|
+
|
|
27
|
+
[tool.setuptools.package-data]
|
|
28
|
+
"qitker.parser" = ["braid_sequences.json"]
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""Export recorded circuit operations to Qiskit."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def export_to(name, circuit):
|
|
6
|
+
"""
|
|
7
|
+
Export a circuit to the requested platform.
|
|
8
|
+
|
|
9
|
+
Only the exact name "qiskit" is supported.
|
|
10
|
+
|
|
11
|
+
Args:
|
|
12
|
+
name (str): Export target.
|
|
13
|
+
circuit (circuit): Circuit to export.
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
qiskit.QuantumCircuit: A new exported circuit.
|
|
17
|
+
|
|
18
|
+
Raises:
|
|
19
|
+
TypeError: If name is not a string.
|
|
20
|
+
ValueError: If name is not ``"qiskit"``.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
if not isinstance(name, str):
|
|
24
|
+
raise TypeError("export target must be a string")
|
|
25
|
+
if name != "qiskit":
|
|
26
|
+
raise ValueError(f"Unsupported export target: {name!r}. Supported target: 'qiskit'.")
|
|
27
|
+
|
|
28
|
+
return exportToQiskit(circuit)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def exportToQiskit(AnyonCircuit):
|
|
36
|
+
"""
|
|
37
|
+
Convert the circuit's recorded operations to a new Qiskit circuit.
|
|
38
|
+
|
|
39
|
+
The exported circuit has one qubit per Qitker qubit and one classical
|
|
40
|
+
bit per qubit marked for measurement. No measurement instructions
|
|
41
|
+
are added.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
AnyonCircuit (circuit): Circuit to export.
|
|
45
|
+
|
|
46
|
+
Returns:
|
|
47
|
+
qiskit.QuantumCircuit: The exported circuit.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
from qiskit import QuantumCircuit
|
|
51
|
+
from qiskit.circuit.library import (
|
|
52
|
+
YGate,
|
|
53
|
+
ZGate,
|
|
54
|
+
SGate,
|
|
55
|
+
TGate,
|
|
56
|
+
RXGate,
|
|
57
|
+
RYGate,
|
|
58
|
+
RZGate,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
qc = QuantumCircuit(AnyonCircuit.getQubitsNumber(), AnyonCircuit.getQubitsNumberToMeasure()) #creating qiskit circuit
|
|
62
|
+
vector = AnyonCircuit.getOperationVector()
|
|
63
|
+
|
|
64
|
+
controlled_gates = {
|
|
65
|
+
"Y": YGate,
|
|
66
|
+
"Z": ZGate,
|
|
67
|
+
"S": SGate,
|
|
68
|
+
"T": TGate
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
controlled_rotation_gates = {
|
|
72
|
+
"RX": RXGate,
|
|
73
|
+
"RY": RYGate,
|
|
74
|
+
"RZ": RZGate
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
#loop over operation vector
|
|
79
|
+
for op in vector:
|
|
80
|
+
|
|
81
|
+
if hasattr(op, "getControllers"):
|
|
82
|
+
controls = op.getControllers()
|
|
83
|
+
target = op.getTarget()
|
|
84
|
+
name = op.getName()
|
|
85
|
+
|
|
86
|
+
if name == "X":
|
|
87
|
+
if len(controls) == 1:
|
|
88
|
+
qc.cx(controls[0], target)
|
|
89
|
+
else:
|
|
90
|
+
qc.mcx(controls, target)
|
|
91
|
+
|
|
92
|
+
elif name in controlled_rotation_gates:
|
|
93
|
+
gate = controlled_rotation_gates[name](op.getAngle())
|
|
94
|
+
|
|
95
|
+
qc.append(
|
|
96
|
+
gate.control(len(controls)),
|
|
97
|
+
controls + [target]
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
elif name in controlled_gates:
|
|
101
|
+
gate = controlled_gates[name]()
|
|
102
|
+
|
|
103
|
+
if len(controls) == 1:
|
|
104
|
+
qc.append(
|
|
105
|
+
gate.control(1),
|
|
106
|
+
controls + [target]
|
|
107
|
+
)
|
|
108
|
+
else:
|
|
109
|
+
qc.append(
|
|
110
|
+
gate.control(len(controls)),
|
|
111
|
+
controls + [target]
|
|
112
|
+
)
|
|
113
|
+
else:
|
|
114
|
+
if(op.getName() == "H"):
|
|
115
|
+
qc.h(op.getTarget())
|
|
116
|
+
elif(op.getName() == "X"):
|
|
117
|
+
qc.x(op.getTarget())
|
|
118
|
+
elif(op.getName() == "Y"):
|
|
119
|
+
qc.y(op.getTarget())
|
|
120
|
+
elif(op.getName() == "Z"):
|
|
121
|
+
qc.z(op.getTarget())
|
|
122
|
+
elif(op.getName() == "S"):
|
|
123
|
+
qc.s(op.getTarget())
|
|
124
|
+
elif(op.getName() == "T"):
|
|
125
|
+
qc.t(op.getTarget())
|
|
126
|
+
elif(op.getName() == "RX"):
|
|
127
|
+
qc.rx(op.getAngle(), op.getTarget())
|
|
128
|
+
elif(op.getName() == "RY"):
|
|
129
|
+
qc.ry(op.getAngle(), op.getTarget())
|
|
130
|
+
elif(op.getName() == "RZ"):
|
|
131
|
+
qc.rz(op.getAngle(), op.getTarget())
|
|
132
|
+
elif(op.getName() == "barrier"):
|
|
133
|
+
qc.barrier()
|
|
134
|
+
|
|
135
|
+
return qc
|