quanta-sdk 0.4.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.
- quanta_sdk-0.4.0/.github/workflows/publish.yml +48 -0
- quanta_sdk-0.4.0/.github/workflows/tests.yml +30 -0
- quanta_sdk-0.4.0/.gitignore +36 -0
- quanta_sdk-0.4.0/CHANGELOG.md +99 -0
- quanta_sdk-0.4.0/LICENSE +120 -0
- quanta_sdk-0.4.0/PKG-INFO +320 -0
- quanta_sdk-0.4.0/README.md +283 -0
- quanta_sdk-0.4.0/docs/ARCHITECTURE_EN.md +154 -0
- quanta_sdk-0.4.0/docs/ARCHITECTURE_TR.md +154 -0
- quanta_sdk-0.4.0/docs/COMPARISON_EN.md +124 -0
- quanta_sdk-0.4.0/docs/COMPARISON_TR.md +90 -0
- quanta_sdk-0.4.0/docs/FEATURES_EN.md +139 -0
- quanta_sdk-0.4.0/docs/FEATURES_TR.md +138 -0
- quanta_sdk-0.4.0/docs/INSTALL_TR.md +155 -0
- quanta_sdk-0.4.0/docs/LOADTEST_TR.md +51 -0
- quanta_sdk-0.4.0/docs/README_EN.md +63 -0
- quanta_sdk-0.4.0/docs/README_TR.md +63 -0
- quanta_sdk-0.4.0/pyproject.toml +72 -0
- quanta_sdk-0.4.0/quanta/__init__.py +46 -0
- quanta_sdk-0.4.0/quanta/backends/__init__.py +1 -0
- quanta_sdk-0.4.0/quanta/backends/base.py +56 -0
- quanta_sdk-0.4.0/quanta/backends/google.py +222 -0
- quanta_sdk-0.4.0/quanta/backends/local.py +82 -0
- quanta_sdk-0.4.0/quanta/benchmark/__init__.py +6 -0
- quanta_sdk-0.4.0/quanta/benchmark/benchpress_adapter.py +200 -0
- quanta_sdk-0.4.0/quanta/benchmark/qasmbench.py +521 -0
- quanta_sdk-0.4.0/quanta/compiler/__init__.py +1 -0
- quanta_sdk-0.4.0/quanta/compiler/passes/__init__.py +1 -0
- quanta_sdk-0.4.0/quanta/compiler/passes/optimize.py +199 -0
- quanta_sdk-0.4.0/quanta/compiler/passes/routing.py +180 -0
- quanta_sdk-0.4.0/quanta/compiler/passes/translate.py +164 -0
- quanta_sdk-0.4.0/quanta/compiler/pipeline.py +119 -0
- quanta_sdk-0.4.0/quanta/core/__init__.py +1 -0
- quanta_sdk-0.4.0/quanta/core/circuit.py +151 -0
- quanta_sdk-0.4.0/quanta/core/custom_gate.py +122 -0
- quanta_sdk-0.4.0/quanta/core/equivalence.py +121 -0
- quanta_sdk-0.4.0/quanta/core/gates.py +264 -0
- quanta_sdk-0.4.0/quanta/core/measure.py +54 -0
- quanta_sdk-0.4.0/quanta/core/types.py +162 -0
- quanta_sdk-0.4.0/quanta/dag/__init__.py +1 -0
- quanta_sdk-0.4.0/quanta/dag/dag_circuit.py +199 -0
- quanta_sdk-0.4.0/quanta/dag/node.py +62 -0
- quanta_sdk-0.4.0/quanta/examples/01_bell_state.py +29 -0
- quanta_sdk-0.4.0/quanta/examples/02_ghz_state.py +28 -0
- quanta_sdk-0.4.0/quanta/examples/03_teleportation.py +39 -0
- quanta_sdk-0.4.0/quanta/examples/04_deutsch_jozsa.py +61 -0
- quanta_sdk-0.4.0/quanta/examples/05_grover.py +81 -0
- quanta_sdk-0.4.0/quanta/examples/06_molecule_energy.py +99 -0
- quanta_sdk-0.4.0/quanta/examples/07_portfolio_optimization.py +83 -0
- quanta_sdk-0.4.0/quanta/examples/08_qkd_bb84.py +141 -0
- quanta_sdk-0.4.0/quanta/examples/09_full_demo.py +123 -0
- quanta_sdk-0.4.0/quanta/examples/10_quantum_benchmark.py +263 -0
- quanta_sdk-0.4.0/quanta/examples/11_entity_resolution.py +223 -0
- quanta_sdk-0.4.0/quanta/examples/__init__.py +0 -0
- quanta_sdk-0.4.0/quanta/export/__init__.py +1 -0
- quanta_sdk-0.4.0/quanta/export/qasm.py +135 -0
- quanta_sdk-0.4.0/quanta/export/qasm_import.py +201 -0
- quanta_sdk-0.4.0/quanta/layer3/__init__.py +3 -0
- quanta_sdk-0.4.0/quanta/layer3/agent.py +215 -0
- quanta_sdk-0.4.0/quanta/layer3/entity_resolution.py +688 -0
- quanta_sdk-0.4.0/quanta/layer3/finance.py +228 -0
- quanta_sdk-0.4.0/quanta/layer3/hamiltonian.py +234 -0
- quanta_sdk-0.4.0/quanta/layer3/optimize.py +161 -0
- quanta_sdk-0.4.0/quanta/layer3/qsvm.py +198 -0
- quanta_sdk-0.4.0/quanta/layer3/search.py +117 -0
- quanta_sdk-0.4.0/quanta/layer3/shor.py +215 -0
- quanta_sdk-0.4.0/quanta/layer3/vqe.py +233 -0
- quanta_sdk-0.4.0/quanta/qec/__init__.py +1 -0
- quanta_sdk-0.4.0/quanta/qec/codes.py +193 -0
- quanta_sdk-0.4.0/quanta/qec/surface_code.py +202 -0
- quanta_sdk-0.4.0/quanta/result.py +182 -0
- quanta_sdk-0.4.0/quanta/runner.py +179 -0
- quanta_sdk-0.4.0/quanta/simulator/__init__.py +1 -0
- quanta_sdk-0.4.0/quanta/simulator/accelerated.py +198 -0
- quanta_sdk-0.4.0/quanta/simulator/density_matrix.py +184 -0
- quanta_sdk-0.4.0/quanta/simulator/noise.py +201 -0
- quanta_sdk-0.4.0/quanta/simulator/statevector.py +162 -0
- quanta_sdk-0.4.0/quanta/visualize.py +166 -0
- quanta_sdk-0.4.0/quanta/visualize_state.py +141 -0
- quanta_sdk-0.4.0/tests/__init__.py +0 -0
- quanta_sdk-0.4.0/tests/conftest.py +43 -0
- quanta_sdk-0.4.0/tests/test_compiler.py +209 -0
- quanta_sdk-0.4.0/tests/test_core.py +198 -0
- quanta_sdk-0.4.0/tests/test_extras.py +304 -0
- quanta_sdk-0.4.0/tests/test_layer3.py +387 -0
- quanta_sdk-0.4.0/tests/test_qasm_import.py +185 -0
- quanta_sdk-0.4.0/tests/test_qec_surface.py +78 -0
- quanta_sdk-0.4.0/tests/test_simulator.py +260 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
|
|
13
|
+
- name: Set up Python
|
|
14
|
+
uses: actions/setup-python@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.12"
|
|
17
|
+
|
|
18
|
+
- name: Install build tools
|
|
19
|
+
run: pip install build
|
|
20
|
+
|
|
21
|
+
- name: Build package
|
|
22
|
+
run: python -m build
|
|
23
|
+
|
|
24
|
+
- name: Upload artifact
|
|
25
|
+
uses: actions/upload-artifact@v4
|
|
26
|
+
with:
|
|
27
|
+
name: dist
|
|
28
|
+
path: dist/
|
|
29
|
+
|
|
30
|
+
publish:
|
|
31
|
+
needs: build
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
environment: pypi
|
|
34
|
+
permissions:
|
|
35
|
+
id-token: write
|
|
36
|
+
contents: read
|
|
37
|
+
|
|
38
|
+
steps:
|
|
39
|
+
- name: Download artifact
|
|
40
|
+
uses: actions/download-artifact@v4
|
|
41
|
+
with:
|
|
42
|
+
name: dist
|
|
43
|
+
path: dist/
|
|
44
|
+
|
|
45
|
+
- name: Publish to PyPI
|
|
46
|
+
uses: pypa/gh-action-pypi-publish@v1.12.4
|
|
47
|
+
with:
|
|
48
|
+
attestations: false
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: pytest --tb=short -q
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg-info/
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
*.egg
|
|
10
|
+
.eggs/
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
venv/
|
|
14
|
+
env/
|
|
15
|
+
.venv/
|
|
16
|
+
|
|
17
|
+
# IDE
|
|
18
|
+
.idea/
|
|
19
|
+
.vscode/
|
|
20
|
+
*.swp
|
|
21
|
+
*.swo
|
|
22
|
+
*~
|
|
23
|
+
|
|
24
|
+
# OS
|
|
25
|
+
.DS_Store
|
|
26
|
+
Thumbs.db
|
|
27
|
+
|
|
28
|
+
# Test / Coverage
|
|
29
|
+
.pytest_cache/
|
|
30
|
+
htmlcov/
|
|
31
|
+
.coverage
|
|
32
|
+
.tox/
|
|
33
|
+
|
|
34
|
+
# Distribution
|
|
35
|
+
*.whl
|
|
36
|
+
*.tar.gz
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Quanta SDK.
|
|
4
|
+
|
|
5
|
+
Format: [Semantic Versioning](https://semver.org/)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## [v0.4.0] - 2026-03-06
|
|
10
|
+
|
|
11
|
+
### Added — Real-World Applications
|
|
12
|
+
- **VQE**: Variational Quantum Eigensolver (`layer3/vqe.py`)
|
|
13
|
+
- Hardware-efficient ansatz, parameter-shift gradients
|
|
14
|
+
- H2: 100.00% accuracy, HeH+: 99.99% accuracy
|
|
15
|
+
- **Shor's Algorithm**: Integer factoring (`layer3/shor.py`)
|
|
16
|
+
- QFT-based period finding, continued fractions
|
|
17
|
+
- 15 = 3 × 5 verified
|
|
18
|
+
- **QSVM**: Quantum Support Vector Machine (`layer3/qsvm.py`)
|
|
19
|
+
- ZZFeatureMap kernel, quantum-enhanced classification
|
|
20
|
+
- 100% accuracy on linearly separable data
|
|
21
|
+
- **Hamiltonian Simulation**: (`layer3/hamiltonian.py`)
|
|
22
|
+
- Trotterized time evolution
|
|
23
|
+
- Pre-defined molecules: H2, LiH, HeH+
|
|
24
|
+
- **Portfolio Optimization**: (`layer3/finance.py`)
|
|
25
|
+
- Markowitz mean-variance → QUBO, QAOA-inspired selection
|
|
26
|
+
- Conservative vs aggressive profiles, Sharpe ratio
|
|
27
|
+
- **Surface Code**: (`qec/surface_code.py`)
|
|
28
|
+
- [[d²,1,d]] logical qubits, error correction simulation
|
|
29
|
+
- Threshold ~1%, error suppression verified
|
|
30
|
+
- **BB84 QKD Protocol**: Quantum key distribution (`examples/08_qkd_bb84.py`)
|
|
31
|
+
- Eavesdropper detection via ~25% error rate
|
|
32
|
+
|
|
33
|
+
### Added — Benchmark Infrastructure
|
|
34
|
+
- **QASM Import**: (`export/qasm_import.py`)
|
|
35
|
+
- Full QASM 2.0/3.0 → DAG parser
|
|
36
|
+
- Registers, parametric gates, pi expressions
|
|
37
|
+
- **QASMBench Suite**: (`benchmark/qasmbench.py`)
|
|
38
|
+
- 10 standard circuits: bell, ghz, qft, teleportation, deutsch-jozsa, grover, adder, vqe_ansatz, swap_test, random_10
|
|
39
|
+
- Full pipeline benchmark: import → compile → simulate → metrics
|
|
40
|
+
- 10/10 circuits pass
|
|
41
|
+
- **Benchpress Adapter**: (`benchmark/benchpress_adapter.py`)
|
|
42
|
+
- `QuantaBenchpressBackend` compatible with Nation et al. framework
|
|
43
|
+
- new_circuit, apply_gate, optimize, export_qasm, simulate
|
|
44
|
+
|
|
45
|
+
### Added — Demo Cases
|
|
46
|
+
- `06_molecule_energy.py` — H2 + HeH+ ground state (VQE)
|
|
47
|
+
- `07_portfolio_optimization.py` — Tech stocks + crypto portfolio
|
|
48
|
+
- `08_qkd_bb84.py` — Quantum Key Distribution
|
|
49
|
+
- `09_full_demo.py` — All features in one script
|
|
50
|
+
- `10_quantum_benchmark.py` — 8-test quality litmus test
|
|
51
|
+
|
|
52
|
+
### Tests
|
|
53
|
+
- 52 new test cases → **150 total** (was 98)
|
|
54
|
+
- `test_layer3_new.py`: VQE, Shor, QSVM, finance, hamiltonian
|
|
55
|
+
- `test_qec_surface.py`: Surface code parameters, error correction
|
|
56
|
+
- `test_qasm_import.py`: QASM parsing, round-trip, QASMBench, Benchpress
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## [v0.3.0] - 2026-03-06
|
|
61
|
+
|
|
62
|
+
### Added — Structural Improvements
|
|
63
|
+
- Custom gates: `custom_gate("name", matrix)`
|
|
64
|
+
- Density matrix simulator: mixed states + Kraus noise
|
|
65
|
+
- Qubit routing: linear/ring/grid topology, SWAP insertion
|
|
66
|
+
- Accelerated backend: JAX/CuPy GPU (auto-detect, NumPy fallback)
|
|
67
|
+
- Parameter sweep: `sweep(circuit, params={...})`
|
|
68
|
+
- Cirq-style display: `print(result)`, `dirac_notation()`, `histogram()`
|
|
69
|
+
- 27-qubit support (100.3s, 2GB)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## [v0.2.0] - 2026-03-06
|
|
74
|
+
|
|
75
|
+
### Added — Performance
|
|
76
|
+
- Tensor contraction simulator: O(2^n) replacing O(4^n)
|
|
77
|
+
- Google Quantum Engine backend (QASM bridge)
|
|
78
|
+
- Load test + installation documentation
|
|
79
|
+
|
|
80
|
+
### Performance
|
|
81
|
+
| Qubits | v0.1 | v0.2 | Speedup |
|
|
82
|
+
|--------|------|------|---------|
|
|
83
|
+
| 12 | 1.785s | 0.003s | 685x |
|
|
84
|
+
| 20 | impossible | 0.073s | ∞ |
|
|
85
|
+
| 27 | impossible | 100.3s | ∞ |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## [v0.1.0] - 2026-03-03
|
|
90
|
+
|
|
91
|
+
### Added — Foundation
|
|
92
|
+
- Core: 17 gates, circuit decorator, measurement
|
|
93
|
+
- DAG: Directed acyclic graph representation
|
|
94
|
+
- Compiler: 3-pass optimization pipeline
|
|
95
|
+
- Simulator: Statevector (Kronecker)
|
|
96
|
+
- Layer 3: Grover, QAOA, multi-agent
|
|
97
|
+
- QEC: Bit-flip, phase-flip, Steane codes
|
|
98
|
+
- Export: OpenQASM 3.0
|
|
99
|
+
- 98 unit tests
|
quanta_sdk-0.4.0/LICENSE
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the copyright owner or its representatives.
|
|
52
|
+
|
|
53
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
54
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
55
|
+
subsequently incorporated within the Work.
|
|
56
|
+
|
|
57
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
58
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
59
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
60
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
61
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
62
|
+
Work and such Derivative Works in Source or Object form.
|
|
63
|
+
|
|
64
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
65
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
66
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
67
|
+
(except as stated in this section) patent license to make, have made,
|
|
68
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
69
|
+
where such license applies only to those patent claims licensable
|
|
70
|
+
by such Contributor that are necessarily infringed by their
|
|
71
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
72
|
+
with the Work to which such Contribution(s) was submitted.
|
|
73
|
+
|
|
74
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
75
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
76
|
+
modifications, and in Source or Object form, provided that You
|
|
77
|
+
meet the following conditions:
|
|
78
|
+
|
|
79
|
+
(a) You must give any other recipients of the Work or
|
|
80
|
+
Derivative Works a copy of this License; and
|
|
81
|
+
|
|
82
|
+
(b) You must cause any modified files to carry prominent notices
|
|
83
|
+
stating that You changed the files; and
|
|
84
|
+
|
|
85
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
86
|
+
that You distribute, all copyright, patent, trademark, and
|
|
87
|
+
attribution notices from the Source form of the Work; and
|
|
88
|
+
|
|
89
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
90
|
+
distribution, then any Derivative Works that You distribute must
|
|
91
|
+
include a readable copy of the attribution notices contained
|
|
92
|
+
within such NOTICE file.
|
|
93
|
+
|
|
94
|
+
5. Submission of Contributions.
|
|
95
|
+
|
|
96
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
97
|
+
names, trademarks, service marks, or product names of the Licensor.
|
|
98
|
+
|
|
99
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
100
|
+
agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
|
|
101
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
|
|
102
|
+
|
|
103
|
+
8. Limitation of Liability. In no event shall any Contributor be
|
|
104
|
+
liable for any damages arising from the use of this Work.
|
|
105
|
+
|
|
106
|
+
9. Accepting Warranty or Additional Liability.
|
|
107
|
+
|
|
108
|
+
Copyright 2026 Abdullah Enes SARI / ONMARTECH
|
|
109
|
+
|
|
110
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
111
|
+
you may not use this file except in compliance with the License.
|
|
112
|
+
You may obtain a copy of the License at
|
|
113
|
+
|
|
114
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
115
|
+
|
|
116
|
+
Unless required by applicable law or agreed to in writing, software
|
|
117
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
118
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
|
+
See the License for the specific language governing permissions and
|
|
120
|
+
limitations under the License.
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quanta-sdk
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Multi-paradigm quantum computing SDK — Grover, QAOA, VQE, Shor, QSVM, surface code, entity resolution
|
|
5
|
+
Project-URL: Homepage, https://github.com/ONMARTECH/quanta-sdk
|
|
6
|
+
Project-URL: Repository, https://github.com/ONMARTECH/quanta-sdk
|
|
7
|
+
Project-URL: Issues, https://github.com/ONMARTECH/quanta-sdk/issues
|
|
8
|
+
Project-URL: Documentation, https://github.com/ONMARTECH/quanta-sdk/tree/main/docs
|
|
9
|
+
Author-email: Abdullah Enes SARI <info@onmartech.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: entity-resolution,grover,qaoa,qasm,qiskit-alternative,qsvm,quantum,quantum-computing,shor,simulator,surface-code,vqe
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Requires-Dist: numpy>=1.24
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: hypothesis; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
33
|
+
Provides-Extra: gpu
|
|
34
|
+
Requires-Dist: cupy-cuda12x; extra == 'gpu'
|
|
35
|
+
Requires-Dist: jax[cuda12]; extra == 'gpu'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
<p align="center">
|
|
39
|
+
<h1 align="center">Quanta SDK</h1>
|
|
40
|
+
<p align="center">
|
|
41
|
+
<strong>Multi-paradigm quantum computing SDK for Python</strong>
|
|
42
|
+
</p>
|
|
43
|
+
<p align="center">
|
|
44
|
+
<a href="https://github.com/ONMARTECH/quanta-sdk/releases"><img src="https://img.shields.io/badge/version-0.4.0-blue.svg" alt="Version"></a>
|
|
45
|
+
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.10%2B-brightgreen.svg" alt="Python"></a>
|
|
46
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-orange.svg" alt="License"></a>
|
|
47
|
+
<a href="#quality-benchmark"><img src="https://img.shields.io/badge/tests-150%2B%20passed-success.svg" alt="Tests"></a>
|
|
48
|
+
<a href="#quality-benchmark"><img src="https://img.shields.io/badge/benchmark-8%2F8-gold.svg" alt="Benchmark"></a>
|
|
49
|
+
<a href="#qasmbench"><img src="https://img.shields.io/badge/QASMBench-10%2F10-success.svg" alt="QASMBench"></a>
|
|
50
|
+
<a href="https://github.com/ONMARTECH/quanta-sdk"><img src="https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-lightgrey.svg" alt="Platform"></a>
|
|
51
|
+
</p>
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
Quanta is a clean, modular quantum computing SDK designed for researchers, engineers and developers. It provides a 3-layer abstraction — from high-level declarative APIs (`search()`, `factor()`) to low-level DAG manipulation and QASM export — so you can work at the level that fits your problem.
|
|
57
|
+
|
|
58
|
+
**Key highlights:**
|
|
59
|
+
- Shor, VQE, QAOA, QSVM, Grover — production-grade quantum algorithms
|
|
60
|
+
- DAG-based IR with 3-pass compiler and topology-aware qubit routing
|
|
61
|
+
- Statevector simulator up to 27 qubits with optional JAX/CuPy GPU acceleration
|
|
62
|
+
- Surface code QEC, BB84 QKD, and error correction primitives
|
|
63
|
+
- Real-world demo: [quantum entity resolution](#11-entity-resolution) for customer deduplication
|
|
64
|
+
|
|
65
|
+
## Table of Contents
|
|
66
|
+
|
|
67
|
+
- [Quick Start](#quick-start)
|
|
68
|
+
- [Architecture](#architecture)
|
|
69
|
+
- [Features](#features)
|
|
70
|
+
- [Algorithms](#algorithms)
|
|
71
|
+
- [Examples & Use Cases](#examples--use-cases)
|
|
72
|
+
- [Quality Benchmark](#quality-benchmark)
|
|
73
|
+
- [Installation](#installation)
|
|
74
|
+
- [Documentation](#documentation)
|
|
75
|
+
- [Author](#author)
|
|
76
|
+
- [License](#license)
|
|
77
|
+
|
|
78
|
+
## Quick Start
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from quanta import circuit, H, CX, measure, run
|
|
82
|
+
|
|
83
|
+
@circuit(qubits=2)
|
|
84
|
+
def bell(q):
|
|
85
|
+
H(q[0])
|
|
86
|
+
CX(q[0], q[1])
|
|
87
|
+
return measure(q)
|
|
88
|
+
|
|
89
|
+
result = run(bell, shots=1024)
|
|
90
|
+
print(result)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
╔══════════════════════════════════════════════════╗
|
|
95
|
+
║ Quanta Result: bell ║
|
|
96
|
+
╠──────────────────────────────────────────────────╣
|
|
97
|
+
║ |00> ████████████████████ 50.5% ║
|
|
98
|
+
║ |11> ███████████████████ 49.5% ║
|
|
99
|
+
╠──────────────────────────────────────────────────╣
|
|
100
|
+
║ 0.71|00> + 0.71|11> ║
|
|
101
|
+
╚══════════════════════════════════════════════════╝
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Architecture
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
┌──────────────────────────────────────────────────────────┐
|
|
108
|
+
│ Layer 3 — Declarative API │
|
|
109
|
+
│ search() · optimize() · vqe() · factor() · qsvm() │
|
|
110
|
+
│ portfolio_optimize() · resolve() · multi_agent() │
|
|
111
|
+
├──────────────────────────────────────────────────────────┤
|
|
112
|
+
│ Layer 2 — Circuit API │
|
|
113
|
+
│ @circuit · H · CX · RZ · measure · run · sweep │
|
|
114
|
+
│ custom_gate() · 17 built-in gates │
|
|
115
|
+
├──────────────────────────────────────────────────────────┤
|
|
116
|
+
│ Layer 1 — Physical Layer │
|
|
117
|
+
│ DAG IR · 3-pass compiler · qubit routing · QASM I/O │
|
|
118
|
+
│ statevector · density matrix · JAX/CuPy acceleration │
|
|
119
|
+
└──────────────────────────────────────────────────────────┘
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Features
|
|
123
|
+
|
|
124
|
+
### Core
|
|
125
|
+
- **17 built-in gates** — H, X, Y, Z, CX, CCX, SWAP, RX, RY, RZ, S, T, and more
|
|
126
|
+
- **`custom_gate(name, matrix)`** — define your own unitary gates
|
|
127
|
+
- **`@circuit` decorator** — write quantum circuits as Python functions
|
|
128
|
+
- **`sweep(circuit, params)`** — parameter scans for variational algorithms
|
|
129
|
+
|
|
130
|
+
### Compiler & IR
|
|
131
|
+
- **DAG-based intermediate representation** — directed acyclic graph for circuit analysis
|
|
132
|
+
- **3-pass optimizer** — gate cancellation, gate merging, basis translation
|
|
133
|
+
- **Topology-aware routing** — SWAP insertion for linear, ring, and grid topologies
|
|
134
|
+
- **QASM 2.0/3.0** — import external circuits and export for cross-SDK interop
|
|
135
|
+
|
|
136
|
+
### Simulators
|
|
137
|
+
- **Statevector** — tensor contraction engine, up to **27 qubits** (100s, 2GB)
|
|
138
|
+
- **Density matrix** — mixed states + Kraus noise channels, up to 13 qubits
|
|
139
|
+
- **Accelerated backend** — auto-detects JAX-GPU / CuPy; falls back to NumPy on CPU
|
|
140
|
+
|
|
141
|
+
### Error Correction
|
|
142
|
+
- Bit-flip, Phase-flip, **Steane [[7,1,3]]** codes
|
|
143
|
+
- **Surface code [[d²,1,d]]** — logical qubits with configurable distance, threshold ~1%
|
|
144
|
+
|
|
145
|
+
### Security
|
|
146
|
+
- **BB84 QKD** — quantum key distribution with eavesdropper detection ([Example →](#08-qkd-bb84))
|
|
147
|
+
|
|
148
|
+
## Algorithms
|
|
149
|
+
|
|
150
|
+
| Algorithm | Module | Use Case | Example |
|
|
151
|
+
|-----------|--------|----------|---------|
|
|
152
|
+
| **Grover** | `layer3.search` | Unstructured search (√N speedup) | [05 →](#05-grover-search) |
|
|
153
|
+
| **QAOA** | `layer3.optimize` | Combinatorial optimization | [07 →](#07-portfolio-optimization) |
|
|
154
|
+
| **VQE** | `layer3.vqe` | Molecular ground-state energy | [06 →](#06-molecular-energy) |
|
|
155
|
+
| **Shor** | `layer3.shor` | Integer factoring (RSA) | [10 →](#10-quantum-benchmark) |
|
|
156
|
+
| **QSVM** | `layer3.qsvm` | Quantum kernel classification | [10 →](#10-quantum-benchmark) |
|
|
157
|
+
| **Multi-Agent** | `layer3.agent` | Quantum agent-based modeling | [09 →](#09-full-demo) |
|
|
158
|
+
| **Portfolio** | `layer3.finance` | Financial portfolio optimization | [07 →](#07-portfolio-optimization) |
|
|
159
|
+
| **Hamiltonian** | `layer3.hamiltonian` | Molecular simulation (H₂, LiH, HeH⁺) | [06 →](#06-molecular-energy) |
|
|
160
|
+
| **Entity Resolution** | `layer3.entity_resolution` | Customer deduplication (QAOA) | [11 →](#11-entity-resolution) |
|
|
161
|
+
|
|
162
|
+
## Examples & Use Cases
|
|
163
|
+
|
|
164
|
+
Run any example with `python -m quanta.examples.<name>`:
|
|
165
|
+
|
|
166
|
+
### 01 Bell State
|
|
167
|
+
EPR pair — the simplest entanglement demonstration.
|
|
168
|
+
```bash
|
|
169
|
+
python -m quanta.examples.01_bell_state
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 02 GHZ State
|
|
173
|
+
Multi-qubit entanglement: all-or-nothing correlations.
|
|
174
|
+
```bash
|
|
175
|
+
python -m quanta.examples.02_ghz_state
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### 03 Quantum Teleportation
|
|
179
|
+
Transfer an unknown quantum state using entanglement + classical bits.
|
|
180
|
+
```bash
|
|
181
|
+
python -m quanta.examples.03_teleportation
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### 04 Deutsch-Jozsa
|
|
185
|
+
Determine if a function is constant or balanced in one query.
|
|
186
|
+
```bash
|
|
187
|
+
python -m quanta.examples.04_deutsch_jozsa
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### 05 Grover Search
|
|
191
|
+
Quadratic speedup for unstructured search — finds target with 99.9% probability.
|
|
192
|
+
```bash
|
|
193
|
+
python -m quanta.examples.05_grover
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 06 Molecular Energy
|
|
197
|
+
H₂ and HeH⁺ ground state via VQE + Hamiltonian time evolution.
|
|
198
|
+
```bash
|
|
199
|
+
python -m quanta.examples.06_molecule_energy
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 07 Portfolio Optimization
|
|
203
|
+
Quantum-optimized stock portfolios — tech vs crypto, conservative vs aggressive.
|
|
204
|
+
```bash
|
|
205
|
+
python -m quanta.examples.07_portfolio_optimization
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### 08 QKD BB84
|
|
209
|
+
Quantum key distribution — detect eavesdroppers via ~25% error rate.
|
|
210
|
+
```bash
|
|
211
|
+
python -m quanta.examples.08_qkd_bb84
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### 09 Full Demo
|
|
215
|
+
All SDK features in one script — circuits, custom gates, VQE, Grover, noise, routing, QASM.
|
|
216
|
+
```bash
|
|
217
|
+
python -m quanta.examples.09_full_demo
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### 10 Quantum Benchmark
|
|
221
|
+
8-test quality litmus test — Bell fidelity, CHSH, teleportation, Grover, VQE, Shor, QSVM, surface code.
|
|
222
|
+
```bash
|
|
223
|
+
python -m quanta.examples.10_quantum_benchmark
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### 11 Entity Resolution
|
|
227
|
+
**Real-world use case:** OTA customer deduplication with QAOA vs classical greedy.
|
|
228
|
+
25 records, 8 columns, Turkish name handling, 3-layer blocking pipeline.
|
|
229
|
+
**Result:** QAOA 86% accuracy vs Greedy 64%.
|
|
230
|
+
```bash
|
|
231
|
+
python -m quanta.examples.11_entity_resolution
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Quality Benchmark
|
|
235
|
+
|
|
236
|
+
### Turnusol Test — 8/8 🏆
|
|
237
|
+
|
|
238
|
+
| # | Test | Result | Metric |
|
|
239
|
+
|---|------|--------|--------|
|
|
240
|
+
| 1 | Bell State Fidelity | ✅ | F = 1.0000 |
|
|
241
|
+
| 2 | CHSH Inequality | ✅ | S = 2.8284 (Tsirelson bound) |
|
|
242
|
+
| 3 | Quantum Teleportation | ✅ | Unitarity preserved |
|
|
243
|
+
| 4 | Grover Amplification | ✅ | 99.9% target probability |
|
|
244
|
+
| 5 | VQE Convergence (H₂) | ✅ | 0.000054 Ha error |
|
|
245
|
+
| 6 | Shor Factoring | ✅ | 15 = 3 × 5 |
|
|
246
|
+
| 7 | QSVM Classification | ✅ | 100% accuracy |
|
|
247
|
+
| 8 | Surface Code QEC | ✅ | 0% logical error rate |
|
|
248
|
+
|
|
249
|
+
### QASMBench — 10/10
|
|
250
|
+
|
|
251
|
+
All standard QASMBench circuits import, compile, and simulate correctly:
|
|
252
|
+
`bell` · `ghz` · `qft` · `teleportation` · `deutsch-jozsa` · `grover` · `adder` · `vqe_ansatz` · `swap_test` · `random`
|
|
253
|
+
|
|
254
|
+
Large circuit support: GHZ-20 (710ms), QFT-20 (3.5s), Random-24 (12s).
|
|
255
|
+
|
|
256
|
+
### Benchpress Compatible
|
|
257
|
+
|
|
258
|
+
Includes `QuantaBenchpressBackend` adapter for cross-SDK benchmarking alongside Qiskit, Cirq, and Braket using the [Benchpress](https://arxiv.org/abs/2406.14155) framework.
|
|
259
|
+
|
|
260
|
+
## Installation
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# Clone and install
|
|
264
|
+
git clone https://github.com/ONMARTECH/quanta-sdk.git
|
|
265
|
+
cd quanta-sdk
|
|
266
|
+
pip install -e ".[dev]"
|
|
267
|
+
|
|
268
|
+
# Run tests
|
|
269
|
+
pytest
|
|
270
|
+
|
|
271
|
+
# Run benchmark
|
|
272
|
+
python -m quanta.examples.10_quantum_benchmark
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**Optional GPU acceleration:**
|
|
276
|
+
```bash
|
|
277
|
+
pip install jax jaxlib # JAX GPU backend
|
|
278
|
+
pip install cupy # NVIDIA CUDA backend
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Documentation
|
|
282
|
+
|
|
283
|
+
| Document | Description |
|
|
284
|
+
|----------|-------------|
|
|
285
|
+
| [Architecture (EN)](docs/ARCHITECTURE_EN.md) | System design, DAG IR, compiler pipeline |
|
|
286
|
+
| [Architecture (TR)](docs/ARCHITECTURE_TR.md) | Türkçe mimari dokümanı |
|
|
287
|
+
| [Features (EN)](docs/FEATURES_EN.md) | Complete feature list |
|
|
288
|
+
| [Comparison (EN)](docs/COMPARISON_EN.md) | vs Qiskit, Cirq, Braket |
|
|
289
|
+
| [CHANGELOG](CHANGELOG.md) | Version history |
|
|
290
|
+
|
|
291
|
+
## Project Stats
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
Files: 86 Languages: Python
|
|
295
|
+
Lines: 11,770 Tests: 150+
|
|
296
|
+
Algorithms: 9 Examples: 11
|
|
297
|
+
Simulators: 3 QEC Codes: 4
|
|
298
|
+
QASM: 2.0 + 3.0 Max Qubits: 27
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Author
|
|
302
|
+
|
|
303
|
+
**Abdullah Enes SARI** — [ONMARTECH](https://onmartech.com)
|
|
304
|
+
|
|
305
|
+
**info@onmartech.com**
|
|
306
|
+
|
|
307
|
+
## Contributing
|
|
308
|
+
|
|
309
|
+
Contributions, issues, and feature requests are welcome!
|
|
310
|
+
Feel free to check [issues page](https://github.com/ONMARTECH/quanta-sdk/issues).
|
|
311
|
+
|
|
312
|
+
## License
|
|
313
|
+
|
|
314
|
+
[Apache License 2.0](LICENSE)
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
<p align="center">
|
|
319
|
+
<sub>Built for the quantum computing community</sub>
|
|
320
|
+
</p>
|