dense-evolution 8.1.0__tar.gz → 8.1.2__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.
- dense_evolution-8.1.2/PKG-INFO +1049 -0
- dense_evolution-8.1.2/README.md +1005 -0
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/dash.py +3515 -3524
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/dense_evolution/__init__.py +5 -1
- dense_evolution-8.1.2/dense_evolution/chunk.py +660 -0
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/dense_evolution/gates.py +58 -50
- dense_evolution-8.1.2/dense_evolution/healing.py +281 -0
- dense_evolution-8.1.0/dense_evolution/stress_test_quantum.py → dense_evolution-8.1.2/dense_evolution/test2.py +1 -1
- dense_evolution-8.1.2/dense_evolution.egg-info/PKG-INFO +1049 -0
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/dense_evolution.egg-info/SOURCES.txt +1 -2
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/pyproject.toml +16 -20
- dense_evolution-8.1.0/PKG-INFO +0 -658
- dense_evolution-8.1.0/README.md +0 -614
- dense_evolution-8.1.0/dense_evolution/chunk.py +0 -84
- dense_evolution-8.1.0/dense_evolution/healing.py +0 -139
- dense_evolution-8.1.0/dense_evolution/test_library.py +0 -39
- dense_evolution-8.1.0/dense_evolution.egg-info/PKG-INFO +0 -658
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/dense_evolution/compiler.py +0 -0
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/dense_evolution/parser.py +0 -0
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/dense_evolution/registry.py +0 -0
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/dense_evolution/simulator.py +0 -0
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/dense_evolution/stress_test.py +0 -0
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/dense_evolution.egg-info/dependency_links.txt +0 -0
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/dense_evolution.egg-info/requires.txt +0 -0
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/dense_evolution.egg-info/top_level.txt +0 -0
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/license.md +0 -0
- {dense_evolution-8.1.0 → dense_evolution-8.1.2}/setup.cfg +0 -0
|
@@ -0,0 +1,1049 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dense-evolution
|
|
3
|
+
Version: 8.1.2
|
|
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/README.md
|
|
9
|
+
Project-URL: Repository, https://github.com/tatopenn-cell/Dense-Evolution
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/tatopenn-cell/Dense-Evolution/issues
|
|
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
|
+
<<<<<<< HEAD
|
|
46
|
+
```
|
|
47
|
+
██████╗ ███████╗███╗ ██╗███████╗███████╗
|
|
48
|
+
██╔══██╗██╔════╝████╗ ██║██╔════╝██╔════╝
|
|
49
|
+
██║ ██║█████╗ ██╔██╗ ██║███████╗█████╗
|
|
50
|
+
██║ ██║██╔══╝ ██║╚██╗██║╚════██║██╔══╝
|
|
51
|
+
██████╔╝███████╗██║ ╚████║███████║███████╗
|
|
52
|
+
╚═════╝ ╚══════╝╚═╝ ╚═══╝╚══════╝╚══════╝
|
|
53
|
+
███████╗██╗ ██╗ ██████╗ ██╗
|
|
54
|
+
██╔════╝██║ ██║██╔═══██╗██║
|
|
55
|
+
█████╗ ██║ ██║██║ ██║██║
|
|
56
|
+
██╔══╝ ╚██╗ ██╔╝██║ ██║██║
|
|
57
|
+
███████╗ ╚████╔╝ ╚██████╔╝███████╗
|
|
58
|
+
╚══════╝ ╚═══╝ ╚═════╝ ╚══════╝
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Dense Statevector Quantum Simulator · JAX XLA · NISQ · VQE · QML**
|
|
62
|
+
|
|
63
|
+
[](https://github.com/tatopenn-cell/Dense-Evolution/actions/workflows/ci.yml)
|
|
64
|
+
[](https://pypi.org/project/dense-evolution/)
|
|
65
|
+
[](https://www.python.org/)
|
|
66
|
+
[](LICENSE.md)
|
|
67
|
+
[](https://github.com/tatopenn-cell/Dense-Evolution/actions)
|
|
68
|
+
=======
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
██████╗ ███████╗███╗ ██╗███████╗███████╗
|
|
72
|
+
|
|
73
|
+
██╔══██╗██╔════╝████╗ ██║██╔════╝██╔════╝
|
|
74
|
+
|
|
75
|
+
██║ ██║█████╗ ██╔██╗ ██║███████╗█████╗
|
|
76
|
+
|
|
77
|
+
██║ ██║██╔══╝ ██║╚██╗██║╚════██║██╔══╝
|
|
78
|
+
|
|
79
|
+
██████╔╝███████╗██║ ╚████║███████║███████╗
|
|
80
|
+
|
|
81
|
+
╚═════╝ ╚══════╝╚═╝ ╚═══╝╚══════╝╚══════╝
|
|
82
|
+
|
|
83
|
+
███████╗██╗ ██╗ ██████╗ ██╗
|
|
84
|
+
|
|
85
|
+
██╔════╝██║ ██║██╔═══██╗██║
|
|
86
|
+
|
|
87
|
+
█████╗ ██║ ██║██║ ██║██║
|
|
88
|
+
|
|
89
|
+
██╔══╝ ╚██╗ ██╔╝██║ ██║██║
|
|
90
|
+
|
|
91
|
+
███████╗ ╚████╔╝ ╚██████╔╝███████╗
|
|
92
|
+
|
|
93
|
+
╚══════╝ ╚═══╝ ╚═════╝ ╚══════╝
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
\*\*Dense Statevector Quantum Simulator · JAX XLA · NISQ · VQE · QML\*\*
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
\[!\[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)
|
|
104
|
+
|
|
105
|
+
\[!\[PyPI](https://img.shields.io/pypi/v/dense-evolution?style=flat-square\&color=00e5ff)](https://pypi.org/project/dense-evolution/)
|
|
106
|
+
|
|
107
|
+
\[!\[Python](https://img.shields.io/badge/Python-3.9+-blue?style=flat-square\&logo=python\&logoColor=white)](https://www.python.org/)
|
|
108
|
+
|
|
109
|
+
\[!\[License](https://img.shields.io/badge/License-BSL\_1.1-orange?style=flat-square)](LICENSE.md)
|
|
110
|
+
|
|
111
|
+
\[!\[Build](https://img.shields.io/badge/Build-Passing-00ff9d?style=flat-square)](https://github.com/tatopenn-cell/Dense-Evolution/actions)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
>>>>>>> 10dd0b7 (v8.1.2 - SafeMemoryGuard Anti-OOM, chunk.py rewrite, README update)
|
|
115
|
+
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<<<<<<< HEAD
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## ▍ What It Is
|
|
122
|
+
|
|
123
|
+
**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`.
|
|
124
|
+
=======
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
\## ▍ What It Is
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
\*\*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`.
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
The integrated `dash.py` dashboard provides live ipywidgets telemetry across 6 quantum observables per simulation run, directly inside Google Colab or Jupyter.
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
>>>>>>> 10dd0b7 (v8.1.2 - SafeMemoryGuard Anti-OOM, chunk.py rewrite, README update)
|
|
139
|
+
|
|
140
|
+
The integrated `dash.py` dashboard provides live ipywidgets telemetry across 6 quantum observables per simulation run, directly inside Google Colab or Jupyter.
|
|
141
|
+
|
|
142
|
+
<<<<<<< HEAD
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## ▍ Install
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# core engine
|
|
149
|
+
=======
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
\## ▍ Install
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
|
|
158
|
+
\# core engine
|
|
159
|
+
|
|
160
|
+
>>>>>>> 10dd0b7 (v8.1.2 - SafeMemoryGuard Anti-OOM, chunk.py rewrite, README update)
|
|
161
|
+
pip install dense-evolution
|
|
162
|
+
|
|
163
|
+
# full stack: JAX · GPU · dashboard
|
|
164
|
+
pip install dense-evolution[full]
|
|
165
|
+
|
|
166
|
+
<<<<<<< HEAD
|
|
167
|
+
# development
|
|
168
|
+
git clone https://github.com/tatopenn-cell/Dense-Evolution.git
|
|
169
|
+
cd Dense-Evolution && pip install -e .[full]
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Google Colab (3 lines):**
|
|
173
|
+
```python
|
|
174
|
+
!git clone https://github.com/tatopenn-cell/Dense-Evolution.git
|
|
175
|
+
%cd Dense-Evolution
|
|
176
|
+
=======
|
|
177
|
+
|
|
178
|
+
\# full stack: JAX · GPU · dashboard
|
|
179
|
+
|
|
180
|
+
pip install dense-evolution\[full]
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
\# development
|
|
185
|
+
|
|
186
|
+
git clone https://github.com/tatopenn-cell/Dense-Evolution.git
|
|
187
|
+
|
|
188
|
+
cd Dense-Evolution \&\& pip install -e .\[full]
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
\*\*Google Colab (3 lines):\*\*
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
|
|
198
|
+
!git clone https://github.com/tatopenn-cell/Dense-Evolution.git
|
|
199
|
+
|
|
200
|
+
%cd Dense-Evolution
|
|
201
|
+
|
|
202
|
+
>>>>>>> 10dd0b7 (v8.1.2 - SafeMemoryGuard Anti-OOM, chunk.py rewrite, README update)
|
|
203
|
+
!pip install -e .
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
<<<<<<< HEAD
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## ▍ Quick Start
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
from dense_evolution import DenseSVSimulator, QASMParser
|
|
214
|
+
|
|
215
|
+
# parse any OpenQASM 2.0 string
|
|
216
|
+
qasm = """
|
|
217
|
+
OPENQASM 2.0;
|
|
218
|
+
include "qelib1.inc";
|
|
219
|
+
qreg q[3];
|
|
220
|
+
h q[0];
|
|
221
|
+
cx q[0], q[1];
|
|
222
|
+
cx q[1], q[2];
|
|
223
|
+
"""
|
|
224
|
+
|
|
225
|
+
parser = QASMParser()
|
|
226
|
+
circuit = parser.parse(qasm)
|
|
227
|
+
|
|
228
|
+
sim = DenseSVSimulator(n_qubits=3)
|
|
229
|
+
sim.run_circuit_jit_beast_mode(circuit.ops)
|
|
230
|
+
=======
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
\---
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
\## ▍ Quick Start
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
```python
|
|
242
|
+
|
|
243
|
+
from dense\_evolution import DenseSVSimulator, QASMParser
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
\# parse any OpenQASM 2.0 string
|
|
248
|
+
|
|
249
|
+
qasm = """
|
|
250
|
+
|
|
251
|
+
OPENQASM 2.0;
|
|
252
|
+
|
|
253
|
+
include "qelib1.inc";
|
|
254
|
+
|
|
255
|
+
qreg q\[3];
|
|
256
|
+
|
|
257
|
+
h q\[0];
|
|
258
|
+
|
|
259
|
+
cx q\[0], q\[1];
|
|
260
|
+
|
|
261
|
+
cx q\[1], q\[2];
|
|
262
|
+
|
|
263
|
+
"""
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
parser = QASMParser()
|
|
268
|
+
|
|
269
|
+
circuit = parser.parse(qasm)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
sim = DenseSVSimulator(n\_qubits=3)
|
|
274
|
+
|
|
275
|
+
sim.run\_circuit\_jit\_beast\_mode(circuit.ops)
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
print(sim.get\_probabilities()) # \[0.5, 0, 0, 0, 0, 0, 0, 0.5] — GHZ state
|
|
280
|
+
|
|
281
|
+
print(sim.memory\_mb()) # 0.000128 MB
|
|
282
|
+
>>>>>>> 10dd0b7 (v8.1.2 - SafeMemoryGuard Anti-OOM, chunk.py rewrite, README update)
|
|
283
|
+
|
|
284
|
+
print(sim.get_probabilities()) # [0.5, 0, 0, 0, 0, 0, 0, 0.5] — GHZ state
|
|
285
|
+
print(sim.memory_mb()) # 0.000128 MB
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
<<<<<<< HEAD
|
|
289
|
+
**Dashboard (Colab / Jupyter):**
|
|
290
|
+
```python
|
|
291
|
+
import dash
|
|
292
|
+
from IPython.display import display, clear_output
|
|
293
|
+
|
|
294
|
+
clear_output()
|
|
295
|
+
display(dash.dashboard_unificata)
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## ▍ Architecture
|
|
301
|
+
|
|
302
|
+
```
|
|
303
|
+
dense_evolution/
|
|
304
|
+
├── registry.py hardware detection · JAX / CuPy / NumPy capability flags
|
|
305
|
+
├── gates.py GATES{} · PARAMETRIC_GATES{} · GATE_IDS{}
|
|
306
|
+
├── noise_model.py Kraus channels · stochastic trajectory engine
|
|
307
|
+
├── parser.py QASMParser · QASMCircuit · OpenQASM 2.0 / 3.0
|
|
308
|
+
├── compiler.py _apply_gate_fast_step (jit) · _compile_and_run_circuit_jit
|
|
309
|
+
├── simulator.py DenseSVSimulator · vmap batch VQE · chunked execution
|
|
310
|
+
└── dash.py ipywidgets dashboard · VQE engine · MD simulation
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**Data flow per run:**
|
|
314
|
+
```
|
|
315
|
+
▶ Run
|
|
316
|
+
└─ core_calcolo_quantistico() parse → JIT execute → apply noise
|
|
317
|
+
├─ ottimizza_vqe() Hellmann-Feynman AD → ADAM → df_vqe_telemetry
|
|
318
|
+
├─ run_md_simulation_dummy() QM/MM dynamics → df_md_telemetry + Pearson matrix
|
|
319
|
+
└─ build_panel_*(res) matplotlib figure → display()
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## ▍ Core Features
|
|
325
|
+
|
|
326
|
+
| Feature | Detail |
|
|
327
|
+
|---|---|
|
|
328
|
+
| **Linear Kernel Fusion** | Stride-sliced tensor ops via JAX XLA — zero Kronecker matrices |
|
|
329
|
+
| **Circuit Chunking** | Fixed-size JIT blocks eliminate tracer overhead on 1000+ gate circuits |
|
|
330
|
+
| **Kraus Noise Channels** | `depolarizing` `amplitude_damping` `phase_damping` `bitflip` `combined` — stochastic, O(2ⁿ) cost |
|
|
331
|
+
| **VQE + ADAM** | Hellmann-Feynman gradient via JAX AD · positional parameter injection into any QASM 2.0 |
|
|
332
|
+
| **vmap Batch Sweep** | `run_parametric_batch_jit()` evaluates full parameter grids in one JIT call |
|
|
333
|
+
| **Backend Agnostic** | NumPy CPU · JAX XLA CPU/TPU · CuPy CUDA — runtime selection, zero code changes |
|
|
334
|
+
| **Live Dashboard** | 8-panel ipywidgets telemetry: probability, VQE energy, entropy, purity, gradient, noise, θ-correction, Pearson heatmap |
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## ▍ Benchmarks
|
|
339
|
+
|
|
340
|
+
> Measured on Google Colab Free Tier (CPU runtime)
|
|
341
|
+
|
|
342
|
+
| Metric | Value |
|
|
343
|
+
|---|---|
|
|
344
|
+
| Numerical drift (80-layer Ansatz, 1360 gates) | `Δ = 1.11 × 10⁻¹⁶` |
|
|
345
|
+
| Memory footprint @ 20q | `32 MB` (float64) · `16 MB` (float32) |
|
|
346
|
+
| JIT compile overhead (first run) | `< 400 ms` |
|
|
347
|
+
| Gate throughput after warm-up | `> 10⁶ gates/s` (CPU) |
|
|
348
|
+
| Maximum tested qubits (Colab Free) | `24q` stable · `33q` high-RAM runtime |
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## ▍ Dashboard Panels
|
|
353
|
+
|
|
354
|
+
| Panel | Contents |
|
|
355
|
+
|---|---|
|
|
356
|
+
| **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 |
|
|
357
|
+
| **Fisica Stato** | Bloch projection · Schmidt rank · coherence vector |
|
|
358
|
+
| **Mosaico 1008q** | 2D probability density map up to 1008 qubits |
|
|
359
|
+
| **VQE Results** | 6-subplot telemetry: energy convergence, entropy, purity, ‖∇L‖, noise factor, θ-correction |
|
|
360
|
+
| **MD Results** | 6-subplot MD telemetry + masked Pearson correlation heatmap |
|
|
361
|
+
| **Performance** | Gate throughput · JIT compile time · RAM usage |
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## ▍ Circuit Library (80+ presets)
|
|
366
|
+
## ▍ Circuit Library (30+ presets)
|
|
367
|
+
|
|
368
|
+
All circuits are stored as OpenQASM 2.0 strings in `QASM_LIBRARY`.
|
|
369
|
+
|
|
370
|
+
**Standard** — Bell Φ⁺, QFT 4q/8q, Toffoli, Adder 2-bit, Deutsch-Jozsa, Bernstein-Vazirani
|
|
371
|
+
**Algorithms** — Grover 3q/4q, Simon 4q, Shor 15, HHL, QAOA Max-Cut 4q, QPE 5q, Quantum Walk, Teleportation, BB84
|
|
372
|
+
**Topological** — Anyonic Braiding 6q, Charge Pump 8q, DiamondPhi 12q, Omega Phase Lock 8q, Arecibo DeepField 16q, ARECIBO v11.3 SINGULARITY
|
|
373
|
+
**Peptide / Biological** — Furin RRAR 8q, Hemoglobin MVLSPADK 8q, Spike 8q/16q, p53 Guardian 24q, WormholeTriplePeptide 24q
|
|
374
|
+
**Stress Tests** — Hardware Stress, Quantum Supremacy, Interference Stress, BGQ 32q, Twin Shield Full Resonance 32q, Nuovo Circuito 33q
|
|
375
|
+
|
|
376
|
+
**Proprietary phase constants used in topological circuits:**
|
|
377
|
+
|
|
378
|
+
| Constant | Value (rad) | Physical origin |
|
|
379
|
+
|---|:---:|---|
|
|
380
|
+
| φ (Golden Ratio) | 1.6180 | Tatopenn φ-resonance |
|
|
381
|
+
| sp³ diamond angle | 1.9106 | Carbon tetrahedral bond |
|
|
382
|
+
| Topological lock | 3.0718 | Near-π translocation phase |
|
|
383
|
+
| Omega / Fe₂S₂ | 6.1574 | Iron-sulfur cluster phase lock |
|
|
384
|
+
| BGQ wormhole kick | 0.7000 | BGQ wormhole kickback amplitude |
|
|
385
|
+
**Topological** — Anyonic Braiding 6q, Charge Pump 8q
|
|
386
|
+
**Stress Tests** — Hardware Stress, Quantum Supremacy, Interference Stress
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## ▍ VQE Engine
|
|
392
|
+
|
|
393
|
+
**Positional parameter injection** — `QASMParser` tokenizes all literals to `0.0` for JIT speed. VQE recovers parameters by:
|
|
394
|
+
1. counting parametric gates (`rx ry rz p u1 cp crz`) → `n_params`
|
|
395
|
+
2. initializing `θ ∈ ℝⁿ` uniform in `[−π, π]`
|
|
396
|
+
3. injecting `θ[i]` sequentially by gate order in the AST via `risolvi_qasm()`
|
|
397
|
+
|
|
398
|
+
Compatible with any custom OpenQASM 2.0 string without pre-labelling.
|
|
399
|
+
|
|
400
|
+
**Gradient & update rule:**
|
|
401
|
+
|
|
402
|
+
$$\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}$$
|
|
403
|
+
|
|
404
|
+
**Telemetry columns** (→ `df_vqe_telemetry`):
|
|
405
|
+
|
|
406
|
+
| Column | Unit | Description |
|
|
407
|
+
|---|---|---|
|
|
408
|
+
| `VQE_Energy` | Ha | ⟨ψ\|H\|ψ⟩ |
|
|
409
|
+
| `Entropy` | bit | −Tr(ρ log₂ ρ) |
|
|
410
|
+
| `Purity` | — | Tr(ρ²) ∈ [1/d, 1] |
|
|
411
|
+
| `Gradient` | — | ‖∇L‖ — barren plateau detection |
|
|
412
|
+
| `Noise_Factor` | — | fidelity-derived noise proxy |
|
|
413
|
+
| `Theta_Correction` | rad | ADAM step norm |
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## ▍ Hamiltonian Library
|
|
418
|
+
|
|
419
|
+
Auto-filtered by qubit count to prevent shape mismatch.
|
|
420
|
+
|
|
421
|
+
| Molecule | Qubits | Bond length | E₀ (Ha) |
|
|
422
|
+
|---|:---:|:---:|:---:|
|
|
423
|
+
| H₂ | 2 | 0.74 Å | −1.13 |
|
|
424
|
+
| H₃⁺ | 3 | 0.85 Å | −1.28 |
|
|
425
|
+
| LiH | 4 | 1.40 Å | −2.31 |
|
|
426
|
+
| H₂O | 5 | 0.96 Å | −4.12 |
|
|
427
|
+
|
|
428
|
+
Custom: JSON array of diagonal eigenvalues, length `2^n_qubits`.
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
## ▍ Noise Models
|
|
433
|
+
|
|
434
|
+
All channels applied as post-circuit Kraus operations on the full statevector.
|
|
435
|
+
|
|
436
|
+
| Model | Kraus operators | Physical process |
|
|
437
|
+
|---|---|---|
|
|
438
|
+
| `ideal` | I | noiseless |
|
|
439
|
+
| `depolarizing` | {√(1−p)I, √(p/3)X,Y,Z} | isotropic Pauli error |
|
|
440
|
+
| `amplitude_damping` | {K₀, K₁} | T₁ energy relaxation |
|
|
441
|
+
| `phase_damping` | {K₀, K₁} | T₂ dephasing |
|
|
442
|
+
| `bitflip` | {√(1−p)I, √p·X} | bit flip σₓ |
|
|
443
|
+
| `combined` | depolarizing(p/2) ∘ amp_damp(p/3) | worst-case NISQ |
|
|
444
|
+
|
|
445
|
+
Fidelity: Bhattacharyya `F = Σᵢ √(pᵢqᵢ)` and TVD `= ½Σᵢ|pᵢ−qᵢ|` computed on every noisy run.
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
## ▍ Troubleshooting
|
|
450
|
+
|
|
451
|
+
| Error | Cause | Fix |
|
|
452
|
+
|---|---|---|
|
|
453
|
+
| `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 |
|
|
454
|
+
| VQE telemetry empty | VQE disabled or no parametric gates | Enable **VQE Settings** checkbox; use circuits with `rx/ry/rz` gates |
|
|
455
|
+
| Hamiltonian shape mismatch | JSON array length ≠ 2^n_qubits | Supply exactly `2^n` values (e.g. 16 for 4q) |
|
|
456
|
+
| Barren plateau span not visible | < 3 consecutive epochs with ‖g‖ < 0.01·max‖g‖ | Increase epochs or reduce learning rate |
|
|
457
|
+
| Dashboard blank in JupyterLab | Extension missing | `jupyter labextension install @jupyter-widgets/jupyterlab-manager` |
|
|
458
|
+
| 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 |
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
▍ Mitigation & Predictive Healing Models
|
|
462
|
+
Active error tracking and stabilization parameters integrated natively into the simulation runtime.
|
|
463
|
+
Model Variables / Operators Physical process
|
|
464
|
+
`dephasing_tracking` Δ_pre_emp ∘ Σ predictive deviation vs ideal eigenstate
|
|
465
|
+
`kappa_stabilization` κ-strength routine proactive statevector profile shielding
|
|
466
|
+
`richardson_integration` {λ₁ = 1.0, λ₂ = 2.0} dual-point zero-noise trajectory approximation
|
|
467
|
+
Compilation: Full **XLA Kernel Fusion** via `@jax.jit` for mass-parallelized trajectory sweeps (< 1.0s).
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
▍ Chunk Engines (Anti-OOM)
|
|
471
|
+
All operations parcellized dynamically using dual-stage longitudinal and transverse architectural shields.
|
|
472
|
+
Model Execution parameters Physical process
|
|
473
|
+
`chunk1` `circuit_slice = target[i : i + chunk_size]` instruction loop-unroll kill
|
|
474
|
+
`chunk2` `alloc_dim = 2 ** chunk_size_bits` transverse Hilbert slicing
|
|
475
|
+
`Chunk` `sim = Chunk(n_qubits)` hardware-adaptive anti-OOM
|
|
476
|
+
Performance: Hard-locked at `15%` max RAM available with **-86.47% Latency Collapse** via global static JIT cache injection.
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
🪐 [SHIELD::OOM] // Chunk Engine
|
|
480
|
+
|
|
481
|
+
```python
|
|
482
|
+
from dense_evolution import Chunk
|
|
483
|
+
|
|
484
|
+
sim = Chunk(27)
|
|
485
|
+
circuit_ops = [['h', i] for i in range(27)]
|
|
486
|
+
sim.run_chunk(circuit_ops, 500)
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
🧬 [SYS::ARCH]
|
|
490
|
+
* `chunk1` -> Slices gate arrays into windows to kill JAX compilation stalls.
|
|
491
|
+
* `chunk2` -> Slices raw Hilbert statevectors into isolated RAM allocations.
|
|
492
|
+
|
|
493
|
+
⚡ [BENCH::VERDICT]
|
|
494
|
+
* **Qubits**: 27 Qubits // 134M States.
|
|
495
|
+
* **Memory**: Hard-locked at 15% RAM threshold.
|
|
496
|
+
* **Speed** : **-86.47% Latency Collapse** via Static JIT.
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## ▍ License
|
|
500
|
+
|
|
501
|
+
**Business Source License 1.1** — converts automatically to **Apache 2.0** on **1 June 2029**.
|
|
502
|
+
|
|
503
|
+
- Non-commercial use: unrestricted
|
|
504
|
+
- Commercial use: ≤ 24 allocated qubits · ≤ 1000 circuits/day · ≤ 10,000 shots/circuit
|
|
505
|
+
- Attribution required on all copies: `© 2026 Salvatore Pennacchio <jtatopenn@libero.it> — Dense Evolution`
|
|
506
|
+
|
|
507
|
+
Full text: [LICENSE.md](LICENSE.md)
|
|
508
|
+
|
|
509
|
+
---
|
|
510
|
+
=======
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
\*\*Dashboard (Colab / Jupyter):\*\*
|
|
514
|
+
|
|
515
|
+
```python
|
|
516
|
+
|
|
517
|
+
import dash
|
|
518
|
+
|
|
519
|
+
from IPython.display import display, clear\_output
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
clear\_output()
|
|
524
|
+
|
|
525
|
+
display(dash.dashboard\_unificata)
|
|
526
|
+
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
\---
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
\## ▍ Architecture
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
dense\_evolution/
|
|
542
|
+
|
|
543
|
+
├── registry.py hardware detection · JAX / CuPy / NumPy capability flags
|
|
544
|
+
|
|
545
|
+
├── gates.py GATES{} · PARAMETRIC\_GATES{} · GATE\_IDS{}
|
|
546
|
+
|
|
547
|
+
├── noise\_model.py Kraus channels · stochastic trajectory engine
|
|
548
|
+
|
|
549
|
+
├── parser.py QASMParser · QASMCircuit · OpenQASM 2.0 / 3.0
|
|
550
|
+
|
|
551
|
+
├── compiler.py \_apply\_gate\_fast\_step (jit) · \_compile\_and\_run\_circuit\_jit
|
|
552
|
+
|
|
553
|
+
├── simulator.py DenseSVSimulator · vmap batch VQE · chunked execution
|
|
554
|
+
|
|
555
|
+
├── chunk.py SafeMemoryGuard · CircuitChunker · MemoryChunker · Chunk
|
|
556
|
+
|
|
557
|
+
└── dash.py ipywidgets dashboard · VQE engine · MD simulation
|
|
558
|
+
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
\*\*Data flow per run:\*\*
|
|
564
|
+
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
▶ Run
|
|
568
|
+
|
|
569
|
+
 └─ core\_calcolo\_quantistico() parse → JIT execute → apply noise
|
|
570
|
+
|
|
571
|
+
  ├─ ottimizza\_vqe() Hellmann-Feynman AD → ADAM → df\_vqe\_telemetry
|
|
572
|
+
|
|
573
|
+
  ├─ run\_md\_simulation\_dummy() QM/MM dynamics → df\_md\_telemetry + Pearson matrix
|
|
574
|
+
|
|
575
|
+
  └─ build\_panel\_\*(res) matplotlib figure → display()
|
|
576
|
+
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
\---
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
\## ▍ Core Features
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
| Feature | Detail |
|
|
590
|
+
|
|
591
|
+
|---|---|
|
|
592
|
+
|
|
593
|
+
| \*\*Linear Kernel Fusion\*\* | Stride-sliced tensor ops via JAX XLA — zero Kronecker matrices |
|
|
594
|
+
|
|
595
|
+
| \*\*Circuit Chunking\*\* | Fixed-size JIT blocks eliminate tracer overhead on 1000+ gate circuits |
|
|
596
|
+
|
|
597
|
+
| \*\*Anti-OOM SafeMemoryGuard\*\* | Hard block at 15% free RAM — raises `MemoryPressureError` before JAX crashes |
|
|
598
|
+
|
|
599
|
+
| \*\*Kraus Noise Channels\*\* | `depolarizing` `amplitude\_damping` `phase\_damping` `bitflip` `combined` — stochastic, O(2ⁿ) cost |
|
|
600
|
+
|
|
601
|
+
| \*\*VQE + ADAM\*\* | Hellmann-Feynman gradient via JAX AD · positional parameter injection into any QASM 2.0 |
|
|
602
|
+
|
|
603
|
+
| \*\*vmap Batch Sweep\*\* | `run\_parametric\_batch\_jit()` evaluates full parameter grids in one JIT call |
|
|
604
|
+
|
|
605
|
+
| \*\*Backend Agnostic\*\* | NumPy CPU · JAX XLA CPU/TPU · CuPy CUDA — runtime selection, zero code changes |
|
|
606
|
+
|
|
607
|
+
| \*\*Live Dashboard\*\* | 8-panel ipywidgets telemetry: probability, VQE energy, entropy, purity, gradient, noise, θ-correction, Pearson heatmap |
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
\---
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
\## ▍ Benchmarks
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
> Measured on Google Colab Free Tier (CPU runtime)
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
| Metric | Value |
|
|
624
|
+
|
|
625
|
+
|---|---|
|
|
626
|
+
|
|
627
|
+
| Numerical drift (80-layer Ansatz, 1360 gates) | `Δ = 1.11 × 10⁻¹⁶` |
|
|
628
|
+
|
|
629
|
+
| Memory footprint @ 20q | `32 MB` (float64) · `16 MB` (float32) |
|
|
630
|
+
|
|
631
|
+
| JIT compile overhead (first run) | `< 400 ms` |
|
|
632
|
+
|
|
633
|
+
| Gate throughput after warm-up | `> 10⁶ gates/s` (CPU) |
|
|
634
|
+
|
|
635
|
+
| Maximum tested qubits (Colab Free) | `24q` stable · `33q` high-RAM runtime |
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
\### Anti-OOM Chunk Engine vs PennyLane — Windows CPU (8 GB RAM)
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
> Dense Evolution maintains constant \~2 GB RAM at any qubit count via dynamic chunking.
|
|
644
|
+
|
|
645
|
+
> PennyLane allocates the full statevector — OOM beyond 26q.
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
| Qubits | Hilbert Space | PennyLane | PennyLane RAM | Dense Evolution | Dense RAM | Chunk Geometry |
|
|
650
|
+
|
|
651
|
+
|:------:|:-------------:|:---------:|:-------------:|:---------------:|:---------:|:--------------:|
|
|
652
|
+
|
|
653
|
+
| 24 | 16,777,216 | ✅ SUCCESS | 307 MB | ✅ SUCCESS | 516 MB | 1× (2²⁷) |
|
|
654
|
+
|
|
655
|
+
| 26 | 67,108,864 | ✅ SUCCESS | 1,074 MB | ✅ SUCCESS | 2,050 MB | 1× (2²⁷) |
|
|
656
|
+
|
|
657
|
+
| 28 | 268,435,456 | ❌ OOM | — | ✅ SUCCESS | 2,050 MB | 2× (2²⁷) |
|
|
658
|
+
|
|
659
|
+
| 30 | 1,073,741,824 | ❌ OOM | — | ✅ SUCCESS | 2,048 MB | 8× (2²⁷) |
|
|
660
|
+
|
|
661
|
+
| 32 | 4,294,967,296 | ❌ OOM | — | ✅ SUCCESS | 2,048 MB | 32× (2²⁷) |
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
\---
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
\## ▍ Dashboard Panels
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
| Panel | Contents |
|
|
674
|
+
|
|
675
|
+
|---|---|
|
|
676
|
+
|
|
677
|
+
| \*\*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 |
|
|
678
|
+
|
|
679
|
+
| \*\*Fisica Stato\*\* | Bloch projection · Schmidt rank · coherence vector |
|
|
680
|
+
|
|
681
|
+
| \*\*Mosaico 1008q\*\* | 2D probability density map up to 1008 qubits |
|
|
682
|
+
|
|
683
|
+
| \*\*VQE Results\*\* | 6-subplot telemetry: energy convergence, entropy, purity, ‖∇L‖, noise factor, θ-correction |
|
|
684
|
+
|
|
685
|
+
| \*\*MD Results\*\* | 6-subplot MD telemetry + masked Pearson correlation heatmap |
|
|
686
|
+
|
|
687
|
+
| \*\*Performance\*\* | Gate throughput · JIT compile time · RAM usage |
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
\---
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
\## ▍ Circuit Library (80+ presets)
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
All circuits are stored as OpenQASM 2.0 strings in `QASM\_LIBRARY`.
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
\*\*Standard\*\* — Bell Φ⁺, QFT 4q/8q, Toffoli, Adder 2-bit, Deutsch-Jozsa, Bernstein-Vazirani
|
|
704
|
+
|
|
705
|
+
\*\*Algorithms\*\* — Grover 3q/4q, Simon 4q, Shor 15, HHL, QAOA Max-Cut 4q, QPE 5q, Quantum Walk, Teleportation, BB84
|
|
706
|
+
|
|
707
|
+
\*\*Topological\*\* — Anyonic Braiding 6q, Charge Pump 8q, DiamondPhi 12q, Omega Phase Lock 8q, Arecibo DeepField 16q, ARECIBO v11.3 SINGULARITY
|
|
708
|
+
|
|
709
|
+
\*\*Peptide / Biological\*\* — Furin RRAR 8q, Hemoglobin MVLSPADK 8q, Spike 8q/16q, p53 Guardian 24q, WormholeTriplePeptide 24q
|
|
710
|
+
|
|
711
|
+
\*\*Stress Tests\*\* — Hardware Stress, Quantum Supremacy, Interference Stress, BGQ 32q, Twin Shield Full Resonance 32q, Nuovo Circuito 33q
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
\*\*Proprietary phase constants used in topological circuits:\*\*
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
| Constant | Value (rad) | Physical origin |
|
|
720
|
+
|
|
721
|
+
|---|:---:|---|
|
|
722
|
+
|
|
723
|
+
| φ (Golden Ratio) | 1.6180 | Tatopenn φ-resonance |
|
|
724
|
+
|
|
725
|
+
| sp³ diamond angle | 1.9106 | Carbon tetrahedral bond |
|
|
726
|
+
|
|
727
|
+
| Topological lock | 3.0718 | Near-π translocation phase |
|
|
728
|
+
|
|
729
|
+
| Omega / Fe₂S₂ | 6.1574 | Iron-sulfur cluster phase lock |
|
|
730
|
+
|
|
731
|
+
| BGQ wormhole kick | 0.7000 | BGQ wormhole kickback amplitude |
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
\---
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
\## ▍ VQE Engine
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
\*\*Positional parameter injection\*\* — `QASMParser` tokenizes all literals to `0.0` for JIT speed. VQE recovers parameters by:
|
|
744
|
+
|
|
745
|
+
1\. counting parametric gates (`rx ry rz p u1 cp crz`) → `n\_params`
|
|
746
|
+
|
|
747
|
+
2\. initializing `θ ∈ ℝⁿ` uniform in `\[−π, π]`
|
|
748
|
+
|
|
749
|
+
3\. injecting `θ\[i]` sequentially by gate order in the AST via `risolvi\_qasm()`
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
Compatible with any custom OpenQASM 2.0 string without pre-labelling.
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
\*\*Gradient \& update rule:\*\*
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
$$\\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}$$
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
\*\*Telemetry columns\*\* (→ `df\_vqe\_telemetry`):
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
| Column | Unit | Description |
|
|
770
|
+
|
|
771
|
+
|---|---|---|
|
|
772
|
+
|
|
773
|
+
| `VQE\_Energy` | Ha | ⟨ψ\\|H\\|ψ⟩ |
|
|
774
|
+
|
|
775
|
+
| `Entropy` | bit | −Tr(ρ log₂ ρ) |
|
|
776
|
+
|
|
777
|
+
| `Purity` | — | Tr(ρ²) ∈ \[1/d, 1] |
|
|
778
|
+
|
|
779
|
+
| `Gradient` | — | ‖∇L‖ — barren plateau detection |
|
|
780
|
+
|
|
781
|
+
| `Noise\_Factor` | — | fidelity-derived noise proxy |
|
|
782
|
+
|
|
783
|
+
| `Theta\_Correction` | rad | ADAM step norm |
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
\---
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
\## ▍ Hamiltonian Library
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
Auto-filtered by qubit count to prevent shape mismatch.
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
| Molecule | Qubits | Bond length | E₀ (Ha) |
|
|
800
|
+
|
|
801
|
+
|---|:---:|:---:|:---:|
|
|
802
|
+
|
|
803
|
+
| H₂ | 2 | 0.74 Å | −1.13 |
|
|
804
|
+
|
|
805
|
+
| H₃⁺ | 3 | 0.85 Å | −1.28 |
|
|
806
|
+
|
|
807
|
+
| LiH | 4 | 1.40 Å | −2.31 |
|
|
808
|
+
|
|
809
|
+
| H₂O | 5 | 0.96 Å | −4.12 |
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
Custom: JSON array of diagonal eigenvalues, length `2^n\_qubits`.
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
\---
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
\## ▍ Noise Models
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
All channels applied as post-circuit Kraus operations on the full statevector.
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
| Model | Kraus operators | Physical process |
|
|
830
|
+
|
|
831
|
+
|---|---|---|
|
|
832
|
+
|
|
833
|
+
| `ideal` | I | noiseless |
|
|
834
|
+
|
|
835
|
+
| `depolarizing` | {√(1−p)I, √(p/3)X,Y,Z} | isotropic Pauli error |
|
|
836
|
+
|
|
837
|
+
| `amplitude\_damping` | {K₀, K₁} | T₁ energy relaxation |
|
|
838
|
+
|
|
839
|
+
| `phase\_damping` | {K₀, K₁} | T₂ dephasing |
|
|
840
|
+
|
|
841
|
+
| `bitflip` | {√(1−p)I, √p·X} | bit flip σₓ |
|
|
842
|
+
|
|
843
|
+
| `combined` | depolarizing(p/2) ∘ amp\_damp(p/3) | worst-case NISQ |
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
Fidelity: Bhattacharyya `F = Σᵢ √(pᵢqᵢ)` and TVD `= ½Σᵢ|pᵢ−qᵢ|` computed on every noisy run.
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
\---
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
\## ▍ Mitigation \& Predictive Healing Models
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
Active error tracking and stabilization parameters integrated natively into the simulation runtime.
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
| Model | Variables / Operators | Physical process |
|
|
864
|
+
|
|
865
|
+
|---|---|---|
|
|
866
|
+
|
|
867
|
+
| `dephasing\_tracking` | Δ\_pre\_emp ∘ Σ | predictive deviation vs ideal eigenstate |
|
|
868
|
+
|
|
869
|
+
| `kappa\_stabilization` | κ-strength routine | proactive statevector profile shielding |
|
|
870
|
+
|
|
871
|
+
| `richardson\_integration` | {λ₁ = 1.0, λ₂ = 2.0} | dual-point zero-noise trajectory approximation |
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
Compilation: Full \*\*XLA Kernel Fusion\*\* via `@jax.jit` for mass-parallelized trajectory sweeps (< 1.0s).
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
\---
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
\## ▍ Chunk Engines (Anti-OOM)
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
All operations parcellized dynamically using dual-stage longitudinal and transverse architectural shields.
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
```python
|
|
892
|
+
|
|
893
|
+
from dense\_evolution.chunk import Chunk, SafeMemoryGuard
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
\# Hard block at 15% free RAM — raises MemoryPressureError before JAX crashes
|
|
898
|
+
|
|
899
|
+
sim = Chunk(n\_qubits=30, memory\_threshold=0.15)
|
|
900
|
+
|
|
901
|
+
sim.run\_chunk(circuit)
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
\# Inspect geometry
|
|
906
|
+
|
|
907
|
+
print(sim.num\_chunks) # 8
|
|
908
|
+
|
|
909
|
+
print(sim.chunk\_size\_bits) # 27
|
|
910
|
+
|
|
911
|
+
print(sim.memory\_mb()) # \~2048 MB per chunk
|
|
912
|
+
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
| Class | Role | Protection |
|
|
918
|
+
|
|
919
|
+
|---|---|---|
|
|
920
|
+
|
|
921
|
+
| `SafeMemoryGuard` | RAM monitor | Hard block < 15% free · soft warn < 30% free |
|
|
922
|
+
|
|
923
|
+
| `CircuitChunker` (`chunk1`) | Circuit regista | RAM check before every gate-slice |
|
|
924
|
+
|
|
925
|
+
| `MemoryChunker` | Geometry calculator | Reports `num\_chunks`, `chunk\_dim`, `chunk\_size\_bits` |
|
|
926
|
+
|
|
927
|
+
| `Chunk` (`chunk2`) | Anti-OOM simulator wrapper | Allocates inner sim at `safe\_qubits` only |
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
\*\*SafeMemoryGuard behaviour:\*\*
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
| Condition | Action |
|
|
936
|
+
|
|
937
|
+
|---|---|
|
|
938
|
+
|
|
939
|
+
| free RAM < `threshold` (default 15%) | `MemoryPressureError` — execution halted cleanly |
|
|
940
|
+
|
|
941
|
+
| free RAM < `threshold × 2` (default 30%) | Warning printed to stdout |
|
|
942
|
+
|
|
943
|
+
| Before every gate-slice | `gc.collect()` + RAM check |
|
|
944
|
+
|
|
945
|
+
| Before inner simulator allocation | Pre-allocation check in `Chunk.\_\_init\_\_` |
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
Performance: RAM hard-locked at ≤ `chunk\_size\_bits` qubits per allocation block regardless of logical circuit size.
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
\---
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
\## ▍ Troubleshooting
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
| Error | Cause | Fix |
|
|
962
|
+
|
|
963
|
+
|---|---|---|
|
|
964
|
+
|
|
965
|
+
| `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 |
|
|
966
|
+
|
|
967
|
+
| `MemoryPressureError` | Free RAM below 15% threshold | Free system RAM · reduce `n\_qubits` · lower `memory\_threshold` |
|
|
968
|
+
|
|
969
|
+
| `XlaRuntimeError: RESOURCE\_EXHAUSTED` | Using `DenseSVSimulator` directly on > 27q | Use `Chunk(n\_qubits=N)` instead |
|
|
970
|
+
|
|
971
|
+
| VQE telemetry empty | VQE disabled or no parametric gates | Enable \*\*VQE Settings\*\* checkbox; use circuits with `rx/ry/rz` gates |
|
|
972
|
+
|
|
973
|
+
| Hamiltonian shape mismatch | JSON array length ≠ 2^n\_qubits | Supply exactly `2^n` values (e.g. 16 for 4q) |
|
|
974
|
+
|
|
975
|
+
| Barren plateau span not visible | < 3 consecutive epochs with ‖g‖ < 0.01·max‖g‖ | Increase epochs or reduce learning rate |
|
|
976
|
+
|
|
977
|
+
| Dashboard blank in JupyterLab | Extension missing | `jupyter labextension install @jupyter-widgets/jupyterlab-manager` |
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
\---
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
\## ▍ Changelog
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
\### v8.1.2
|
|
990
|
+
|
|
991
|
+
\- `chunk.py` — `SafeMemoryGuard` class: hard block at configurable free-RAM threshold (default 15%), soft warning at 2× threshold, `gc.collect()` before every check
|
|
992
|
+
|
|
993
|
+
\- `chunk.py` — `Chunk` no longer subclasses `DenseSVSimulator`; inner simulator allocated at `safe\_qubits` only — eliminates `RESOURCE\_EXHAUSTED` on 28q–34q circuits
|
|
994
|
+
|
|
995
|
+
\- `chunk.py` — `CircuitChunker.split\_circuit` RAM-checks every gate-slice before dispatch
|
|
996
|
+
|
|
997
|
+
\- `chunk.py` — `MemoryChunker` attributes (`num\_chunks`, `chunk\_size\_bits`, `dtype`) forwarded as `@property` on `Chunk` for benchmark compatibility
|
|
998
|
+
|
|
999
|
+
\- Fixed `globals()\["QuantumTranspiler"]` anti-pattern → direct relative import
|
|
1000
|
+
|
|
1001
|
+
\- Fixed `\_\_version\_\_` mismatch between `\_\_init\_\_.py` and PyPI release
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
\### v8.1.1
|
|
1006
|
+
|
|
1007
|
+
\- Modular package structure (`dense\_evolution/` directory)
|
|
1008
|
+
|
|
1009
|
+
\- `stress\_test\_quantum.py` deduplicated
|
|
1010
|
+
|
|
1011
|
+
\- `test\_library.py` updated with correct imports
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
|
|
1015
|
+
\### v8.0.0
|
|
1016
|
+
|
|
1017
|
+
\- Initial public release
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
\---
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
\## ▍ License
|
|
1026
|
+
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
\*\*Business Source License 1.1\*\* — free for research, academic, and non-commercial use.
|
|
1030
|
+
|
|
1031
|
+
Commercial use requires written permission from the author.
|
|
1032
|
+
|
|
1033
|
+
Contact: \[jtatopenn@libero.it](mailto:jtatopenn@libero.it)
|
|
1034
|
+
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
\---
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
<div align="center">
|
|
1042
|
+
|
|
1043
|
+
<sub>Dense Evolution · Salvatore Pennacchio · 2026</sub>
|
|
1044
|
+
|
|
1045
|
+
</div>
|
|
1046
|
+
>>>>>>> 10dd0b7 (v8.1.2 - SafeMemoryGuard Anti-OOM, chunk.py rewrite, README update)
|
|
1047
|
+
|
|
1048
|
+
<div align="center">
|
|
1049
|
+
<sub>© 2026 Salvatore Pennacchio — Dense Evolution v8</sub>
|