Tatopenn commited on
Commit
67b79df
·
verified ·
1 Parent(s): 9131ae9

Sync: MkDocs documentation site + GitHub Pages deploy

Browse files
dense_evolution/parser.py CHANGED
@@ -32,7 +32,7 @@ class QASMCircuit:
32
  def to_tuples(self) -> List[Tuple]:
33
  """
34
  Convert ops to the tuple format expected by DenseSVSimulator.run_circuit:
35
- (name, qubit0[, qubit1, ...][, param0, ...])
36
 
37
  BUG FIX (original): the original returned
38
  (name,) + tuple(qubits) + tuple(params)
 
32
  def to_tuples(self) -> List[Tuple]:
33
  """
34
  Convert ops to the tuple format expected by DenseSVSimulator.run_circuit:
35
+ `(name, qubit0, [qubit1, ...], [param0, ...])`
36
 
37
  BUG FIX (original): the original returned
38
  (name,) + tuple(qubits) + tuple(params)
docs/LICENSE.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # License
2
+
3
+ {% include-markdown "../license.md" %}
docs/api/autodiff.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Autodiff
2
+
3
+ ::: dense_evolution.autodiff
docs/api/chunk.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Chunk (large-scale, anti-OOM)
2
+
3
+ ::: dense_evolution.chunk
docs/api/compiler.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Compiler
2
+
3
+ ::: dense_evolution.compiler
docs/api/gates.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Gates
2
+
3
+ ::: dense_evolution.gates
docs/api/healing.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Healing (predictive primitives)
2
+
3
+ ::: dense_evolution.healing
docs/api/index.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # API Reference
2
+
3
+ Generated directly from the package's own docstrings via
4
+ [`mkdocstrings`](https://mkdocstrings.github.io/) — nothing here is duplicated by hand, so
5
+ it can't drift out of sync with the code.
6
+
7
+ | Module | What it's for |
8
+ |---|---|
9
+ | [Simulator](simulator.md) | Core dense statevector engine (`DenseSVSimulator`) |
10
+ | [MPS Simulator](mps.md) | Matrix-product-state engine for low-entanglement circuits at scale |
11
+ | [Chunk](chunk.md) | Anti-OOM statevector chunking, including distributed multi-device dispatch |
12
+ | [QASM Parser](parser.md) | OpenQASM 2.0 / 3.0 parsing |
13
+ | [Compiler](compiler.md) | Circuit transpilation (`QuantumTranspiler`) |
14
+ | [Registry & Noise Models](registry.md) | Hardware detection, `NoiseModel` Kraus channels |
15
+ | [Gates](gates.md) | Gate matrix tables (`GATES`, `PARAMETRIC_GATES`, `GATE_IDS`) |
16
+ | [Mitigation](mitigation.md) | Zero-Noise Extrapolation, scalar and density-matrix |
17
+ | [Healing](healing.md) | Predictive-healing primitives |
18
+ | [Interop](interop.md) | Qiskit / PennyLane bridges |
19
+ | [Autodiff](autodiff.md) | Differentiable circuit-to-energy pipeline for VQE |
docs/api/interop.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Interop (Qiskit / PennyLane)
2
+
3
+ ::: dense_evolution.interop
docs/api/mitigation.md ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Mitigation (Zero-Noise Extrapolation)
2
+
3
+ Standard error-mitigation entry points, named the way the field already names them
4
+ (Richardson extrapolation, noise factors, zero-noise extrapolation), plus a density-matrix
5
+ extension (physical-cone projection, Uhlmann fidelity) and a `jax.jit`-compatible variant
6
+ of every entry point.
7
+
8
+ ::: dense_evolution.mitigation
docs/api/mps.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # MPS Simulator
2
+
3
+ ::: dense_evolution.mps
docs/api/parser.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # QASM Parser
2
+
3
+ ::: dense_evolution.parser
docs/api/registry.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Registry & Noise Models
2
+
3
+ ::: dense_evolution.registry
docs/api/simulator.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Simulator
2
+
3
+ ::: dense_evolution.simulator
docs/changelog.md ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # Changelog
2
+
3
+ Included directly from the repository [`README.md`](https://github.com/tatopenn-cell/Dense-Evolution/blob/main/README.md)
4
+ so it never goes stale relative to the single source of truth.
5
+
6
+ {% include-markdown "../README.md" start="## ▍ Changelog" end="## ▍ License" %}
docs/getting-started.md ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Getting Started
2
+
3
+ ## Install
4
+
5
+ ```bash
6
+ pip install dense-evolution # JAX is a core dependency, installed by default
7
+
8
+ # full stack: GPU · dashboard · Qiskit/PennyLane interop
9
+ pip install dense-evolution[full]
10
+
11
+ # just the interop bridge
12
+ pip install dense-evolution[qiskit]
13
+ pip install dense-evolution[pennylane]
14
+
15
+ # development (includes pytest + pytest-cov)
16
+ git clone https://github.com/tatopenn-cell/Dense-Evolution.git
17
+ cd Dense-Evolution && pip install -e .[full,dev]
18
+ ```
19
+
20
+ **Google Colab (3 lines):**
21
+
22
+ ```python
23
+ !git clone https://github.com/tatopenn-cell/Dense-Evolution.git
24
+ %cd Dense-Evolution
25
+ !pip install -e .
26
+ ```
27
+
28
+ ## Quick start
29
+
30
+ ```python
31
+ from dense_evolution import DenseSVSimulator, QASMParser
32
+
33
+ # parse any OpenQASM 2.0 / 3.0 string
34
+ qasm = """
35
+ OPENQASM 2.0;
36
+ include "qelib1.inc";
37
+ qreg q[3];
38
+ h q[0];
39
+ cx q[0], q[1];
40
+ cx q[1], q[2];
41
+ """
42
+
43
+ parser = QASMParser()
44
+ circuit = parser.parse(qasm)
45
+
46
+ sim = DenseSVSimulator(n_qubits=3)
47
+ sim.run_circuit_jit_beast_mode(circuit.to_tuples())
48
+
49
+ probs = sim.get_probabilities()
50
+ sv = sim.get_statevector()
51
+ ```
52
+
53
+ ## Anti-OOM for large circuits
54
+
55
+ ```python
56
+ from dense_evolution import Chunk
57
+
58
+ sim = Chunk(27) # logical 27 qubits
59
+ circuit_ops = [['h', i] for i in range(27)]
60
+ sim.run_chunk(circuit_ops, chunk_size_gates=500) # SafeMemoryGuard active
61
+ ```
62
+
63
+ ## Zero-Noise Extrapolation
64
+
65
+ ```python
66
+ import jax.numpy as jnp
67
+ from dense_evolution import zne_density_matrix, uhlmann_fidelity
68
+
69
+ # rho_at_scales[i]: a noisy density-matrix estimate at noise_factors[i]
70
+ corrected = zne_density_matrix(rho_at_scales, noise_factors=[1.0, 2.0, 3.0])
71
+
72
+ # grade against a known ideal state -- never feed this back into correction
73
+ fidelity = uhlmann_fidelity(corrected, rho_ideal)
74
+ ```
75
+
76
+ See [`dense_evolution.mitigation`](api/mitigation.md) for the full API, including the
77
+ `_jit` variants for use inside a larger `jax.jit`-compiled pipeline.
78
+
79
+ ## Dashboard (local, Streamlit)
80
+
81
+ ```bash
82
+ pip install "dense-evolution[dashboard]" # JAX already included by default
83
+ streamlit run app_dashboard.py
84
+ ```
85
+
86
+ ## Running the test suite
87
+
88
+ ```bash
89
+ pip install -e .[dev]
90
+ pytest test_dense_evolution.py test_mitigation.py test_mps.py -v
91
+
92
+ # with coverage
93
+ pytest --cov=dense_evolution --cov-report=term-missing
94
+ ```
docs/index.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dense-Evolution
2
+
3
+ **Dense statevector quantum simulator · JAX XLA · NISQ · VQE · QML**
4
+
5
+ [![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)
6
+ [![PyPI](https://img.shields.io/pypi/v/dense-evolution?style=flat-square&color=00e5ff)](https://pypi.org/project/dense-evolution/)
7
+ [![Python](https://img.shields.io/badge/Python-3.9+-blue?style=flat-square&logo=python&logoColor=white)](https://www.python.org/)
8
+ [![JAX](https://img.shields.io/badge/Backend-JAX_XLA-f9ab00?style=flat-square&logo=google&logoColor=white)](https://github.com/google/jax)
9
+
10
+ Dense-Evolution is a high-performance statevector simulator for deep NISQ circuits, VQE
11
+ pipelines, and QML workloads. It eliminates Kronecker-product overhead via stride-sliced
12
+ linear kernel fusion compiled through JAX XLA, keeping memory at the theoretical minimum
13
+ of `2ⁿ × 16 bytes`.
14
+
15
+ ## What's in here
16
+
17
+ - **[`DenseSVSimulator`](api/simulator.md)** — the core dense statevector engine, JIT-fused
18
+ circuit execution, projective measurement.
19
+ - **[`MPSSimulator`](api/mps.md)** — matrix-product-state engine for low-entanglement
20
+ circuits at hundreds of qubits, with a `jax.lax.scan`-fused execution path.
21
+ - **[`Chunk`](api/chunk.md)** — anti-OOM statevector chunking for circuits too large for a
22
+ single dense allocation, including a real multi-device distributed dispatch path.
23
+ - **[`QASMParser`](api/parser.md)** — OpenQASM 2.0 / 3.0 parsing, including `for` loops,
24
+ range syntax, and QASM3 classical `bit` registers.
25
+ - **[`dense_evolution.mitigation`](api/mitigation.md)** — Zero-Noise Extrapolation, both the
26
+ classic scalar/vector form and a density-matrix extension (Smolin-Gambetta-Smith physical
27
+ projection, Uhlmann fidelity), every entry point with a `jax.jit`-compatible variant.
28
+ - **[`dense_evolution.healing`](api/healing.md)** — the predictive-healing primitives
29
+ (`calculate_delta_preemp`, `calculate_vettore_dinamico`, ...) ZNE's healing-adapted branch
30
+ is built on.
31
+ - **[`NoiseModel`](api/registry.md)** — Kraus-channel noise (depolarizing, bitflip,
32
+ phaseflip, amplitude damping, and a combined worst-case model), JAX- and NumPy-native.
33
+ - **Interop** with [Qiskit and PennyLane](api/interop.md), and [autodiff](api/autodiff.md)
34
+ through `circuit_to_energy_fn` for gradient-based VQE.
35
+
36
+ ## Where to start
37
+
38
+ New to the package? Start with **[Getting Started](getting-started.md)**.
39
+
40
+ Looking for a specific function or class? Jump straight to the **[API
41
+ Reference](api/index.md)**.
42
+
43
+ Want to see what changed recently? Check the **[Changelog](changelog.md)**.
44
+
45
+ ## Honesty as a design principle
46
+
47
+ This library's docstrings and changelog document real, measured findings — including
48
+ negative results and rejected approaches — not just the features that worked. Where a
49
+ number is quoted (a speedup, a fidelity improvement, a coverage percentage), it was
50
+ measured directly and the measurement is described, not assumed. See the
51
+ [Changelog](changelog.md) for the full history.
mkdocs.yml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ site_name: Dense-Evolution
2
+ site_description: High-performance NISQ statevector quantum circuit simulator, JAX XLA-accelerated.
3
+ site_url: https://tatopenn-cell.github.io/Dense-Evolution/
4
+ repo_url: https://github.com/tatopenn-cell/Dense-Evolution
5
+ repo_name: tatopenn-cell/Dense-Evolution
6
+ edit_uri: edit/main/docs/
7
+
8
+ theme:
9
+ name: material
10
+ palette:
11
+ - media: "(prefers-color-scheme: dark)"
12
+ scheme: slate
13
+ primary: black
14
+ accent: cyan
15
+ toggle:
16
+ icon: material/brightness-4
17
+ name: Switch to light mode
18
+ - media: "(prefers-color-scheme: light)"
19
+ scheme: default
20
+ primary: black
21
+ accent: cyan
22
+ toggle:
23
+ icon: material/brightness-7
24
+ name: Switch to dark mode
25
+ features:
26
+ - navigation.instant
27
+ - navigation.tracking
28
+ - navigation.tabs
29
+ - navigation.top
30
+ - navigation.indexes
31
+ - search.suggest
32
+ - search.highlight
33
+ - content.code.copy
34
+ - content.action.edit
35
+ icon:
36
+ repo: fontawesome/brands/github
37
+
38
+ markdown_extensions:
39
+ - admonition
40
+ - pymdownx.details
41
+ - pymdownx.superfences
42
+ - pymdownx.highlight:
43
+ anchor_linenums: true
44
+ - pymdownx.arithmatex:
45
+ generic: true
46
+ - pymdownx.tabbed:
47
+ alternate_style: true
48
+ - toc:
49
+ permalink: true
50
+
51
+ extra_javascript:
52
+ - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
53
+
54
+ plugins:
55
+ - search
56
+ - include-markdown
57
+ - mkdocstrings:
58
+ handlers:
59
+ python:
60
+ paths: ["."]
61
+ options:
62
+ docstring_style: google
63
+ show_source: true
64
+ show_root_heading: true
65
+ show_root_full_path: false
66
+ merge_init_into_class: true
67
+ separate_signature: true
68
+ show_signature_annotations: true
69
+ members_order: source
70
+ heading_level: 2
71
+
72
+ nav:
73
+ - Home: index.md
74
+ - Getting Started: getting-started.md
75
+ - API Reference:
76
+ - api/index.md
77
+ - Simulator: api/simulator.md
78
+ - MPS Simulator: api/mps.md
79
+ - Chunk (large-scale): api/chunk.md
80
+ - QASM Parser: api/parser.md
81
+ - Compiler: api/compiler.md
82
+ - Registry & Noise Models: api/registry.md
83
+ - Gates: api/gates.md
84
+ - Mitigation (ZNE / density-matrix healing): api/mitigation.md
85
+ - Healing (predictive primitives): api/healing.md
86
+ - Interop (Qiskit / PennyLane): api/interop.md
87
+ - Autodiff: api/autodiff.md
88
+ - Changelog: changelog.md
89
+ - License: LICENSE.md
pyproject.toml CHANGED
@@ -82,6 +82,12 @@ dev = [
82
  "pytest>=7.0.0",
83
  "pytest-cov>=4.0.0"
84
  ]
 
 
 
 
 
 
85
 
86
  [project.urls]
87
  Homepage = "https://github.com/tatopenn-cell/Dense-Evolution"
 
82
  "pytest>=7.0.0",
83
  "pytest-cov>=4.0.0"
84
  ]
85
+ docs = [
86
+ "mkdocs>=1.6.0",
87
+ "mkdocs-material>=9.5.0",
88
+ "mkdocstrings[python]>=0.24.0",
89
+ "mkdocs-include-markdown-plugin>=6.0.0"
90
+ ]
91
 
92
  [project.urls]
93
  Homepage = "https://github.com/tatopenn-cell/Dense-Evolution"