dense-evolution 8.0.7__tar.gz → 8.0.9__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.
Files changed (26) hide show
  1. dense_evolution-8.0.9/PKG-INFO +329 -0
  2. dense_evolution-8.0.9/README.md +285 -0
  3. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/dash.py +461 -1011
  4. dense_evolution-8.0.9/dense_evolution/gates.py +50 -0
  5. dense_evolution-8.0.9/dense_evolution/healing.py +139 -0
  6. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/dense_evolution/simulator.py +467 -488
  7. dense_evolution-8.0.9/dense_evolution.egg-info/PKG-INFO +329 -0
  8. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/dense_evolution.egg-info/SOURCES.txt +1 -1
  9. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/pyproject.toml +2 -2
  10. dense_evolution-8.0.7/PKG-INFO +0 -2956
  11. dense_evolution-8.0.7/README.md +0 -2912
  12. dense_evolution-8.0.7/dense_evolution/gates.py +0 -61
  13. dense_evolution-8.0.7/dense_evolution/stress_test.py +0 -76
  14. dense_evolution-8.0.7/dense_evolution.egg-info/PKG-INFO +0 -2956
  15. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/dense_evolution/__init__.py +0 -0
  16. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/dense_evolution/compiler.py +0 -0
  17. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/dense_evolution/parser.py +0 -0
  18. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/dense_evolution/registry.py +0 -0
  19. /dense_evolution-8.0.7/dense_evolution/mega_stress_test.py → /dense_evolution-8.0.9/dense_evolution/stress_test.py +0 -0
  20. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/dense_evolution/stress_test_quantum.py +0 -0
  21. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/dense_evolution/test_library.py +0 -0
  22. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/dense_evolution.egg-info/dependency_links.txt +0 -0
  23. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/dense_evolution.egg-info/requires.txt +0 -0
  24. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/dense_evolution.egg-info/top_level.txt +0 -0
  25. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/license.md +0 -0
  26. {dense_evolution-8.0.7 → dense_evolution-8.0.9}/setup.cfg +0 -0
