superquantx 0.1.0__py3-none-any.whl → 0.1.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.
- superquantx/__init__.py +24 -12
- superquantx/algorithms/__init__.py +1 -1
- superquantx/algorithms/base_algorithm.py +36 -36
- superquantx/algorithms/hybrid_classifier.py +22 -22
- superquantx/algorithms/qaoa.py +29 -28
- superquantx/algorithms/quantum_agents.py +57 -56
- superquantx/algorithms/quantum_kmeans.py +17 -17
- superquantx/algorithms/quantum_nn.py +18 -18
- superquantx/algorithms/quantum_pca.py +26 -26
- superquantx/algorithms/quantum_svm.py +26 -25
- superquantx/algorithms/vqe.py +40 -39
- superquantx/algorithms.py +56 -55
- superquantx/backends/__init__.py +12 -12
- superquantx/backends/base_backend.py +25 -24
- superquantx/backends/braket_backend.py +21 -21
- superquantx/backends/cirq_backend.py +26 -26
- superquantx/backends/ocean_backend.py +38 -38
- superquantx/backends/pennylane_backend.py +12 -11
- superquantx/backends/qiskit_backend.py +12 -12
- superquantx/backends/simulator_backend.py +31 -17
- superquantx/backends/tket_backend.py +23 -23
- superquantx/circuits.py +25 -25
- superquantx/cli/commands.py +6 -7
- superquantx/cli/main.py +5 -6
- superquantx/client.py +42 -42
- superquantx/config.py +14 -14
- superquantx/datasets/__init__.py +58 -0
- superquantx/datasets/molecular.py +307 -0
- superquantx/datasets/preprocessing.py +279 -0
- superquantx/datasets/quantum_datasets.py +277 -0
- superquantx/datasets/synthetic.py +300 -0
- superquantx/exceptions.py +29 -29
- superquantx/gates.py +26 -26
- superquantx/logging_config.py +29 -29
- superquantx/measurements.py +53 -54
- superquantx/ml.py +51 -52
- superquantx/noise.py +49 -49
- superquantx/utils/benchmarking.py +41 -36
- superquantx/utils/classical_utils.py +32 -32
- superquantx/utils/feature_mapping.py +40 -35
- superquantx/utils/optimization.py +28 -26
- superquantx/utils/quantum_utils.py +47 -48
- superquantx/utils/visualization.py +49 -49
- superquantx/version.py +3 -3
- {superquantx-0.1.0.dist-info → superquantx-0.1.1.dist-info}/METADATA +18 -16
- superquantx-0.1.1.dist-info/RECORD +51 -0
- superquantx-0.1.1.dist-info/licenses/LICENSE +180 -0
- superquantx-0.1.0.dist-info/RECORD +0 -46
- superquantx-0.1.0.dist-info/licenses/LICENSE +0 -21
- {superquantx-0.1.0.dist-info → superquantx-0.1.1.dist-info}/WHEEL +0 -0
- {superquantx-0.1.0.dist-info → superquantx-0.1.1.dist-info}/entry_points.txt +0 -0
superquantx/cli/commands.py
CHANGED
@@ -7,7 +7,6 @@ including algorithm execution, benchmarking, configuration, and system informati
|
|
7
7
|
import json
|
8
8
|
import sys
|
9
9
|
import time
|
10
|
-
from typing import Optional
|
11
10
|
|
12
11
|
import click
|
13
12
|
import numpy as np
|
@@ -100,7 +99,7 @@ def list_algorithms(category: str, verbose: bool):
|
|
100
99
|
|
101
100
|
# Try to get algorithm class and show parameters
|
102
101
|
try:
|
103
|
-
|
102
|
+
getattr(sqx.algorithms, alg_name)
|
104
103
|
# This is a simplified approach - real implementation would
|
105
104
|
# need to inspect the class properly
|
106
105
|
click.echo(f" Module: superquantx.algorithms.{alg_name}")
|
@@ -189,8 +188,8 @@ def run_algorithm(
|
|
189
188
|
algorithm: str,
|
190
189
|
data: str,
|
191
190
|
backend: str,
|
192
|
-
output:
|
193
|
-
config_file:
|
191
|
+
output: str | None,
|
192
|
+
config_file: str | None,
|
194
193
|
verbose: bool
|
195
194
|
):
|
196
195
|
"""Run a quantum algorithm on specified dataset."""
|
@@ -403,7 +402,7 @@ def benchmark(
|
|
403
402
|
is_flag=True,
|
404
403
|
help='Show current configuration'
|
405
404
|
)
|
406
|
-
def configure(backend:
|
405
|
+
def configure(backend: str | None, shots: int | None, seed: int | None, show: bool):
|
407
406
|
"""Configure SuperQuantX settings."""
|
408
407
|
if show:
|
409
408
|
click.echo("Current SuperQuantX Configuration:")
|
@@ -451,7 +450,7 @@ def configure(backend: Optional[str], shots: Optional[int], seed: Optional[int],
|
|
451
450
|
type=click.Path(),
|
452
451
|
help='Output file (NPZ format)'
|
453
452
|
)
|
454
|
-
def create_dataset(dataset_type: str, samples: int, features: int, output:
|
453
|
+
def create_dataset(dataset_type: str, samples: int, features: int, output: str | None):
|
455
454
|
"""Create synthetic datasets for testing."""
|
456
455
|
if dataset_type == 'classification':
|
457
456
|
X_train, X_test, y_train, y_test, metadata = sqx.datasets.generate_classification_data(
|
@@ -502,7 +501,7 @@ def create_dataset(dataset_type: str, samples: int, features: int, output: Optio
|
|
502
501
|
type=click.Path(),
|
503
502
|
help='Output file for plot'
|
504
503
|
)
|
505
|
-
def visualize(results_file: str, plot_type: str, output:
|
504
|
+
def visualize(results_file: str, plot_type: str, output: str | None):
|
506
505
|
"""Visualize algorithm results."""
|
507
506
|
# Load results
|
508
507
|
with open(results_file) as f:
|
superquantx/cli/main.py
CHANGED
@@ -6,7 +6,6 @@ with subcommands for various quantum machine learning operations.
|
|
6
6
|
|
7
7
|
import sys
|
8
8
|
from pathlib import Path
|
9
|
-
from typing import Optional
|
10
9
|
|
11
10
|
import click
|
12
11
|
|
@@ -38,12 +37,12 @@ from .commands import (
|
|
38
37
|
help='Enable verbose output'
|
39
38
|
)
|
40
39
|
@click.pass_context
|
41
|
-
def cli(ctx: click.Context, config:
|
40
|
+
def cli(ctx: click.Context, config: str | None, verbose: bool):
|
42
41
|
"""SuperQuantX: Building the Foundation for Quantum Agentic AI
|
43
|
-
|
42
|
+
|
44
43
|
Deploy quantum-enhanced autonomous agents and AI systems in minutes.
|
45
44
|
From quantum circuits to intelligent agents across all quantum platforms.
|
46
|
-
|
45
|
+
|
47
46
|
Examples:
|
48
47
|
sqx create-agent trading # Deploy quantum trading agent
|
49
48
|
sqx run automl --data portfolio # Quantum AutoML optimization
|
@@ -109,12 +108,12 @@ def shell():
|
|
109
108
|
banner = """
|
110
109
|
SuperQuantX Interactive Shell
|
111
110
|
=============================
|
112
|
-
|
111
|
+
|
113
112
|
Available imports:
|
114
113
|
- superquantx as sqx
|
115
114
|
- numpy as np
|
116
115
|
- matplotlib.pyplot as plt
|
117
|
-
|
116
|
+
|
118
117
|
Try: sqx.algorithms.QuantumSVM()
|
119
118
|
"""
|
120
119
|
|
superquantx/client.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"""
|
3
3
|
|
4
4
|
import asyncio
|
5
|
-
from typing import Any
|
5
|
+
from typing import Any
|
6
6
|
|
7
7
|
import httpx
|
8
8
|
from pydantic import BaseModel, Field
|
@@ -24,23 +24,23 @@ class QuantumJob(BaseModel):
|
|
24
24
|
job_id: str
|
25
25
|
status: str
|
26
26
|
created_at: str
|
27
|
-
circuit_id:
|
28
|
-
backend:
|
29
|
-
shots:
|
30
|
-
results:
|
31
|
-
error:
|
27
|
+
circuit_id: str | None = None
|
28
|
+
backend: str | None = None
|
29
|
+
shots: int | None = None
|
30
|
+
results: dict[str, Any] | None = None
|
31
|
+
error: str | None = None
|
32
32
|
|
33
33
|
|
34
34
|
class SuperQuantXClient:
|
35
35
|
"""Main client for interacting with the SuperQuantX platform
|
36
|
-
|
36
|
+
|
37
37
|
This client provides access to quantum computing resources, quantum algorithms,
|
38
38
|
and quantum machine learning capabilities through the SuperQuantX API.
|
39
39
|
"""
|
40
40
|
|
41
|
-
def __init__(self, config:
|
41
|
+
def __init__(self, config: SuperQuantXConfig | str | dict[str, Any]):
|
42
42
|
"""Initialize SuperQuantX client
|
43
|
-
|
43
|
+
|
44
44
|
Args:
|
45
45
|
config: Configuration object, API key string, or config dictionary
|
46
46
|
|
@@ -83,20 +83,20 @@ class SuperQuantXClient:
|
|
83
83
|
self,
|
84
84
|
method: str,
|
85
85
|
endpoint: str,
|
86
|
-
data:
|
87
|
-
params:
|
88
|
-
) ->
|
86
|
+
data: dict[str, Any] | None = None,
|
87
|
+
params: dict[str, Any] | None = None
|
88
|
+
) -> dict[str, Any]:
|
89
89
|
"""Make an authenticated request to the SuperQuantX API
|
90
|
-
|
90
|
+
|
91
91
|
Args:
|
92
92
|
method: HTTP method (GET, POST, etc.)
|
93
93
|
endpoint: API endpoint
|
94
94
|
data: Request body data
|
95
95
|
params: Query parameters
|
96
|
-
|
96
|
+
|
97
97
|
Returns:
|
98
98
|
Response data as dictionary
|
99
|
-
|
99
|
+
|
100
100
|
Raises:
|
101
101
|
httpx.HTTPError: If request fails
|
102
102
|
|
@@ -117,27 +117,27 @@ class SuperQuantXClient:
|
|
117
117
|
raise
|
118
118
|
await asyncio.sleep(2 ** attempt) # Exponential backoff
|
119
119
|
|
120
|
-
async def health_check(self) ->
|
120
|
+
async def health_check(self) -> dict[str, Any]:
|
121
121
|
"""Check API health and connectivity
|
122
|
-
|
122
|
+
|
123
123
|
Returns:
|
124
124
|
Health status information
|
125
125
|
|
126
126
|
"""
|
127
127
|
return await self._request("GET", "/health")
|
128
128
|
|
129
|
-
async def get_account_info(self) ->
|
129
|
+
async def get_account_info(self) -> dict[str, Any]:
|
130
130
|
"""Get account information and usage statistics
|
131
|
-
|
131
|
+
|
132
132
|
Returns:
|
133
133
|
Account information including quotas and usage
|
134
134
|
|
135
135
|
"""
|
136
136
|
return await self._request("GET", "/account")
|
137
137
|
|
138
|
-
async def list_backends(self) ->
|
138
|
+
async def list_backends(self) -> list[dict[str, Any]]:
|
139
139
|
"""List available quantum backends
|
140
|
-
|
140
|
+
|
141
141
|
Returns:
|
142
142
|
List of available backends with their specifications
|
143
143
|
|
@@ -145,12 +145,12 @@ class SuperQuantXClient:
|
|
145
145
|
response = await self._request("GET", "/backends")
|
146
146
|
return response.get("backends", [])
|
147
147
|
|
148
|
-
async def get_backend_info(self, backend_name: str) ->
|
148
|
+
async def get_backend_info(self, backend_name: str) -> dict[str, Any]:
|
149
149
|
"""Get detailed information about a specific backend
|
150
|
-
|
150
|
+
|
151
151
|
Args:
|
152
152
|
backend_name: Name of the backend
|
153
|
-
|
153
|
+
|
154
154
|
Returns:
|
155
155
|
Backend information including capabilities and status
|
156
156
|
|
@@ -159,21 +159,21 @@ class SuperQuantXClient:
|
|
159
159
|
|
160
160
|
async def submit_job(
|
161
161
|
self,
|
162
|
-
circuit_data:
|
162
|
+
circuit_data: dict[str, Any],
|
163
163
|
backend: str = "simulator",
|
164
164
|
shots: int = 1024,
|
165
165
|
optimization_level: int = 1,
|
166
166
|
**kwargs
|
167
167
|
) -> QuantumJob:
|
168
168
|
"""Submit a quantum circuit for execution
|
169
|
-
|
169
|
+
|
170
170
|
Args:
|
171
171
|
circuit_data: Quantum circuit representation
|
172
172
|
backend: Target backend for execution
|
173
173
|
shots: Number of measurement shots
|
174
174
|
optimization_level: Circuit optimization level (0-3)
|
175
175
|
**kwargs: Additional execution parameters
|
176
|
-
|
176
|
+
|
177
177
|
Returns:
|
178
178
|
QuantumJob object representing the submitted job
|
179
179
|
|
@@ -191,10 +191,10 @@ class SuperQuantXClient:
|
|
191
191
|
|
192
192
|
async def get_job(self, job_id: str) -> QuantumJob:
|
193
193
|
"""Get job information and results
|
194
|
-
|
194
|
+
|
195
195
|
Args:
|
196
196
|
job_id: Job identifier
|
197
|
-
|
197
|
+
|
198
198
|
Returns:
|
199
199
|
QuantumJob object with current status and results
|
200
200
|
|
@@ -202,12 +202,12 @@ class SuperQuantXClient:
|
|
202
202
|
response = await self._request("GET", f"/jobs/{job_id}")
|
203
203
|
return QuantumJob(**response)
|
204
204
|
|
205
|
-
async def cancel_job(self, job_id: str) ->
|
205
|
+
async def cancel_job(self, job_id: str) -> dict[str, Any]:
|
206
206
|
"""Cancel a running job
|
207
|
-
|
207
|
+
|
208
208
|
Args:
|
209
209
|
job_id: Job identifier
|
210
|
-
|
210
|
+
|
211
211
|
Returns:
|
212
212
|
Cancellation confirmation
|
213
213
|
|
@@ -217,16 +217,16 @@ class SuperQuantXClient:
|
|
217
217
|
async def list_jobs(
|
218
218
|
self,
|
219
219
|
limit: int = 100,
|
220
|
-
status:
|
221
|
-
backend:
|
222
|
-
) ->
|
220
|
+
status: str | None = None,
|
221
|
+
backend: str | None = None
|
222
|
+
) -> list[QuantumJob]:
|
223
223
|
"""List user's jobs with optional filtering
|
224
|
-
|
224
|
+
|
225
225
|
Args:
|
226
226
|
limit: Maximum number of jobs to return
|
227
227
|
status: Filter by job status
|
228
228
|
backend: Filter by backend
|
229
|
-
|
229
|
+
|
230
230
|
Returns:
|
231
231
|
List of QuantumJob objects
|
232
232
|
|
@@ -247,15 +247,15 @@ class SuperQuantXClient:
|
|
247
247
|
poll_interval: int = 5
|
248
248
|
) -> QuantumJob:
|
249
249
|
"""Wait for job completion with polling
|
250
|
-
|
250
|
+
|
251
251
|
Args:
|
252
252
|
job_id: Job identifier
|
253
253
|
timeout: Maximum wait time in seconds
|
254
254
|
poll_interval: Polling interval in seconds
|
255
|
-
|
255
|
+
|
256
256
|
Returns:
|
257
257
|
Completed QuantumJob object
|
258
|
-
|
258
|
+
|
259
259
|
Raises:
|
260
260
|
TimeoutError: If job doesn't complete within timeout
|
261
261
|
|
@@ -275,13 +275,13 @@ class SuperQuantXClient:
|
|
275
275
|
await asyncio.sleep(poll_interval)
|
276
276
|
|
277
277
|
# Synchronous wrappers for common operations
|
278
|
-
def health_check_sync(self) ->
|
278
|
+
def health_check_sync(self) -> dict[str, Any]:
|
279
279
|
"""Synchronous version of health_check"""
|
280
280
|
return asyncio.run(self.health_check())
|
281
281
|
|
282
282
|
def submit_job_sync(
|
283
283
|
self,
|
284
|
-
circuit_data:
|
284
|
+
circuit_data: dict[str, Any],
|
285
285
|
backend: str = "simulator",
|
286
286
|
shots: int = 1024,
|
287
287
|
**kwargs
|
superquantx/config.py
CHANGED
@@ -8,7 +8,7 @@ import json
|
|
8
8
|
import logging
|
9
9
|
import os
|
10
10
|
from pathlib import Path
|
11
|
-
from typing import Any
|
11
|
+
from typing import Any
|
12
12
|
|
13
13
|
import yaml
|
14
14
|
|
@@ -20,7 +20,7 @@ class Config:
|
|
20
20
|
|
21
21
|
def __init__(self) -> None:
|
22
22
|
"""Initialize configuration with defaults."""
|
23
|
-
self._config:
|
23
|
+
self._config: dict[str, Any] = {
|
24
24
|
# Backend configuration
|
25
25
|
"backends": {
|
26
26
|
"default": "auto",
|
@@ -160,9 +160,9 @@ class Config:
|
|
160
160
|
if value is not None:
|
161
161
|
self._set_nested_value(config_path, value)
|
162
162
|
|
163
|
-
def _merge_config(self, new_config:
|
163
|
+
def _merge_config(self, new_config: dict[str, Any]) -> None:
|
164
164
|
"""Merge new configuration with existing configuration."""
|
165
|
-
def merge_dicts(base:
|
165
|
+
def merge_dicts(base: dict, update: dict) -> dict:
|
166
166
|
for key, value in update.items():
|
167
167
|
if key in base and isinstance(base[key], dict) and isinstance(value, dict):
|
168
168
|
base[key] = merge_dicts(base[key], value)
|
@@ -215,11 +215,11 @@ class Config:
|
|
215
215
|
|
216
216
|
current[keys[-1]] = value
|
217
217
|
|
218
|
-
def update(self, updates:
|
218
|
+
def update(self, updates: dict[str, Any]) -> None:
|
219
219
|
"""Update configuration with a dictionary of values."""
|
220
220
|
self._merge_config(updates)
|
221
221
|
|
222
|
-
def save(self, path:
|
222
|
+
def save(self, path: str | Path | None = None) -> None:
|
223
223
|
"""Save current configuration to file."""
|
224
224
|
if path is None:
|
225
225
|
path = Path.home() / ".superquantx" / "config.yaml"
|
@@ -240,7 +240,7 @@ class Config:
|
|
240
240
|
"""Reset configuration to defaults."""
|
241
241
|
self.__init__()
|
242
242
|
|
243
|
-
def to_dict(self) ->
|
243
|
+
def to_dict(self) -> dict[str, Any]:
|
244
244
|
"""Get configuration as dictionary."""
|
245
245
|
return self._config.copy()
|
246
246
|
|
@@ -258,13 +258,13 @@ class Config:
|
|
258
258
|
config = Config()
|
259
259
|
|
260
260
|
def configure(
|
261
|
-
backend:
|
262
|
-
shots:
|
263
|
-
debug:
|
261
|
+
backend: str | None = None,
|
262
|
+
shots: int | None = None,
|
263
|
+
debug: bool | None = None,
|
264
264
|
**kwargs
|
265
265
|
) -> None:
|
266
266
|
"""Configure SuperQuantX settings.
|
267
|
-
|
267
|
+
|
268
268
|
Args:
|
269
269
|
backend: Default backend to use
|
270
270
|
shots: Default number of shots for quantum circuits
|
@@ -310,12 +310,12 @@ def setup_logging() -> None:
|
|
310
310
|
force=True,
|
311
311
|
)
|
312
312
|
|
313
|
-
def get_platform_config(platform: str) ->
|
313
|
+
def get_platform_config(platform: str) -> dict[str, Any]:
|
314
314
|
"""Get configuration for a specific platform.
|
315
|
-
|
315
|
+
|
316
316
|
Args:
|
317
317
|
platform: Platform name (e.g., 'ibm', 'braket', 'azure')
|
318
|
-
|
318
|
+
|
319
319
|
Returns:
|
320
320
|
Platform configuration dictionary
|
321
321
|
|
@@ -0,0 +1,58 @@
|
|
1
|
+
"""SuperQuantX Datasets Module.
|
2
|
+
|
3
|
+
This module provides datasets and data loading utilities for quantum machine learning.
|
4
|
+
It includes quantum-specific datasets, classical datasets adapted for quantum computing,
|
5
|
+
and synthetic data generators for testing quantum algorithms.
|
6
|
+
"""
|
7
|
+
|
8
|
+
from .molecular import (
|
9
|
+
load_beh2_molecule,
|
10
|
+
load_h2_molecule,
|
11
|
+
load_lih_molecule,
|
12
|
+
load_molecule,
|
13
|
+
)
|
14
|
+
from .preprocessing import (
|
15
|
+
AmplitudeEncoder,
|
16
|
+
AngleEncoder,
|
17
|
+
QuantumFeatureEncoder,
|
18
|
+
normalize_quantum_data,
|
19
|
+
)
|
20
|
+
from .quantum_datasets import (
|
21
|
+
load_breast_cancer_quantum,
|
22
|
+
load_digits_quantum,
|
23
|
+
load_iris_quantum,
|
24
|
+
load_wine_quantum,
|
25
|
+
)
|
26
|
+
from .synthetic import (
|
27
|
+
generate_classification_data,
|
28
|
+
generate_clustering_data,
|
29
|
+
generate_portfolio_data,
|
30
|
+
generate_regression_data,
|
31
|
+
)
|
32
|
+
|
33
|
+
|
34
|
+
__all__ = [
|
35
|
+
# Quantum datasets
|
36
|
+
"load_iris_quantum",
|
37
|
+
"load_wine_quantum",
|
38
|
+
"load_digits_quantum",
|
39
|
+
"load_breast_cancer_quantum",
|
40
|
+
|
41
|
+
# Synthetic data generators
|
42
|
+
"generate_classification_data",
|
43
|
+
"generate_regression_data",
|
44
|
+
"generate_clustering_data",
|
45
|
+
"generate_portfolio_data",
|
46
|
+
|
47
|
+
# Molecular datasets
|
48
|
+
"load_molecule",
|
49
|
+
"load_h2_molecule",
|
50
|
+
"load_lih_molecule",
|
51
|
+
"load_beh2_molecule",
|
52
|
+
|
53
|
+
# Preprocessing utilities
|
54
|
+
"QuantumFeatureEncoder",
|
55
|
+
"AmplitudeEncoder",
|
56
|
+
"AngleEncoder",
|
57
|
+
"normalize_quantum_data",
|
58
|
+
]
|