quantum-loop 0.1.3__py3-none-any.whl → 0.2.1__py3-none-any.whl
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.
Potentially problematic release.
This version of quantum-loop might be problematic. Click here for more details.
- {quantum_loop → ql}/__init__.py +3 -1
- {quantum_loop → ql}/loop.py +1 -21
- ql/utils.py +24 -0
- {quantum_loop-0.1.3.dist-info → quantum_loop-0.2.1.dist-info}/METADATA +21 -11
- quantum_loop-0.2.1.dist-info/RECORD +8 -0
- quantum_loop-0.1.3.dist-info/RECORD +0 -7
- {quantum_loop → ql}/py.typed +0 -0
- {quantum_loop-0.1.3.dist-info → quantum_loop-0.2.1.dist-info}/WHEEL +0 -0
- {quantum_loop-0.1.3.dist-info → quantum_loop-0.2.1.dist-info}/licenses/LICENSE +0 -0
{quantum_loop → ql}/__init__.py
RENAMED
{quantum_loop → ql}/loop.py
RENAMED
|
@@ -18,7 +18,6 @@ The module contains the following tools:
|
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
20
|
import concurrent.futures
|
|
21
|
-
import multiprocessing
|
|
22
21
|
from collections.abc import Callable, Iterable
|
|
23
22
|
from enum import Enum
|
|
24
23
|
from typing import Any, Never, assert_never
|
|
@@ -31,30 +30,11 @@ class LoopMode(Enum):
|
|
|
31
30
|
THREAD_POOL = 2
|
|
32
31
|
|
|
33
32
|
|
|
34
|
-
def count_qubits() -> int:
|
|
35
|
-
"""Counting the number of conceptual qubits of your computer.
|
|
36
|
-
|
|
37
|
-
Conceptual qubit is quantum of algorithm (task) that is executed in
|
|
38
|
-
iterations of a cycle in a separate processor thread.
|
|
39
|
-
|
|
40
|
-
Quantum of algorithm is a function for data processing.
|
|
41
|
-
|
|
42
|
-
Examples:
|
|
43
|
-
>>> from xloft.quantum import count_qubits
|
|
44
|
-
>>> count_qubits()
|
|
45
|
-
16
|
|
46
|
-
|
|
47
|
-
Returns:
|
|
48
|
-
The number of conceptual qubits.
|
|
49
|
-
"""
|
|
50
|
-
return multiprocessing.cpu_count()
|
|
51
|
-
|
|
52
|
-
|
|
53
33
|
class QuantumLoop:
|
|
54
34
|
"""Separation of the cycle into quantum algorithms for multiprocessing data processing.
|
|
55
35
|
|
|
56
36
|
Examples:
|
|
57
|
-
>>> from
|
|
37
|
+
>>> from ql import QuantumLoop
|
|
58
38
|
>>> def task(item):
|
|
59
39
|
... return item * item
|
|
60
40
|
>>> data = range(10)
|
ql/utils.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Utils."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import multiprocessing
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def count_qubits() -> int:
|
|
9
|
+
"""Counting the number of conceptual qubits of your computer.
|
|
10
|
+
|
|
11
|
+
Conceptual qubit is quantum of algorithm (task) that is executed in
|
|
12
|
+
iterations of a cycle in a separate processor thread.
|
|
13
|
+
|
|
14
|
+
Quantum of algorithm is a function for data processing.
|
|
15
|
+
|
|
16
|
+
Examples:
|
|
17
|
+
>>> from ql import count_qubits
|
|
18
|
+
>>> count_qubits()
|
|
19
|
+
16
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
The number of conceptual qubits.
|
|
23
|
+
"""
|
|
24
|
+
return multiprocessing.cpu_count()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quantum-loop
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: A set of tools for quantum calculations.
|
|
5
5
|
Project-URL: Homepage, https://github.com/kebasyaty/quantum-loop
|
|
6
6
|
Project-URL: Repository, https://github.com/kebasyaty/quantum-loop
|
|
@@ -73,6 +73,10 @@ Description-Content-Type: text/markdown
|
|
|
73
73
|
</p>
|
|
74
74
|
</div>
|
|
75
75
|
|
|
76
|
+
##
|
|
77
|
+
|
|
78
|
+
<br>
|
|
79
|
+
|
|
76
80
|
## Documentation
|
|
77
81
|
|
|
78
82
|
Online browsable documentation is available at [https://kebasyaty.github.io/quantum-loop/](https://kebasyaty.github.io/quantum-loop/ "Documentation").
|
|
@@ -90,22 +94,28 @@ uv add quantum-loop
|
|
|
90
94
|
## Usage
|
|
91
95
|
|
|
92
96
|
```python
|
|
93
|
-
from
|
|
97
|
+
from ql import QuantumLoop, count_qubits
|
|
94
98
|
|
|
95
|
-
# Counting the number of conceptual qubits of your computer.
|
|
96
|
-
num = count_qubits()
|
|
97
|
-
print(num) # => 16
|
|
98
99
|
|
|
99
|
-
def task(item):
|
|
100
|
+
def task(item: int) -> int:
|
|
100
101
|
"""Quantum."""
|
|
101
102
|
return item * item
|
|
102
103
|
|
|
103
|
-
data = range(10)
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
#
|
|
107
|
-
|
|
108
|
-
print(
|
|
105
|
+
def main() -> None:
|
|
106
|
+
# Counting the number of conceptual qubits of your computer.
|
|
107
|
+
num = count_qubits()
|
|
108
|
+
print(num) # => 16
|
|
109
|
+
|
|
110
|
+
# Separation of the cycle into quantum algorithms for
|
|
111
|
+
# multiprocessing data processing.
|
|
112
|
+
data = range(10)
|
|
113
|
+
results = QuantumLoop(task, data).run()
|
|
114
|
+
print(results) # => [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
if __name__ == "__main__":
|
|
118
|
+
main()
|
|
109
119
|
```
|
|
110
120
|
|
|
111
121
|
## Changelog
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
ql/__init__.py,sha256=ZRQ0z14P0H_TEUnAspjNJuWxDul-S03U8iVa5Tg8SQc,607
|
|
2
|
+
ql/loop.py,sha256=Lcx_b_FQHOnf7HDJKAll8rzU_6f8EU4V5ozaLPj5kMI,4132
|
|
3
|
+
ql/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
ql/utils.py,sha256=MPRUYSlD8DN7Hb28X3ru9bBnsiQ39IPAQ0w23sikRZM,579
|
|
5
|
+
quantum_loop-0.2.1.dist-info/METADATA,sha256=RuaNLOFrZ9msd50f2PSI8TH0GgmRbxigqR-f79Mvb6Y,5978
|
|
6
|
+
quantum_loop-0.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
+
quantum_loop-0.2.1.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
|
|
8
|
+
quantum_loop-0.2.1.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
quantum_loop/__init__.py,sha256=CfmdL_nJ6QHGNRYmQ0qlPUVfBdZiUeBULMTHwOp9gvU,594
|
|
2
|
-
quantum_loop/loop.py,sha256=ZkFqqFROC9j5JbwJmej3yL9VJcqElPrrimFTz0Pe3Mk,4679
|
|
3
|
-
quantum_loop/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
quantum_loop-0.1.3.dist-info/METADATA,sha256=ZM72-rwf_LTJDqfCtAhSCcJIW85m-UoqWe9aoOF7qx0,5883
|
|
5
|
-
quantum_loop-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
6
|
-
quantum_loop-0.1.3.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
|
|
7
|
-
quantum_loop-0.1.3.dist-info/RECORD,,
|
{quantum_loop → ql}/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|