dense-evolution 8.1.7__tar.gz → 8.1.8__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 (23) hide show
  1. {dense_evolution-8.1.7/dense_evolution.egg-info → dense_evolution-8.1.8}/PKG-INFO +64 -1
  2. dense_evolution-8.1.7/PKG-INFO → dense_evolution-8.1.8/README.md +531 -513
  3. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/dense_evolution/__init__.py +2 -1
  4. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/dense_evolution/chunk.py +10 -0
  5. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/dense_evolution/parser.py +27 -5
  6. dense_evolution-8.1.7/README.md → dense_evolution-8.1.8/dense_evolution.egg-info/PKG-INFO +576 -468
  7. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/dense_evolution.egg-info/SOURCES.txt +0 -2
  8. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/pyproject.toml +1 -1
  9. dense_evolution-8.1.7/dense_evolution/stress_test.py +0 -76
  10. dense_evolution-8.1.7/dense_evolution/test2.py +0 -76
  11. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/dash.py +0 -0
  12. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/dense_evolution/compiler.py +0 -0
  13. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/dense_evolution/gates.py +0 -0
  14. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/dense_evolution/healing.py +0 -0
  15. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/dense_evolution/registry.py +0 -0
  16. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/dense_evolution/simulator.py +0 -0
  17. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/dense_evolution.egg-info/dependency_links.txt +0 -0
  18. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/dense_evolution.egg-info/requires.txt +0 -0
  19. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/dense_evolution.egg-info/top_level.txt +0 -0
  20. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/ia_utils/__init__.py +0 -0
  21. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/ia_utils/vector_healing.py +0 -0
  22. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/license.md +0 -0
  23. {dense_evolution-8.1.7 → dense_evolution-8.1.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dense-evolution
3
- Version: 8.1.7
3
+ Version: 8.1.8
4
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
5
  Author-email: Salvatore Pennacchio <jtatopenn@libero.it>
6
6
  License: Business Source License 1.1
@@ -63,10 +63,16 @@ Dynamic: license-file
63
63
 
64
64
  [![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)
65
65
  [![PyPI](https://img.shields.io/pypi/v/dense-evolution?style=flat-square&color=00e5ff)](https://pypi.org/project/dense-evolution/)
66
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/dense-evolution?style=flat-square&color=00e5ff)](https://pypi.org/project/dense-evolution/)
66
67
  [![Python](https://img.shields.io/badge/Python-3.9+-blue?style=flat-square&logo=python&logoColor=white)](https://www.python.org/)
67
68
  [![License](https://img.shields.io/badge/License-BSL_1.1-orange?style=flat-square)](LICENSE.md)
68
69
  [![Build](https://img.shields.io/badge/Build-Passing-00ff9d?style=flat-square)](https://github.com/tatopenn-cell/Dense-Evolution/actions)
69
70
  [![Cross-Validation CI](https://github.com/tatopenn-cell/Dense-Evolution-Ising-Tests/actions/workflows/ci.yml/badge.svg)](https://github.com/tatopenn-cell/Dense-Evolution-Ising-Tests/actions/workflows/ci.yml)
71
+ [![Latest Release](https://img.shields.io/github/v/release/tatopenn-cell/Dense-Evolution?style=flat-square&color=blueviolet)](https://github.com/tatopenn-cell/Dense-Evolution/releases)
72
+ [![Last Commit](https://img.shields.io/github/last-commit/tatopenn-cell/Dense-Evolution?style=flat-square)](https://github.com/tatopenn-cell/Dense-Evolution/commits/main)
73
+ [![Issues](https://img.shields.io/github/issues/tatopenn-cell/Dense-Evolution?style=flat-square)](https://github.com/tatopenn-cell/Dense-Evolution/issues)
74
+ [![Stars](https://img.shields.io/github/stars/tatopenn-cell/Dense-Evolution?style=flat-square&color=yellow)](https://github.com/tatopenn-cell/Dense-Evolution/stargazers)
75
+ [![JAX](https://img.shields.io/badge/Backend-JAX_XLA-f9ab00?style=flat-square&logo=google&logoColor=white)](https://github.com/google/jax)
70
76
 
71
77
  ---
72
78
 
@@ -160,6 +166,9 @@ dense_evolution/
160
166
  ├── chunk.py SafeMemoryGuard · MemoryChunker · CircuitChunker · Chunk (Anti-OOM)
161
167
  ├── simulator.py DenseSVSimulator · run_parametric_batch_jit · vmap batch VQE
162
168
  └── dash.py ipywidgets dashboard · VQE engine · QM/MM · MD simulation · 3D wavefunction
169
+
170
+ ia_utils/
171
+ └── vector_healing.py median_healing · enhanced_dense_healing_hybrid (NaN/Inf-safe, lazy JAX import)
163
172
  ```
164
173
 
165
174
  **Data flow per run:**
@@ -185,6 +194,7 @@ dense_evolution/
185
194
  | **VQE + ADAM** | Hellmann-Feynman gradient · positional parameter injection into any OpenQASM 2.0 circuit |
186
195
  | **Anti-OOM Engine** | `SafeMemoryGuard` blocks execution before JAX raises `RESOURCE_EXHAUSTED` |
187
196
  | **Predictive Healing** | `healing.py` — Φ_AB alignment, dynamic vector, Σ-sync, `MemoryReflectionEngine` |
197
+ | **Vector Sequence Healing** | `ia_utils/` — `median_healing`, `enhanced_dense_healing_hybrid` — NaN/Inf-safe, lazy JAX import |
188
198
  | **Backend Agnostic** | NumPy CPU · JAX XLA CPU/TPU · CuPy CUDA — runtime selection, zero code changes |
189
199
  | **Live Dashboard** | 8-panel ipywidgets telemetry: probability, VQE energy, entropy, purity, gradient, noise, θ-correction, Pearson heatmap |
190
200
 
@@ -283,6 +293,17 @@ sim.run_chunk(circuit, chunk_size_gates=500)
283
293
 
284
294
  Backward-compatibility aliases: `chunk1 = MemoryChunker`, `chunk2 = Chunk`, `Chunk2Incrociato = Chunk`.
285
295
 
296
+ ### `ia_utils.vector_healing`
297
+
298
+ ```python
299
+ from ia_utils.vector_healing import median_healing, enhanced_dense_healing_hybrid
300
+
301
+ healed, radius = median_healing(vettori, radius_baseline=None)
302
+ healed, metadata = enhanced_dense_healing_hybrid(vettori, radius_baseline=None, median_fallback_threshold=0.1)
303
+ ```
304
+
305
+ See **IA Utils — Vector Sequence Healing** above for details.
306
+
286
307
  ---
287
308
 
288
309
  ## ▍ Gate Library
@@ -350,6 +371,42 @@ All core functions compiled via `@jax.jit`. Event history managed by `MemoryRefl
350
371
 
351
372
  ---
352
373
 
374
+ ## ▍ IA Utils — Vector Sequence Healing
375
+
376
+ `ia_utils/vector_healing.py` — standalone module for cleaning sequences of vectors (e.g. hidden states / embeddings) that may contain `NaN` or `Inf` entries. Both functions preprocess the input (Inf → NaN → column-mean imputation) before healing, so corrupted values never propagate into the output.
377
+
378
+ | Function | Approach | Returns |
379
+ |---|---|---|
380
+ | `median_healing(vettori, radius_baseline=None)` | `scipy.ndimage.median_filter`, dynamic radius `min(20, max(3, n // 3))` | `(healed: np.ndarray, radius: int)` |
381
+ | `enhanced_dense_healing_hybrid(vettori, radius_baseline=None, median_fallback_threshold=0.1)` | Blends the `dense_evolution.healing` Φ-trigger logic with a median fallback, decided per-step | `(healed: np.ndarray, metadata: dict)` |
382
+
383
+ `enhanced_dense_healing_hybrid` metadata:
384
+
385
+ | Key | Type | Description |
386
+ |---|---|---|
387
+ | `fallback_triggered` | `bool` | `True` if the median fallback or dense blending fired at least once |
388
+ | `adaptive_radius_used` | `int` | Baseline radius actually applied |
389
+ | `reconstruction_error` | `float` | Mean norm of the correction applied vs. the sanitized input |
390
+
391
+ ```python
392
+ import numpy as np
393
+ from ia_utils.vector_healing import median_healing, enhanced_dense_healing_hybrid
394
+
395
+ vettori = np.random.default_rng(0).normal(size=(50, 128))
396
+ vettori[10, 3] = np.nan # simulate a corrupted hidden state
397
+ vettori[30, 7] = np.inf
398
+
399
+ healed, radius = median_healing(vettori)
400
+
401
+ healed_hybrid, meta = enhanced_dense_healing_hybrid(vettori)
402
+ print(meta)
403
+ # {'fallback_triggered': True, 'adaptive_radius_used': 16, 'reconstruction_error': 11.48}
404
+ ```
405
+
406
+ `jax` is imported lazily inside `enhanced_dense_healing_hybrid` — `median_healing` and the module import itself work without the `[jax]` extra installed; only calling `enhanced_dense_healing_hybrid` requires it.
407
+
408
+ ---
409
+
353
410
  ## ▍ Anti-OOM Chunk Engine
354
411
 
355
412
  All operations parcellized dynamically using a 4-layer architectural shield.
@@ -468,6 +525,12 @@ All circuits stored as OpenQASM 2.0 strings in `QASM_LIBRARY`.
468
525
 
469
526
  ## ▍ Changelog
470
527
 
528
+ ### v8.1.8
529
+ - **Fixed**: `parser.py` — controlled two-qubit gates (`cx`/`cy`/`cz`/`cp`/`crz`) parsed from QASM in the dashboard layer had control and target swapped relative to `compiler.py`'s documented `(gate, control, target)` contract, breaking entanglement for circuits run through the dashboard. The core `QASMCircuit.to_tuples()` path was already correct.
530
+ - **Fixed**: `parser.py` — range syntax (`q[0:3]`) on single-qubit gates only applied to the first qubit in the range, silently dropping the rest. Now expands into one gate application per qubit, matching the parser's own documented contract.
531
+ - **Fixed**: `from dense_evolution import Chunk` raised `ImportError` — `Chunk` is now re-exported from the package root. Added `get_probabilities()`/`get_statevector()` to `Chunk` for parity with `DenseSVSimulator`.
532
+ - **Removed**: `dense_evolution/test2.py` and `stress_test.py` — byte-identical, assertion-free debug scripts that shipped inside every install with 0% test coverage. Their one real check (Kraus noise is genuinely stochastic across independent runs) is now a real regression test.
533
+
471
534
  ### v8.1.7
472
535
  - `ia_utils/` — new package: `median_healing`, `enhanced_dense_healing_hybrid` for vector sequence healing (NaN/Inf-safe)
473
536
  - `jax` import in `ia_utils.vector_healing` made lazy — importable without the `[jax]` extra