@@ -0,0 +1,329 @@
1
+ Metadata-Version: 2.4
2
+ Name: dense-evolution
3
+ Version: 8.0.9
4
+ Summary: Micro-optimized High-Performance NISQ Statevector Quantum Circuit Simulator (Hardware-Adaptive Integration of Native NumPy, CUDA-Accelerated CuPy, and Linear Kernel Fusion via JAX JIT/XLA Compilation)
5
+ Author-email: Salvatore Pennacchio <jtatopenn@libero.it>
6
+ License: Business Source License 1.1
7
+ Project-URL: Homepage, https://github.com/tatopenn-cell/Dense-Evolution
8
+ Project-URL: Documentation, https://github.com/tatopenn-cell/Dense-Evolution/blob/main/LICENSE
9
+ Project-URL: Repository, https://github.com/tatopenn-cell/Dense-Evolution
10
+ Project-URL: Bug Tracker, https://github.com/tatopenn-cell/Dense-Evolution/blob/main/dense_evolution.py
11
+ Keywords: quantum-computing,quantum-simulation,statevector,jax,cupy,cuda-acceleration,openqasm,nisq-noise,hpc,linear-kernel-fusion,dashboard,visualization
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: Other/Proprietary License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering :: Physics
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: license.md
26
+ Requires-Dist: numpy>=1.22.0
27
+ Requires-Dist: matplotlib>=3.5.0
28
+ Requires-Dist: psutil>=5.9.0
29
+ Provides-Extra: jax
30
+ Requires-Dist: jax>=0.4.0; extra == "jax"
31
+ Requires-Dist: jaxlib>=0.4.0; extra == "jax"
32
+ Provides-Extra: gpu
33
+ Requires-Dist: cupy-cuda12x>=12.0.0; extra == "gpu"
34
+ Provides-Extra: dashboard
35
+ Requires-Dist: dash>=2.0.0; extra == "dashboard"
36
+ Requires-Dist: plotly>=5.0.0; extra == "dashboard"
37
+ Provides-Extra: full
38
+ Requires-Dist: jax>=0.4.0; extra == "full"
39
+ Requires-Dist: jaxlib>=0.4.0; extra == "full"
40
+ Requires-Dist: cupy-cuda12x>=12.0.0; extra == "full"
41
+ Requires-Dist: dash>=2.0.0; extra == "full"
42
+ Requires-Dist: plotly>=5.0.0; extra == "full"
43
+ Dynamic: license-file
44
+
45
+ ```
46
+ ██████╗ ███████╗███╗ ██╗███████╗███████╗
47
+ ██╔══██╗██╔════╝████╗ ██║██╔════╝██╔════╝
48
+ ██║ ██║█████╗ ██╔██╗ ██║███████╗█████╗
49
+ ██║ ██║██╔══╝ ██║╚██╗██║╚════██║██╔══╝
50
+ ██████╔╝███████╗██║ ╚████║███████║███████╗
51
+ ╚═════╝ ╚══════╝╚═╝ ╚═══╝╚══════╝╚══════╝
52
+ ███████╗██╗ ██╗ ██████╗ ██╗
53
+ ██╔════╝██║ ██║██╔═══██╗██║
54
+ █████╗ ██║ ██║██║ ██║██║
55
+ ██╔══╝ ╚██╗ ██╔╝██║ ██║██║
56
+ ███████╗ ╚████╔╝ ╚██████╔╝███████╗
57
+ ╚══════╝ ╚═══╝ ╚═════╝ ╚══════╝
58
+ ```
59
+
60
+ **Dense Statevector Quantum Simulator · JAX XLA · NISQ · VQE · QML**
61
+
62
+ [!\[CI](https://github.com/tatopenn-cell/Dense-Evolution/actions/workflows/ci.yml/badge.svg)](https://github.com/tatopenn-cell/Dense-Evolution/actions/workflows/ci.yml)
63
+ [!\[PyPI](https://img.shields.io/pypi/v/dense-evolution?style=flat-square&color=00e5ff)](https://pypi.org/project/dense-evolution/)
64
+ [!\[Python](https://img.shields.io/badge/Python-3.9+-blue?style=flat-square&logo=python&logoColor=white)](https://www.python.org/)
65
+ [!\[License](https://img.shields.io/badge/License-BSL_1.1-orange?style=flat-square)](LICENSE.md)
66
+ [!\[Build](https://img.shields.io/badge/Build-Passing-00ff9d?style=flat-square)](https://github.com/tatopenn-cell/Dense-Evolution/actions)
67
+
68
+ </div>
69
+
70
+ \---
71
+
72
+ ## ▍ What It Is
73
+
74
+ **Dense Evolution** is a high-performance statevector simulator engineered for deep NISQ circuits, VQE pipelines, and QML workloads. It eliminates Kronecker product overhead entirely via stride-sliced linear kernel fusion compiled through JAX XLA — keeping memory at the theoretical minimum of `2ⁿ × 16 bytes`.
75
+
76
+ The integrated `dash.py` dashboard provides live ipywidgets telemetry across 6 quantum observables per simulation run, directly inside Google Colab or Jupyter.
77
+
78
+ \---
79
+
80
+ ## ▍ Install
81
+
82
+ ```bash
83
+ # core engine
84
+ pip install dense-evolution
85
+
86
+ # full stack: JAX · GPU · dashboard
87
+ pip install dense-evolution\\\[full]
88
+
89
+ # development
90
+ git clone https://github.com/tatopenn-cell/Dense-Evolution.git
91
+ cd Dense-Evolution \\\&\\\& pip install -e .\\\[full]
92
+ ```
93
+
94
+ **Google Colab (3 lines):**
95
+
96
+ ```python
97
+ !git clone https://github.com/tatopenn-cell/Dense-Evolution.git
98
+ %cd Dense-Evolution
99
+ !pip install -e .
100
+ ```
101
+
102
+ \---
103
+
104
+ ## ▍ Quick Start
105
+
106
+ ```python
107
+ from dense\\\_evolution import DenseSVSimulator, QASMParser
108
+
109
+ # parse any OpenQASM 2.0 string
110
+ qasm = """
111
+ OPENQASM 2.0;
112
+ include "qelib1.inc";
113
+ qreg q\\\[3];
114
+ h q\\\[0];
115
+ cx q\\\[0], q\\\[1];
116
+ cx q\\\[1], q\\\[2];
117
+ """
118
+
119
+ parser = QASMParser()
120
+ circuit = parser.parse(qasm)
121
+
122
+ sim = DenseSVSimulator(n\\\_qubits=3)
123
+ sim.run\\\_circuit\\\_jit\\\_beast\\\_mode(circuit.ops)
124
+
125
+ print(sim.get\\\_probabilities()) # \\\[0.5, 0, 0, 0, 0, 0, 0, 0.5] — GHZ state
126
+ print(sim.memory\\\_mb()) # 0.000128 MB
127
+ ```
128
+
129
+ **Dashboard (Colab / Jupyter):**
130
+
131
+ ```python
132
+ import dash
133
+ from IPython.display import display, clear\\\_output
134
+
135
+ clear\\\_output()
136
+ display(dash.dashboard\\\_unificata)
137
+ ```
138
+
139
+ \---
140
+
141
+ ## ▍ Architecture
142
+
143
+ ```
144
+ dense\\\_evolution/
145
+ ├── registry.py hardware detection · JAX / CuPy / NumPy capability flags
146
+ ├── gates.py GATES{} · PARAMETRIC\\\_GATES{} · GATE\\\_IDS{}
147
+ ├── noise\\\_model.py Kraus channels · stochastic trajectory engine
148
+ ├── parser.py QASMParser · QASMCircuit · OpenQASM 2.0 / 3.0
149
+ ├── compiler.py \\\_apply\\\_gate\\\_fast\\\_step (jit) · \\\_compile\\\_and\\\_run\\\_circuit\\\_jit
150
+ ├── simulator.py DenseSVSimulator · vmap batch VQE · chunked execution
151
+ └── dash.py ipywidgets dashboard · VQE engine · MD simulation
152
+ ```
153
+
154
+ **Data flow per run:**
155
+
156
+ ```
157
+ ▶ Run
158
+ └─ core\\\_calcolo\\\_quantistico() parse → JIT execute → apply noise
159
+ ├─ ottimizza\\\_vqe() Hellmann-Feynman AD → ADAM → df\\\_vqe\\\_telemetry
160
+ ├─ run\\\_md\\\_simulation\\\_dummy() QM/MM dynamics → df\\\_md\\\_telemetry + Pearson matrix
161
+ └─ build\\\_panel\\\_\\\*(res) matplotlib figure → display()
162
+ ```
163
+
164
+ \---
165
+
166
+ ## ▍ Core Features
167
+
168
+ |Feature|Detail|
169
+ |-|-|
170
+ |**Linear Kernel Fusion**|Stride-sliced tensor ops via JAX XLA — zero Kronecker matrices|
171
+ |**Circuit Chunking**|Fixed-size JIT blocks eliminate tracer overhead on 1000+ gate circuits|
172
+ |**Kraus Noise Channels**|`depolarizing` `amplitude\\\_damping` `phase\\\_damping` `bitflip` `combined` — stochastic, O(2ⁿ) cost|
173
+ |**VQE + ADAM**|Hellmann-Feynman gradient via JAX AD · positional parameter injection into any QASM 2.0|
174
+ |**vmap Batch Sweep**|`run\\\_parametric\\\_batch\\\_jit()` evaluates full parameter grids in one JIT call|
175
+ |**Backend Agnostic**|NumPy CPU · JAX XLA CPU/TPU · CuPy CUDA — runtime selection, zero code changes|
176
+ |**Live Dashboard**|8-panel ipywidgets telemetry: probability, VQE energy, entropy, purity, gradient, noise, θ-correction, Pearson heatmap|
177
+
178
+ \---
179
+
180
+ ## ▍ Benchmarks
181
+
182
+ > Measured on Google Colab Free Tier (CPU runtime)
183
+
184
+ |Metric|Value|
185
+ |-|-|
186
+ |Numerical drift (80-layer Ansatz, 1360 gates)|`Δ = 1.11 × 10⁻¹⁶`|
187
+ |Memory footprint @ 20q|`32 MB` (float64) · `16 MB` (float32)|
188
+ |JIT compile overhead (first run)|`< 400 ms`|
189
+ |Gate throughput after warm-up|`> 10⁶ gates/s` (CPU)|
190
+ |Maximum tested qubits (Colab Free)|`24q` stable · `33q` high-RAM runtime|
191
+
192
+ \---
193
+
194
+ ## ▍ Dashboard Panels
195
+
196
+ |Panel|Contents|
197
+ |-|-|
198
+ |**Overview**|R0 header · R1 P(\|n⟩) histogram + Top-12 states · R2 wavefunction helix 3D + metrics table · R3 noise analysis + shot histogram · R4–R6 VQE telemetry × 6 · R7 Pearson heatmap|
199
+ |**Fisica Stato**|Bloch projection · Schmidt rank · coherence vector|
200
+ |**Mosaico 1008q**|2D probability density map up to 1008 qubits|
201
+ |**VQE Results**|6-subplot telemetry: energy convergence, entropy, purity, ‖∇L‖, noise factor, θ-correction|
202
+ |**MD Results**|6-subplot MD telemetry + masked Pearson correlation heatmap|
203
+ |**Performance**|Gate throughput · JIT compile time · RAM usage|
204
+
205
+ \---
206
+
207
+ ## ▍ Circuit Library (30+ presets)
208
+
209
+ All circuits are stored as OpenQASM 2.0 strings in `QASM\\\_LIBRARY`.
210
+
211
+ **Standard** — Bell Φ⁺, QFT 4q/8q, Toffoli, Adder 2-bit, Deutsch-Jozsa, Bernstein-Vazirani
212
+ **Algorithms** — Grover 3q/4q, Simon 4q, Shor 15, HHL, QAOA Max-Cut 4q, QPE 5q, Quantum Walk, Teleportation, BB84
213
+ **Topological** — Anyonic Braiding 6q, Charge Pump 8q, Arecibo DeepField 16q
214
+ **Peptide / Biological** — Furin RRAR 8q, Hemoglobin MVLSPADK 8q,
215
+ **Stress Tests** — Hardware Stress, Quantum Supremacy, Interference Stress,
216
+
217
+ ## ▍ VQE Engine
218
+
219
+ **Positional parameter injection** — `QASMParser` tokenizes all literals to `0.0` for JIT speed. VQE recovers parameters by:
220
+
221
+ 1. counting parametric gates (`rx ry rz p u1 cp crz`) → `n\\\_params`
222
+ 2. initializing `θ ∈ ℝⁿ` uniform in `\\\[−π, π]`
223
+ 3. injecting `θ\\\[i]` sequentially by gate order in the AST via `risolvi\\\_qasm()`
224
+
225
+ Compatible with any custom OpenQASM 2.0 string without pre-labelling.
226
+
227
+ **Gradient \& update rule:**
228
+
229
+ $$\\frac{\\partial E}{\\partial \\theta\_i} = \\langle\\psi(\\theta)|,\\frac{\\partial H}{\\partial \\theta\_i},|\\psi(\\theta)\\rangle \\qquad \\theta \\leftarrow \\theta - \\frac{\\alpha,\\hat{m}\_t}{\\sqrt{\\hat{v}\_t}+\\varepsilon}$$
230
+
231
+ **Telemetry columns** (→ `df\\\_vqe\\\_telemetry`):
232
+
233
+ |Column|Unit|Description|
234
+ |-|-|-|
235
+ |`VQE\\\_Energy`|Ha|⟨ψ\|H\|ψ⟩|
236
+ |`Entropy`|bit|−Tr(ρ log₂ ρ)|
237
+ |`Purity`|—|Tr(ρ²) ∈ \[1/d, 1]|
238
+ |`Gradient`|—|‖∇L‖ — barren plateau detection|
239
+ |`Noise\\\_Factor`|—|fidelity-derived noise proxy|
240
+ |`Theta\\\_Correction`|rad|ADAM step norm|
241
+
242
+ \---
243
+
244
+ ## ▍ Hamiltonian Library
245
+
246
+ Auto-filtered by qubit count to prevent shape mismatch.
247
+
248
+ |Molecule|Qubits|Bond length|E₀ (Ha)|
249
+ |-|:-:|:-:|:-:|
250
+ |H₂|2|0.74 Å|−1.13|
251
+ |H₃⁺|3|0.85 Å|−1.28|
252
+ |LiH|4|1.40 Å|−2.31|
253
+ |H₂O|5|0.96 Å|−4.12|
254
+
255
+ Custom: JSON array of diagonal eigenvalues, length `2^n\\\_qubits`.
256
+
257
+ \---
258
+
259
+ ## ▍ Noise Models
260
+
261
+ All channels applied as post-circuit Kraus operations on the full statevector.
262
+
263
+ |Model|Kraus operators|Physical process|
264
+ |-|-|-|
265
+ |`ideal`|I|noiseless|
266
+ |`depolarizing`|{√(1−p)I, √(p/3)X,Y,Z}|isotropic Pauli error|
267
+ |`amplitude\\\_damping`|{K₀, K₁}|T₁ energy relaxation|
268
+ |`phase\\\_damping`|{K₀, K₁}|T₂ dephasing|
269
+ |`bitflip`|{√(1−p)I, √p·X}|bit flip σₓ|
270
+ |`combined`|depolarizing(p/2) ∘ amp\_damp(p/3)|worst-case NISQ|
271
+
272
+ Fidelity: Bhattacharyya `F = Σᵢ √(pᵢqᵢ)` and TVD `= ½Σᵢ|pᵢ−qᵢ|` computed on every noisy run.
273
+
274
+ \---
275
+
276
+ ## ▍ Troubleshooting
277
+
278
+ |Error|Cause|Fix|
279
+ |-|-|-|
280
+ |`TypeError: cond branches must have equal output types`|JAX dtype mismatch between 1q/2q branches|`de.patch\\\_dense\\\_parametric(de.DenseSVSimulator)` — runs automatically on import|
281
+ |VQE telemetry empty|VQE disabled or no parametric gates|Enable **VQE Settings** checkbox; use circuits with `rx/ry/rz` gates|
282
+ |Hamiltonian shape mismatch|JSON array length ≠ 2^n\_qubits|Supply exactly `2^n` values (e.g. 16 for 4q)|
283
+ |Barren plateau span not visible|< 3 consecutive epochs with ‖g‖ < 0.01·max‖g‖|Increase epochs or reduce learning rate|
284
+ |Dashboard blank in JupyterLab|Extension missing|`jupyter labextension install @jupyter-widgets/jupyterlab-manager`|
285
+ |Memory error on high-qubit circuits|2ⁿ × 16 bytes: 24q = 268 MB, 30q = 16 GB|Use `use\\\_float32=True` to halve; cap at 24q on standard runtimes|
286
+
287
+ \---
288
+
289
+ \### 🚀 Quantum Error Mitigation \& Predictive Healing Engine
290
+
291
+
292
+
293
+ To significantly suppress non-unitary quantum noise and phase dephasing channels without the massive physical hardware overhead of standard Error Correction, this release introduces a high-performance, JAX-accelerated \*\*Predictive Healing Engine\*\* natively integrated into the simulation runtime.
294
+
295
+
296
+
297
+ Unlike static Zero-Noise Extrapolation (ZNE) protocols that can compound errors over deep variational quantum circuits, the new framework implements an active predictive mitigation topology controlled via a dynamic, multi-variable stabilization parameter ($\\kappa$):
298
+
299
+
300
+
301
+ \* \*\* Dephasing Tracking:\*\* The engine monitors phase drift by calculating the predictive deviation ($$\\Delta\_{pre\\\_emp}$$) of the synchronization function ($\\Sigma$) relative to the ideal target eigenstate.
302
+
303
+ \* \*\*Hardware-Adaptive $\\kappa$-Stabilization:\*\* Upon reaching the critical dephasing threshold, a calibrated learning routine dynamically scales the coherence strength ($\\kappa$). This proactively shields the statevector profile \*prior\* to Richardson extrapolation.
304
+
305
+ \* \*\*Coupled Richardson Integration:\*\* The healed quantum energy values are subsequently mapped to dual-point stretched noise density thresholds ($\\lambda\_1 = 1.0, \\lambda\_2 = 2.0$), stabilizing the final zero-noise trajectory approximation without creating non-linear numerical artifacts.
306
+
307
+
308
+
309
+ All computational cores—including spatial alignment tensors ($\\Phi\_{AB}$) and life-vector dynamics ($V\_{vita}$)—are decorated with `@jax.jit`, triggering full \*\*XLA Kernel Fusion\*\* to execute mass-parallelized trajectory sweeps (over 10,000+ simultaneous simulation tracks) under a fraction of a second.
310
+
311
+
312
+
313
+
314
+
315
+ ## ▍ License
316
+
317
+ **Business Source License 1.1** — converts automatically to **Apache 2.0** on **1 June 2029**.
318
+
319
+ * Non-commercial use: unrestricted
320
+ * Commercial use: ≤ 24 allocated qubits · ≤ 1000 circuits/day · ≤ 10,000 shots/circuit
321
+ * Attribution required on all copies: `© 2026 Salvatore Pennacchio <jtatopenn@libero.it> — Dense Evolution`
322
+
323
+ Full text: [LICENSE.md](LICENSE.md)
324
+
325
+ \---
326
+
327
+ <div align="center">
328
+ <sub>© 2026 Salvatore Pennacchio — Dense Evolution v8.0.9</sub>
329
+
@@ -0,0 +1,285 @@
1
+ ```
2
+ ██████╗ ███████╗███╗ ██╗███████╗███████╗
3
+ ██╔══██╗██╔════╝████╗ ██║██╔════╝██╔════╝
4
+ ██║ ██║█████╗ ██╔██╗ ██║███████╗█████╗
5
+ ██║ ██║██╔══╝ ██║╚██╗██║╚════██║██╔══╝
6
+ ██████╔╝███████╗██║ ╚████║███████║███████╗
7
+ ╚═════╝ ╚══════╝╚═╝ ╚═══╝╚══════╝╚══════╝
8
+ ███████╗██╗ ██╗ ██████╗ ██╗
9
+ ██╔════╝██║ ██║██╔═══██╗██║
10
+ █████╗ ██║ ██║██║ ██║██║
11
+ ██╔══╝ ╚██╗ ██╔╝██║ ██║██║
12
+ ███████╗ ╚████╔╝ ╚██████╔╝███████╗
13
+ ╚══════╝ ╚═══╝ ╚═════╝ ╚══════╝
14
+ ```
15
+
16
+ **Dense Statevector Quantum Simulator · JAX XLA · NISQ · VQE · QML**
17
+
18
+ [!\[CI](https://github.com/tatopenn-cell/Dense-Evolution/actions/workflows/ci.yml/badge.svg)](https://github.com/tatopenn-cell/Dense-Evolution/actions/workflows/ci.yml)
19
+ [!\[PyPI](https://img.shields.io/pypi/v/dense-evolution?style=flat-square&color=00e5ff)](https://pypi.org/project/dense-evolution/)
20
+ [!\[Python](https://img.shields.io/badge/Python-3.9+-blue?style=flat-square&logo=python&logoColor=white)](https://www.python.org/)
21
+ [!\[License](https://img.shields.io/badge/License-BSL_1.1-orange?style=flat-square)](LICENSE.md)
22
+ [!\[Build](https://img.shields.io/badge/Build-Passing-00ff9d?style=flat-square)](https://github.com/tatopenn-cell/Dense-Evolution/actions)
23
+
24
+ </div>
25
+
26
+ \---
27
+
28
+ ## ▍ What It Is
29
+
30
+ **Dense Evolution** is a high-performance statevector simulator engineered for deep NISQ circuits, VQE pipelines, and QML workloads. It eliminates Kronecker product overhead entirely via stride-sliced linear kernel fusion compiled through JAX XLA — keeping memory at the theoretical minimum of `2ⁿ × 16 bytes`.
31
+
32
+ The integrated `dash.py` dashboard provides live ipywidgets telemetry across 6 quantum observables per simulation run, directly inside Google Colab or Jupyter.
33
+
34
+ \---
35
+
36
+ ## ▍ Install
37
+
38
+ ```bash
39
+ # core engine
40
+ pip install dense-evolution
41
+
42
+ # full stack: JAX · GPU · dashboard
43
+ pip install dense-evolution\\\[full]
44
+
45
+ # development
46
+ git clone https://github.com/tatopenn-cell/Dense-Evolution.git
47
+ cd Dense-Evolution \\\&\\\& pip install -e .\\\[full]
48
+ ```
49
+
50
+ **Google Colab (3 lines):**
51
+
52
+ ```python
53
+ !git clone https://github.com/tatopenn-cell/Dense-Evolution.git
54
+ %cd Dense-Evolution
55
+ !pip install -e .
56
+ ```
57
+
58
+ \---
59
+
60
+ ## ▍ Quick Start
61
+
62
+ ```python
63
+ from dense\\\_evolution import DenseSVSimulator, QASMParser
64
+
65
+ # parse any OpenQASM 2.0 string
66
+ qasm = """
67
+ OPENQASM 2.0;
68
+ include "qelib1.inc";
69
+ qreg q\\\[3];
70
+ h q\\\[0];
71
+ cx q\\\[0], q\\\[1];
72
+ cx q\\\[1], q\\\[2];
73
+ """
74
+
75
+ parser = QASMParser()
76
+ circuit = parser.parse(qasm)
77
+
78
+ sim = DenseSVSimulator(n\\\_qubits=3)
79
+ sim.run\\\_circuit\\\_jit\\\_beast\\\_mode(circuit.ops)
80
+
81
+ print(sim.get\\\_probabilities()) # \\\[0.5, 0, 0, 0, 0, 0, 0, 0.5] — GHZ state
82
+ print(sim.memory\\\_mb()) # 0.000128 MB
83
+ ```
84
+
85
+ **Dashboard (Colab / Jupyter):**
86
+
87
+ ```python
88
+ import dash
89
+ from IPython.display import display, clear\\\_output
90
+
91
+ clear\\\_output()
92
+ display(dash.dashboard\\\_unificata)
93
+ ```
94
+
95
+ \---
96
+
97
+ ## ▍ Architecture
98
+
99
+ ```
100
+ dense\\\_evolution/
101
+ ├── registry.py hardware detection · JAX / CuPy / NumPy capability flags
102
+ ├── gates.py GATES{} · PARAMETRIC\\\_GATES{} · GATE\\\_IDS{}
103
+ ├── noise\\\_model.py Kraus channels · stochastic trajectory engine
104
+ ├── parser.py QASMParser · QASMCircuit · OpenQASM 2.0 / 3.0
105
+ ├── compiler.py \\\_apply\\\_gate\\\_fast\\\_step (jit) · \\\_compile\\\_and\\\_run\\\_circuit\\\_jit
106
+ ├── simulator.py DenseSVSimulator · vmap batch VQE · chunked execution
107
+ └── dash.py ipywidgets dashboard · VQE engine · MD simulation
108
+ ```
109
+
110
+ **Data flow per run:**
111
+
112
+ ```
113
+ ▶ Run
114
+ └─ core\\\_calcolo\\\_quantistico() parse → JIT execute → apply noise
115
+ ├─ ottimizza\\\_vqe() Hellmann-Feynman AD → ADAM → df\\\_vqe\\\_telemetry
116
+ ├─ run\\\_md\\\_simulation\\\_dummy() QM/MM dynamics → df\\\_md\\\_telemetry + Pearson matrix
117
+ └─ build\\\_panel\\\_\\\*(res) matplotlib figure → display()
118
+ ```
119
+
120
+ \---
121
+
122
+ ## ▍ Core Features
123
+
124
+ |Feature|Detail|
125
+ |-|-|
126
+ |**Linear Kernel Fusion**|Stride-sliced tensor ops via JAX XLA — zero Kronecker matrices|
127
+ |**Circuit Chunking**|Fixed-size JIT blocks eliminate tracer overhead on 1000+ gate circuits|
128
+ |**Kraus Noise Channels**|`depolarizing` `amplitude\\\_damping` `phase\\\_damping` `bitflip` `combined` — stochastic, O(2ⁿ) cost|
129
+ |**VQE + ADAM**|Hellmann-Feynman gradient via JAX AD · positional parameter injection into any QASM 2.0|
130
+ |**vmap Batch Sweep**|`run\\\_parametric\\\_batch\\\_jit()` evaluates full parameter grids in one JIT call|
131
+ |**Backend Agnostic**|NumPy CPU · JAX XLA CPU/TPU · CuPy CUDA — runtime selection, zero code changes|
132
+ |**Live Dashboard**|8-panel ipywidgets telemetry: probability, VQE energy, entropy, purity, gradient, noise, θ-correction, Pearson heatmap|
133
+
134
+ \---
135
+
136
+ ## ▍ Benchmarks
137
+
138
+ > Measured on Google Colab Free Tier (CPU runtime)
139
+
140
+ |Metric|Value|
141
+ |-|-|
142
+ |Numerical drift (80-layer Ansatz, 1360 gates)|`Δ = 1.11 × 10⁻¹⁶`|
143
+ |Memory footprint @ 20q|`32 MB` (float64) · `16 MB` (float32)|
144
+ |JIT compile overhead (first run)|`< 400 ms`|
145
+ |Gate throughput after warm-up|`> 10⁶ gates/s` (CPU)|
146
+ |Maximum tested qubits (Colab Free)|`24q` stable · `33q` high-RAM runtime|
147
+
148
+ \---
149
+
150
+ ## ▍ Dashboard Panels
151
+
152
+ |Panel|Contents|
153
+ |-|-|
154
+ |**Overview**|R0 header · R1 P(\|n⟩) histogram + Top-12 states · R2 wavefunction helix 3D + metrics table · R3 noise analysis + shot histogram · R4–R6 VQE telemetry × 6 · R7 Pearson heatmap|
155
+ |**Fisica Stato**|Bloch projection · Schmidt rank · coherence vector|
156
+ |**Mosaico 1008q**|2D probability density map up to 1008 qubits|
157
+ |**VQE Results**|6-subplot telemetry: energy convergence, entropy, purity, ‖∇L‖, noise factor, θ-correction|
158
+ |**MD Results**|6-subplot MD telemetry + masked Pearson correlation heatmap|
159
+ |**Performance**|Gate throughput · JIT compile time · RAM usage|
160
+
161
+ \---
162
+
163
+ ## ▍ Circuit Library (30+ presets)
164
+
165
+ All circuits are stored as OpenQASM 2.0 strings in `QASM\\\_LIBRARY`.
166
+
167
+ **Standard** — Bell Φ⁺, QFT 4q/8q, Toffoli, Adder 2-bit, Deutsch-Jozsa, Bernstein-Vazirani
168
+ **Algorithms** — Grover 3q/4q, Simon 4q, Shor 15, HHL, QAOA Max-Cut 4q, QPE 5q, Quantum Walk, Teleportation, BB84
169
+ **Topological** — Anyonic Braiding 6q, Charge Pump 8q, Arecibo DeepField 16q
170
+ **Peptide / Biological** — Furin RRAR 8q, Hemoglobin MVLSPADK 8q,
171
+ **Stress Tests** — Hardware Stress, Quantum Supremacy, Interference Stress,
172
+
173
+ ## ▍ VQE Engine
174
+
175
+ **Positional parameter injection** — `QASMParser` tokenizes all literals to `0.0` for JIT speed. VQE recovers parameters by:
176
+
177
+ 1. counting parametric gates (`rx ry rz p u1 cp crz`) → `n\\\_params`
178
+ 2. initializing `θ ∈ ℝⁿ` uniform in `\\\[−π, π]`
179
+ 3. injecting `θ\\\[i]` sequentially by gate order in the AST via `risolvi\\\_qasm()`
180
+
181
+ Compatible with any custom OpenQASM 2.0 string without pre-labelling.
182
+
183
+ **Gradient \& update rule:**
184
+
185
+ $$\\frac{\\partial E}{\\partial \\theta\_i} = \\langle\\psi(\\theta)|,\\frac{\\partial H}{\\partial \\theta\_i},|\\psi(\\theta)\\rangle \\qquad \\theta \\leftarrow \\theta - \\frac{\\alpha,\\hat{m}\_t}{\\sqrt{\\hat{v}\_t}+\\varepsilon}$$
186
+
187
+ **Telemetry columns** (→ `df\\\_vqe\\\_telemetry`):
188
+
189
+ |Column|Unit|Description|
190
+ |-|-|-|
191
+ |`VQE\\\_Energy`|Ha|⟨ψ\|H\|ψ⟩|
192
+ |`Entropy`|bit|−Tr(ρ log₂ ρ)|
193
+ |`Purity`|—|Tr(ρ²) ∈ \[1/d, 1]|
194
+ |`Gradient`|—|‖∇L‖ — barren plateau detection|
195
+ |`Noise\\\_Factor`|—|fidelity-derived noise proxy|
196
+ |`Theta\\\_Correction`|rad|ADAM step norm|
197
+
198
+ \---
199
+
200
+ ## ▍ Hamiltonian Library
201
+
202
+ Auto-filtered by qubit count to prevent shape mismatch.
203
+
204
+ |Molecule|Qubits|Bond length|E₀ (Ha)|
205
+ |-|:-:|:-:|:-:|
206
+ |H₂|2|0.74 Å|−1.13|
207
+ |H₃⁺|3|0.85 Å|−1.28|
208
+ |LiH|4|1.40 Å|−2.31|
209
+ |H₂O|5|0.96 Å|−4.12|
210
+
211
+ Custom: JSON array of diagonal eigenvalues, length `2^n\\\_qubits`.
212
+
213
+ \---
214
+
215
+ ## ▍ Noise Models
216
+
217
+ All channels applied as post-circuit Kraus operations on the full statevector.
218
+
219
+ |Model|Kraus operators|Physical process|
220
+ |-|-|-|
221
+ |`ideal`|I|noiseless|
222
+ |`depolarizing`|{√(1−p)I, √(p/3)X,Y,Z}|isotropic Pauli error|
223
+ |`amplitude\\\_damping`|{K₀, K₁}|T₁ energy relaxation|
224
+ |`phase\\\_damping`|{K₀, K₁}|T₂ dephasing|
225
+ |`bitflip`|{√(1−p)I, √p·X}|bit flip σₓ|
226
+ |`combined`|depolarizing(p/2) ∘ amp\_damp(p/3)|worst-case NISQ|
227
+
228
+ Fidelity: Bhattacharyya `F = Σᵢ √(pᵢqᵢ)` and TVD `= ½Σᵢ|pᵢ−qᵢ|` computed on every noisy run.
229
+
230
+ \---
231
+
232
+ ## ▍ Troubleshooting
233
+
234
+ |Error|Cause|Fix|
235
+ |-|-|-|
236
+ |`TypeError: cond branches must have equal output types`|JAX dtype mismatch between 1q/2q branches|`de.patch\\\_dense\\\_parametric(de.DenseSVSimulator)` — runs automatically on import|
237
+ |VQE telemetry empty|VQE disabled or no parametric gates|Enable **VQE Settings** checkbox; use circuits with `rx/ry/rz` gates|
238
+ |Hamiltonian shape mismatch|JSON array length ≠ 2^n\_qubits|Supply exactly `2^n` values (e.g. 16 for 4q)|
239
+ |Barren plateau span not visible|< 3 consecutive epochs with ‖g‖ < 0.01·max‖g‖|Increase epochs or reduce learning rate|
240
+ |Dashboard blank in JupyterLab|Extension missing|`jupyter labextension install @jupyter-widgets/jupyterlab-manager`|
241
+ |Memory error on high-qubit circuits|2ⁿ × 16 bytes: 24q = 268 MB, 30q = 16 GB|Use `use\\\_float32=True` to halve; cap at 24q on standard runtimes|
242
+
243
+ \---
244
+
245
+ \### 🚀 Quantum Error Mitigation \& Predictive Healing Engine
246
+
247
+
248
+
249
+ To significantly suppress non-unitary quantum noise and phase dephasing channels without the massive physical hardware overhead of standard Error Correction, this release introduces a high-performance, JAX-accelerated \*\*Predictive Healing Engine\*\* natively integrated into the simulation runtime.
250
+
251
+
252
+
253
+ Unlike static Zero-Noise Extrapolation (ZNE) protocols that can compound errors over deep variational quantum circuits, the new framework implements an active predictive mitigation topology controlled via a dynamic, multi-variable stabilization parameter ($\\kappa$):
254
+
255
+
256
+
257
+ \* \*\* Dephasing Tracking:\*\* The engine monitors phase drift by calculating the predictive deviation ($$\\Delta\_{pre\\\_emp}$$) of the synchronization function ($\\Sigma$) relative to the ideal target eigenstate.
258
+
259
+ \* \*\*Hardware-Adaptive $\\kappa$-Stabilization:\*\* Upon reaching the critical dephasing threshold, a calibrated learning routine dynamically scales the coherence strength ($\\kappa$). This proactively shields the statevector profile \*prior\* to Richardson extrapolation.
260
+
261
+ \* \*\*Coupled Richardson Integration:\*\* The healed quantum energy values are subsequently mapped to dual-point stretched noise density thresholds ($\\lambda\_1 = 1.0, \\lambda\_2 = 2.0$), stabilizing the final zero-noise trajectory approximation without creating non-linear numerical artifacts.
262
+
263
+
264
+
265
+ All computational cores—including spatial alignment tensors ($\\Phi\_{AB}$) and life-vector dynamics ($V\_{vita}$)—are decorated with `@jax.jit`, triggering full \*\*XLA Kernel Fusion\*\* to execute mass-parallelized trajectory sweeps (over 10,000+ simultaneous simulation tracks) under a fraction of a second.
266
+
267
+
268
+
269
+
270
+
271
+ ## ▍ License
272
+
273
+ **Business Source License 1.1** — converts automatically to **Apache 2.0** on **1 June 2029**.
274
+
275
+ * Non-commercial use: unrestricted
276
+ * Commercial use: ≤ 24 allocated qubits · ≤ 1000 circuits/day · ≤ 10,000 shots/circuit
277
+ * Attribution required on all copies: `© 2026 Salvatore Pennacchio <jtatopenn@libero.it> — Dense Evolution`
278
+
279
+ Full text: [LICENSE.md](LICENSE.md)
280
+
281
+ \---
282
+
283
+ <div align="center">
284
+ <sub>© 2026 Salvatore Pennacchio — Dense Evolution v8.0.9</sub>
285
+