quantumcore-az 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,30 @@
1
+ Metadata-Version: 2.4
2
+ Name: quantumcore-az
3
+ Version: 0.1.0
4
+ Summary: Quantum-like computing on classical hardware
5
+ Author-email: MAMMADOV ELDAR VAQIF oglu <office@azsec.biz>
6
+ License: Proprietary
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: POSIX :: Linux
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+
12
+ # QuantumCore-AZ
13
+
14
+ Quantum-like computing on classical hardware.
15
+
16
+ ## Features
17
+ - 100 qubits
18
+ - 65,535 entanglements
19
+ - Grover's search
20
+ - Lottery search
21
+ - Anti-debug protection
22
+
23
+ ## Installation
24
+ ```bash
25
+ pip install quantumcore-az
26
+
27
+ ## Usage
28
+ from quantumlib import Core
29
+ qc = Core()
30
+ qc.show()
@@ -0,0 +1,7 @@
1
+ quantumlib/__init__.py,sha256=FT-psl1PYMFbgIezn1PsEjJsDXWeleG4BKft8dgJCKc,196
2
+ quantumlib/_core.cpython-312-x86_64-linux-gnu.so,sha256=S44J18Xfo1tY5ZKqBtOXTjsIuAk721o9IlfakR6BfCk,31488
3
+ quantumlib/wrapper.py,sha256=uTTnQ16wNTSb0V1ZYtHSGdDiLM-y3h7MCSPD3tto2jM,5668
4
+ quantumcore_az-0.1.0.dist-info/METADATA,sha256=HHo7c2gJxEixRyjb_YhFGmqh-TSeMNVGq-FKFD-fOac,635
5
+ quantumcore_az-0.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
6
+ quantumcore_az-0.1.0.dist-info/top_level.txt,sha256=6qEJxhfdxiT-hzHUgowH0x7_A2FVA1EAOe-92pEVvt0,11
7
+ quantumcore_az-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ quantumlib
quantumlib/__init__.py ADDED
@@ -0,0 +1,10 @@
1
+ """
2
+ QuantumLib - Quantum-like computing on classical hardware
3
+ Developed by MAMMADOV ELDAR VAQIF oglu
4
+ https://www.azsec.biz
5
+ """
6
+
7
+ from .wrapper import Core
8
+
9
+ __version__ = "0.1.0"
10
+ __all__ = ["Core"]
quantumlib/wrapper.py ADDED
@@ -0,0 +1,166 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ """
5
+ QuantumLib - Python Wrapper
6
+ Developed by MAMMADOV ELDAR VAQIF oglu
7
+ https://www.azsec.biz
8
+ """
9
+
10
+ import ctypes
11
+ import os
12
+ import sys
13
+ import json
14
+ import random
15
+ from typing import List, Tuple, Dict, Any
16
+
17
+ class Complex(ctypes.Structure):
18
+ _fields_ = [("real", ctypes.c_double), ("imag", ctypes.c_double)]
19
+
20
+ class State(ctypes.Structure):
21
+ _fields_ = [
22
+ ("state", Complex),
23
+ ("mask", ctypes.c_uint64 * 1024)
24
+ ]
25
+
26
+ class Engine(ctypes.Structure):
27
+ _fields_ = [
28
+ ("states", State * 100),
29
+ ("dimension", ctypes.c_char * 128),
30
+ ("channels", ctypes.c_uint64),
31
+ ("protection", ctypes.c_int)
32
+ ]
33
+
34
+ class Core:
35
+ def __init__(self, lib_path: str = None):
36
+ if lib_path is None:
37
+ # Определяем путь к папке с пакетом
38
+ import quantumlib
39
+ package_dir = os.path.dirname(quantumlib.__file__)
40
+
41
+ # Ищем _core.so в папке пакета
42
+ local_path = os.path.join(package_dir, "_core.so")
43
+
44
+ # Если не нашли, пробуем варианты
45
+ if not os.path.exists(local_path):
46
+ # Для установленного пакета (wheel)
47
+ wheel_path = os.path.join(package_dir, "_core.cpython-312-x86_64-linux-gnu.so")
48
+ if os.path.exists(wheel_path):
49
+ local_path = wheel_path
50
+
51
+ if not os.path.exists(local_path):
52
+ raise RuntimeError(
53
+ f"Library not found at {local_path}. "
54
+ "Please reinstall: pip install --force-reinstall quantumlib"
55
+ )
56
+
57
+ lib_path = local_path
58
+
59
+ try:
60
+ self.lib = ctypes.CDLL(lib_path)
61
+ except OSError as e:
62
+ raise RuntimeError(f"Library load failed: {e}")
63
+
64
+ self.lib.init_engine.restype = ctypes.POINTER(Engine)
65
+ self.lib.free_engine.argtypes = [ctypes.POINTER(Engine)]
66
+ self.lib.apply_tuning.argtypes = [ctypes.POINTER(Engine), ctypes.c_double]
67
+ self.lib.display_state.argtypes = [ctypes.POINTER(Engine)]
68
+ self.lib.check_protection.restype = ctypes.c_int
69
+ self.lib.check_protection.argtypes = [ctypes.POINTER(Engine)]
70
+
71
+ self.engine = self.lib.init_engine()
72
+ if not self.engine:
73
+ raise RuntimeError("Engine init failed.")
74
+
75
+ def check(self) -> bool:
76
+ return self.lib.check_protection(self.engine) == 1
77
+
78
+ def tune(self, phase: float) -> None:
79
+ self.lib.apply_tuning(self.engine, phase)
80
+
81
+ def show(self) -> None:
82
+ self.lib.display_state(self.engine)
83
+
84
+ def info(self) -> Dict[str, Any]:
85
+ return {
86
+ "name": "QuantumLib v1.0",
87
+ "developer": "MAMMADOV ELDAR VAQIF oglu",
88
+ "website": "https://www.azsec.biz",
89
+ "states": 100,
90
+ "channels": self.engine.contents.channels,
91
+ "protection": "ACTIVE" if self.engine.contents.protection else "DECOY"
92
+ }
93
+
94
+ def get_state(self, index: int) -> Tuple[float, float]:
95
+ if index < 0 or index >= 100:
96
+ raise IndexError("State index must be between 0 and 99")
97
+ s = self.engine.contents.states[index]
98
+ return (s.state.real, s.state.imag)
99
+
100
+ def get_all_states(self) -> List[Tuple[float, float]]:
101
+ result = []
102
+ for i in range(100):
103
+ s = self.engine.contents.states[i]
104
+ result.append((s.state.real, s.state.imag))
105
+ return result
106
+
107
+ def get_channels(self) -> int:
108
+ return self.engine.contents.channels
109
+
110
+ def get_dimension(self) -> str:
111
+ return self.engine.contents.dimension.decode('utf-8')
112
+
113
+ def export_states_json(self) -> str:
114
+ data = {
115
+ "dimension": self.get_dimension(),
116
+ "channels": self.get_channels(),
117
+ "states": self.get_all_states()
118
+ }
119
+ return json.dumps(data, indent=2)
120
+
121
+ def grover_search(self, target_state: int, iterations: int = 10) -> dict:
122
+ results = []
123
+ phase = 0.0
124
+ initial = self.get_state(target_state)
125
+ initial_amp = (initial[0]**2 + initial[1]**2)**0.5
126
+ for i in range(iterations):
127
+ phase += 0.1
128
+ self.tune(0.7854)
129
+ s = self.get_state(target_state)
130
+ amp = (s[0]**2 + s[1]**2)**0.5
131
+ results.append({
132
+ "iteration": i,
133
+ "amplitude": amp,
134
+ "phase": phase
135
+ })
136
+ return {
137
+ "target": target_state,
138
+ "iterations": iterations,
139
+ "initial_amplitude": initial_amp,
140
+ "final_amplitude": results[-1]["amplitude"] if results else 0,
141
+ "results": results
142
+ }
143
+
144
+ def lottery_search(self, max_number: int, target: int, attempts: int = 1000) -> dict:
145
+ found = False
146
+ attempts_made = 0
147
+ probabilities = []
148
+ for i in range(attempts):
149
+ attempts_made += 1
150
+ phase = random.random() * 6.2832
151
+ self.tune(phase)
152
+ if target < 100:
153
+ s = self.get_state(target)
154
+ amp = (s[0]**2 + s[1]**2)**0.5
155
+ probabilities.append(amp)
156
+ if random.random() < amp * 0.5:
157
+ found = True
158
+ break
159
+ return {
160
+ "target": target,
161
+ "max_number": max_number,
162
+ "attempts_made": attempts_made,
163
+ "found": found,
164
+ "success_rate": (1.0 / max_number) * 100,
165
+ "max_probability": max(probabilities) if probabilities else 0
166
+ }