microquantum 0.1.0__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.
@@ -0,0 +1,3 @@
1
+ from .simulator import QuantumCircuit
2
+
3
+ __all__ = ["QuantumCircuit"]
@@ -0,0 +1,29 @@
1
+ import numpy as np
2
+
3
+ class QuantumCircuit:
4
+ def __init__(self, num_qubits: int):
5
+ self.num_qubits = num_qubits
6
+ self.state = np.zeros(2**num_qubits, dtype=complex)
7
+ self.state[0] = 1.0
8
+
9
+ def _apply_gate(self, gate: np.ndarray, target: int):
10
+ dim_before = 2**target
11
+ dim_after = 2**(self.num_qubits - target - 1)
12
+ self.state = self.state.reshape((dim_before, 2, dim_after))
13
+ self.state = np.einsum('ij,ajb->aib', gate, self.state)
14
+ self.state = self.state.flatten()
15
+
16
+ def h(self, target: int):
17
+ H = np.array([[1, 1], [1, -1]], dtype=complex) / np.sqrt(2)
18
+ self._apply_gate(H, target)
19
+
20
+ def measure(self, shots: int = 1000) -> dict:
21
+ probabilities = np.abs(self.state) ** 2
22
+ probabilities /= np.sum(probabilities)
23
+ outcomes = np.random.choice(2**self.num_qubits, size=shots, p=probabilities)
24
+
25
+ counts = {}
26
+ for outcome in outcomes:
27
+ binary_str = format(outcome, f'0{self.num_qubits}b')
28
+ counts[binary_str] = counts.get(binary_str, 0) + 1
29
+ return dict(sorted(counts.items()))
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: microquantum
3
+ Version: 0.1.0
4
+ Summary: A simple Python SDK for basic quantum computing operations.
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: numpy>=1.20.0
9
+ Dynamic: license-file
10
+
11
+ # microquantum
12
+ A lightweight, educational Python SDK for simulating basic quantum computing operations.
13
+
14
+ # pip install microquantum
15
+
16
+
17
+ ### `LICENSE`
18
+ An open-source license is highly recommended. You can use the standard MIT License:
19
+
20
+ ```text
21
+ MIT License
22
+
23
+ Copyright (c) 2026 Ajit Kumar
24
+
25
+ Permission is hereby granted, free of charge, to any person obtaining a copy
26
+ of this software and associated documentation files (the "Software"), to deal
27
+ in the Software without restriction, including without limitation the rights
28
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
+ copies of the Software, and to permit persons to whom the Software is
30
+ furnished to do so, subject to the following conditions:
31
+
32
+ The above copyright notice and this permission notice shall be included in all
33
+ copies or substantial portions of the Software.
34
+
35
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41
+ SOFTWARE.
@@ -0,0 +1,7 @@
1
+ microquantum/__init__.py,sha256=qG06lV9rb3z50VtreY7Ql6wcjo8t63tFPhZJEUfDvYs,71
2
+ microquantum/simulator.py,sha256=O19ZwYyPFZTf5MDvxEw78aJ6FKdohtX7Go_-BS21t8g,1155
3
+ microquantum-0.1.0.dist-info/licenses/LICENSE,sha256=50ehyOzOtvYZ7MqY7U0JB87ZXWdAoyVXPX-huO4V_VM,86
4
+ microquantum-0.1.0.dist-info/METADATA,sha256=oeSizw-erWvTxHzaRXOb1qB25izR9_pZiyWsNjP4Ygk,1611
5
+ microquantum-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
6
+ microquantum-0.1.0.dist-info/top_level.txt,sha256=5VJRzaHw6AG2lfPtcgkgrO2QLVC9_3AX39SJcFsV5yg,13
7
+ microquantum-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,5 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Your Name
4
+
5
+ (Standard MIT License terms apply here)
@@ -0,0 +1 @@
1
+ microquantum