dense-evolution 8.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,221 @@
1
+ Metadata-Version: 2.4
2
+ Name: dense-evolution
3
+ Version: 8.0.0
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: MIT
7
+ Project-URL: Homepage, https://github.com/tatopenn-cell/Dense-Evolution
8
+ Project-URL: Documentation, https://github.com/tatopenn-cell/Dense-Evolution/wiki
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
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT 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
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: full
35
+ Requires-Dist: jax>=0.4.0; extra == "full"
36
+ Requires-Dist: jaxlib>=0.4.0; extra == "full"
37
+ Requires-Dist: cupy-cuda12x>=12.0.0; extra == "full"
38
+ Dynamic: license-file
39
+
40
+ # đź’Ž Dense Evolution v8.0 (TurboQuant Core)
41
+
42
+ [![Python Version](https://shields.io)](https://python.org)
43
+ [![Backend](https://shields.io)](https://github.com)
44
+ [![License](https://shields.io)](https://opensource.org)
45
+
46
+ **Dense Evolution v8.0** è un simulatore quantistico basato su vettori di stato (*Statevector*) ad altissime prestazioni, ingegnerizzato specificamente per l'esecuzione di circuiti NISQ (Noisy Intermediate-Scale Quantum) complessi, profondi e algoritmi di Quantum Machine Learning (QML) e VQE.
47
+
48
+ L’architettura interna si basa sul principio della **Linear Kernel Fusion** ad allocazione controllata, superando i tradizionali colli di bottiglia legati all’uso della memoria ausiliaria (*scratchpad RAM*) e ridefinendo i limiti computazionali della compilazione statica accelerata via hardware.
49
+
50
+ ---
51
+
52
+ ## 🚀 Caratteristiche Architetturali & Features
53
+
54
+ * **⚡ Linear Kernel Fusion (JAX XLA):** Il simulatore non calcola mai esplicitamente le enormi matrici di gate derivanti dai prodotti tensoriali (Kronecker). L’applicazione degli operatori avviene tramite algoritmi di *stride-slicing* e permutazione lineare sui tensori contigui, riducendo la complessità di memoria spaziale al minimo teorico assoluto.
55
+ * **đź§© Circuit Chunking Transpiler:** Risolve il problema del congelamento o degrado della cache JIT di JAX quando si lavora con migliaia di porte logiche. Il circuito viene frammentato in sotto-blocchi (chunk) geometrici equivalenti, garantendo stabilitĂ  computazionale infinita, azzerando l'overhead di tracing su circuiti massivi.
56
+ * **🎲 Coerenza Stocastica e Collasso d'Onda:** La funzione di misura implementa uno *stride-slicing* chirurgico direttamente sulle matrici di vista hardware (NumPy/CuPy/JAX). Questo garantisce la perfetta convergenza binomiale ed evita l'allocazione di maschere booleane giganti in RAM, prevenendo crash di sistema.
57
+ * **📉 Modelli di Rumore a Traiettoria Kraus:** Consente la simulazione realistica di hardware affetti da rumore ambientale tramite canali di *Amplitude Damping*, *Phase Damping* e *Depolarizzazione*, applicati como salti quantici stocastici discreti senza l’onere computazionale $2^{2n}$ delle matrici di densità piene.
58
+ * **🎛️ Disaccoppiamento Hardware (Agnostic Backend):** Sfrutta un’astrazione polimorfa per selezionare a runtime l’hardware più efficiente: NumPy (CPU standard), JAX (Compilazione JIT hardware parallelizzata CPU/TPU) o CuPy (Calcolo parallelo accelerato su NVIDIA GPU CUDA).
59
+
60
+ ---
61
+
62
+ ## ⚙️ Istruzioni di Installazione
63
+
64
+ Il motore è strutturato in conformità con lo standard **PEP 621** (tramite `pyproject.toml`) ed è completamente installabile tramite `pip` in modalità isolata o editabile per gli sviluppatori.
65
+
66
+ ```bash
67
+ # Clone della repository locale
68
+ git clone
69
+ https://github.com/tatopenn-cell/Dense-Evolution.git
70
+
71
+
72
+ # Installazione Standard (Backend CPU standard NumPy)
73
+ pip install .
74
+
75
+ # Installazione High-Performance (Raccomandata in modalitĂ  sviluppatore editable)
76
+ pip install -e .
77
+ ```
78
+
79
+ ---
80
+
81
+ ## 📊 Benchmark Industriali e Limiti del Sistema
82
+
83
+ Il motore è stato sottoposto a stress-test aggressivi in ambienti a risorse limitate (Google Colab Free), registrando risultati d’élite nel contenimento della memoria e nella precisione aritmetica.
84
+
85
+ ### 1. StabilitĂ  Numerica Assoluta (Zero-Drift Execution)
86
+ Sottoposto ad Ansatz variazionali profondi (oltre 80 strati e 1360 porte parametriche consecutive fuse in un unico blocco XLA), il core del simulatore ha registrato una deriva numerica assoluta controllata pari a:
87
+ $$\Delta = 1.1102230246251565 \times 10^{-16}$$
88
+ Questo valore coincide esattamente con l'**Epsilon di macchina ($\epsilon$)** per la precisione doppia a 64 bit (`float64`). La fusione algebrica dei kernel in XLA annulla l'accumulo sequenziale degli errori di arrotondamento delle funzioni trigonometriche.
89
+
90
+ ### 2. Scaling dei Qubit e Throughput Computazionale (Chunking Engine)
91
+ Grazie al motore di chunking in-place, il simulatore gestisce registri quantistici estesi ottimizzando chirurgicamente la cache di sistema senza generare copie temporanee dello stato:
92
+
93
+
94
+ | Qubits | Dimensione Stato (Ampiezze) | Tempo di Esecuzione (s) | Gates / Secondo | RAM Reale Allocata | Delta RAM a Runtime |
95
+ | :--- | :--- | :--- | :--- | :--- | :--- |
96
+ | **14** | 16.384 | 0.3546 s | 2819.9 | ~0.26 MB | **0.00 MB** |
97
+ | **16** | 65.536 | 0.4217 s | 2370.8 | ~1.04 MB | **0.00 MB** |
98
+ | **24** | 16.777.216 | 0.7090 s | *JIT Standard Tier* | ~256.00 MB | < 1.00 MB |
99
+ | **29** | **536.870.912** | *HPC Chunk Tier* | *Hardware Saturation* | **8192.00 MB** | **0.00 MB** |
100
+
101
+ > 💡 **Nota di Merito:** Il superamento della barriera dei 24 qubit in ambienti con soli 12 GB di RAM totali (Colab Free) evidenzia l’efficacia dell'architettura lineare 1D a norma fissa, che azzera i reshape dinamici a basso livello.
102
+
103
+ ### 3. Parallelizzazione Vettorizzata JAX `vmap` (Batch Engine)
104
+ Il modulo `run_parametric_batch_jit` sfrutta la parallelizzazione inter-circuito per il Quantum Machine Learning. Esegue un singolo tracciamento del grafo computazionale e distribuisce istantaneamente N configurazioni di parametri sulla griglia hardware:
105
+ * **Throughput testato:** 64 circuiti variazionali paralleli eseguiti simultaneamente in **1.96 secondi**.
106
+ * **Tempo medio per circuito:** ⏱️ **0.031 secondi**.
107
+
108
+ ---
109
+
110
+ ## đź’» Esempi Pratici di Codice
111
+
112
+ ### 🛠️ Esempio 1: Esecuzione in Beast Mode (Kernel Fusion JIT)
113
+ Dimostrazione dell'interfaccia ultra-veloce a zero allocazioni. La Beast Mode accetta un array lineare di operazioni stringa per bypassare completamente i controlli dell'interprete Python:
114
+
115
+ ```python
116
+ import dense_evolution as de
117
+
118
+ # Inizializzazione del simulatore a 2 Qubit
119
+ sim = de.DenseSVSimulator(n_qubits=2)
120
+
121
+ # Definizione del circuito strutturato (Porta, Target, Controllo/Parametro)
122
+ # Generazione nativa di uno Stato di Bell entangled
123
+ ops = [
124
+ ["h", 0, -1],
125
+ ["cx", 1, 0]
126
+ ]
127
+
128
+ # Esecuzione istantanea nel compilatore fuso XLA
129
+ sim.run_circuit_jit_beast_mode(ops)
130
+
131
+ print(f"Stato Finale Entangled JIT: {sim.get_statevector()}")
132
+ print(f"ProbabilitĂ  di estrazione: {sim.get_probabilities()}")
133
+ ```
134
+
135
+ ### đź§  Esempio 2: Decomposizione Topologica con il QuantumTranspiler
136
+ Il transpiler integrato scompone le porte logiche non native e complesse a piĂą qubit nelle primitive a 1 e 2 qubit accettate dal core lineare 1D:
137
+
138
+ ```python
139
+ import dense_evolution as de
140
+
141
+ transpiler = de.QuantumTranspiler()
142
+
143
+ # Estrazione della scomposizione esatta di una porta Toffoli (CCNOT) sui qubit 0, 1 e 2
144
+ sequenza_primitive = transpiler.decompose_toffoli(0, 1, 2)
145
+
146
+ print(f"Totale porte primitive generate per il Core V4: {len(sequenza_primitive)}")
147
+ for gate in sequenza_primitive:
148
+ print(f" -> {gate}")
149
+ # Output generato: Sequenza esatta a 15 porte stabili (H, CNOT, T, Tdg)
150
+ ```
151
+
152
+ ### 📉 Esempio 3: Iniezione stocastica del NoiseModel
153
+ Applicazione di canali di rumore realistici NISQ in modalitĂ  stocastica unificata JAX-safe:
154
+
155
+ ```python
156
+ import dense_evolution as de
157
+ import numpy as np
158
+
159
+ sim = de.DenseSVSimulator(n_qubits=2)
160
+
161
+ # Applicazione manuale di una porta singola (Firma: Matrice, Qubit)
162
+ h_matrix = de.GATES['h']
163
+ sim.apply_gate_1q(h_matrix, 0)
164
+
165
+ # Lettura telemetria di sistema in tempo reale (Variabile float globale)
166
+ print(f"RAM attualmente disponibile su Colab: {de.ram_avail:.2f} MB")
167
+
168
+ # Iniezione di rumore di depolarizzazione al 5% sul vettore di stato
169
+ sim.sv = de.NoiseModel.apply_to_sv(
170
+ sv=sim.sv,
171
+ n=2,
172
+ model='depolarizing',
173
+ p=0.05
174
+ )
175
+
176
+ print(f"Stato rumoroso degradato: {sim.get_statevector()}")
177
+ ```
178
+
179
+ ---
180
+
181
+ ## đź“‚ Architettura dei File nella Repository
182
+
183
+ ```text
184
+ Dense-Evolution/
185
+ │
186
+ ├── pyproject.toml # Configurazione PEP 621, build backend e dipendenze opzionali [jax,gpu]
187
+ ├── README.md # Documentazione tecnica ufficiale, telemetria e benchmark (Questo file)
188
+ └── dense_evolution.py # Codice sorgente core del simulatore (DenseSVSimulator v8.0)
189
+ ```
190
+
191
+ ---
192
+
193
+ ## 📜 Licenza e Note Legali
194
+
195
+ Il progetto è interamente distribuito sotto i termini della licenza ufficiale **MIT**.
196
+
197
+ ```text
198
+ MIT License
199
+
200
+ Copyright (c) 2026 salvatore pennacchio [tatopenn-cell]
201
+
202
+ Permission is hereby granted, free of charge, to any person obtaining a copy
203
+ of this software and associated documentation files (the "Software"), to deal
204
+ in the Software without restriction, including without limitation the rights
205
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
206
+ copies of the Software, and to permit persons to whom the Software is
207
+ furnished to do so, subject to the following conditions:
208
+
209
+ The above copyright notice and this permission notice shall be included in all
210
+ copies or substantial portions of the Software.
211
+
212
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
213
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
214
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
215
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
216
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
217
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
218
+ SOFTWARE.
219
+ ```
220
+
221
+
@@ -0,0 +1,6 @@
1
+ dense_evolution.py,sha256=mTEcs4Oe2iluR-7tarQ1_T-h7P1xb9VWl6gk0K6vVVo,64629
2
+ dense_evolution-8.0.0.dist-info/licenses/LICENSE,sha256=wjxTErwZGsS9yWa-zDsu5wrE9i0l7genrBpurGSA6cY,1093
3
+ dense_evolution-8.0.0.dist-info/METADATA,sha256=rTHiCXNF3gZIUmnI7gQNKIoBwTRN9nNcplL7wfmRAcE,11107
4
+ dense_evolution-8.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
5
+ dense_evolution-8.0.0.dist-info/top_level.txt,sha256=_ZDxyMWv8a1jqBeY0_-HWQ6Fjz2N6iC3dRmIeDSrFR0,16
6
+ dense_evolution-8.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 salvatore pennacchio [tatopenn-cell]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ dense_evolution