{
  "markdown": "<p align=\"center\">\n  <img src=\"docs/assets/banner.svg\" alt=\"Dense Evolution — NISQ quantum simulation toolkit, JAX-native\" width=\"900\">\n</p>\n\n\n\n<!-- mcp-name: io.github.tatopenn-cell/dense-evolution -->\n**A high-performance quantum simulation toolkit\nStatevector/MPS engines with compilation, noise, VQE, QEC, chemistry, and agent-native tooling.**\n\n[![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)\n[![Docs](https://img.shields.io/badge/docs-tatopenn--cell.github.io-00e5ff?style=flat-square)](https://tatopenn-cell.github.io/Dense-Evolution/)\n[![codecov](https://codecov.io/gh/tatopenn-cell/Dense-Evolution/branch/main/graph/badge.svg)](https://codecov.io/gh/tatopenn-cell/Dense-Evolution)\n[![PyPI](https://img.shields.io/pypi/v/dense-evolution?style=flat-square&color=00e5ff)](https://pypi.org/project/dense-evolution/)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/dense-evolution?style=flat-square&color=00e5ff)](https://pypi.org/project/dense-evolution/)\n[![Python](https://img.shields.io/badge/Python-3.9+-blue?style=flat-square&logo=python&logoColor=white)](https://www.python.org/)\n[![License](https://img.shields.io/badge/License-BSL_1.1-orange?style=flat-square)](LICENSE.md)\n[![Build](https://img.shields.io/badge/Build-Passing-00ff9d?style=flat-square)](https://github.com/tatopenn-cell/Dense-Evolution/actions)\n[![Cross-Validation CI](https://github.com/tatopenn-cell/Dense-Evolution-Discovery/actions/workflows/ci.yml/badge.svg)](https://github.com/tatopenn-cell/Dense-Evolution-Discovery/actions/workflows/ci.yml)\n[![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)\n[![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)\n[![Issues](https://img.shields.io/github/issues/tatopenn-cell/Dense-Evolution?style=flat-square)](https://github.com/tatopenn-cell/Dense-Evolution/issues)\n[![Stars](https://img.shields.io/github/stars/tatopenn-cell/Dense-Evolution?style=flat-square&color=yellow)](https://github.com/tatopenn-cell/Dense-Evolution/stargazers)\n[![JAX](https://img.shields.io/badge/Backend-JAX_XLA-f9ab00?style=flat-square&logo=google&logoColor=white)](https://github.com/google/jax)\n[![DOI](https://zenodo.org/badge/1247011090.svg)](https://doi.org/10.5281/zenodo.21855643)\n[![Featured in Awesome Quantum Software](https://img.shields.io/badge/Featured%20in-Awesome%20Quantum%20Software-blueviolet?style=flat-square)](https://github.com/qosf/awesome-quantum-software)\n\n---\n\n## Table of Contents\n- [What It Is](#-what-it-is)\n- [Install](#-install)\n- [Quick Start](#-quick-start)\n- [Key Features](#-key-features)\n- [Benchmarks](#-benchmarks)\n- [Composer & MCP Server](#-composer--mcp-server)\n- [Key Resources](#-key-resources)\n\n## ▍ What It Is\n\nRun up to 28 qubits in about 3 seconds, without crashing. **Dense Evolution** JIT-compiles statevector circuits through JAX XLA, automatically chunks and — past even that RAM ceiling — spills to disk when memory fills up, so a real simulation stays alive instead of OOM-ing.\n\n📖 **[Full documentation, API reference, and worked examples →](https://tatopenn-cell.github.io/Dense-Evolution/)**\n\nA local Streamlit dashboard and web-based Composer editor are also included — see [Composer & MCP Server](#-composer--mcp-server) below.\n\n---\n\n## ▍ Install\n\n```bash\npip install dense-evolution  # JAX is a core dependency, installed by default\n\n# full stack: GPU · dashboard · Qiskit/PennyLane interop\npip install dense-evolution[full]\n\n# just the interop bridge\npip install dense-evolution[qiskit]\npip install dense-evolution[pennylane]\n\n# Composer's local kernel (see \"Composer\" below)\npip install dense-evolution[composer]\n\n# MCP server for the Composer kernel (see \"MCP Server\" below)\npip install dense-evolution[mcp]\n\n# development\ngit clone https://github.com/tatopenn-cell/Dense-Evolution.git\ncd Dense-Evolution && pip install -e .[full]\n```\n\n<details>\n<summary>⚠️ macOS + <code>dense-evolution[qiskit]</code> users</summary>\n\nQiskit's own `QuantumCircuit.__init__` is known to segfault the whole process on macOS/arm64 (an upstream Qiskit bug, not something Dense-Evolution can fix from its side — see [release v8.1.43](https://github.com/tatopenn-cell/Dense-Evolution/releases/tag/v8.1.43) for the full reproduction). `dense_evolution/interop.py` now warns (`RuntimeWarning`, once per process) the first time you touch the Qiskit bridge on `sys.platform == 'darwin'`, but it does not block — some Qiskit/macOS combinations may work fine. If you hit a crash, `pip install dense-evolution[pennylane]` gives the same circuit-interop functionality without constructing any Qiskit object.\n\n</details>\n\n**Google Colab (3 lines):**\n\n```python\n!git clone https://github.com/tatopenn-cell/Dense-Evolution.git\n%cd Dense-Evolution\n!pip install -e .\n```\n\n---\n\n## ▍ Quick Start\n\n```python\nfrom dense_evolution import DenseSVSimulator, QASMParser\n\n# parse any OpenQASM 2.0 / 3.0 string -- single-qubit rotations, a barrier\n# (a real OpenQASM synchronization marker: parsed like hardware would, no\n# effect on the simulated state), then an entangling layer\nqasm = \"\"\"\nOPENQASM 2.0;\ninclude \"qelib1.inc\";\nqreg q[3];\nrx(pi/3) q[0];\nry(pi/4) q[1];\nh q[2];\nbarrier q;\ncx q[0], q[1];\ncx q[1], q[2];\nrz(pi/6) q[2];\n\"\"\"\n\nparser = QASMParser()\ncircuit = parser.parse(qasm)\n\nsim = DenseSVSimulator(n_qubits=3)\nsim.run_circuit_jit(circuit.to_tuples())\n\nprobs = sim.get_probabilities()\nsv    = sim.get_statevector()\n# probs = [0.3201 0.3201 0.0549 0.0549 0.0183 0.0183 0.1067 0.1067]\n```\n\n**Noise:**\n\n```python\nimport numpy as np\nfrom dense_evolution import DenseSVSimulator, QASMParser, NoiseModel\n\nqasm = 'OPENQASM 2.0; include \"qelib1.inc\"; qreg q[2]; h q[0]; cx q[0],q[1];'\ncircuit = QASMParser().parse(qasm)\n\nsim = DenseSVSimulator(n_qubits=2)\nsim.run_circuit_jit(circuit.to_tuples())\n\nnoisy_sv = NoiseModel.apply_to_sv(np.asarray(sim.sv), n=2, model='depolarizing', p=0.05, rng=np.random.default_rng(0))\nnp.abs(noisy_sv) ** 2\n# [0.   0.5  0.5  0.  ]\n```\n\n**VQE:**\n\n```python\nimport jax\nimport jax.numpy as jnp\nfrom dense_evolution import QASMParser, circuit_to_energy_fn\n\nqasm = 'OPENQASM 2.0; include \"qelib1.inc\"; qreg q[1]; ry(0.0) q[0];'\ncircuit = QASMParser().parse(qasm)\nenergy_fn, n_params = circuit_to_energy_fn(circuit, n_qubits=1)\nh = jnp.array([[1.0, 0.0], [0.0, -1.0]], dtype=jnp.complex128)  # Pauli Z\n\ntheta = jnp.array([0.1])\ngrad_fn = jax.value_and_grad(energy_fn, argnums=0, has_aux=True)\nfor _ in range(40):\n    (energy, sv), grad = grad_fn(theta, h)\n    theta = theta - 0.5 * grad\n# energy = -1.0, theta = [3.14159265]\n```\n\n**Mitigation (ZNE):**\n\n```python\nimport dense_evolution as de\n\ne1, e2, e3 = 1.234, 0.876, 0.611  # values at 1x, 2x, 3x noise\nde.zero_noise_extrapolation([e1, e2, e3], [1.0, 2.0, 3.0])\n# 1.622\n```\n\n**Dashboard (local, Streamlit):**\n\n```bash\npip install \"dense-evolution[dashboard]\"  # JAX already included by default\nstreamlit run tools/dashboard/app.py\n```\n\n**Anti-OOM for large circuits:**\n\n```python\nfrom dense_evolution import Chunk, QASMParser\n\nqasm = 'OPENQASM 2.0; include \"qelib1.inc\"; qreg q[27]; h q[0:27];'\ncircuit = QASMParser().parse(qasm)\n\nsim = Chunk(27)\nsim.run_chunk(circuit.to_tuples(), chunk_size_gates=500)\n```\n\n---\n\n\n## ▍ Key Features\n\n<img src=\"docs/assets/readme_hero_circuit.png\" width=\"400px\" align=\"right\">\n\n- **JIT-fused statevector engine.** No Kronecker-product overhead — stride-sliced linear kernel fusion compiled through JAX XLA, real GPU/TPU dispatch with no code change. [Simulator](https://tatopenn-cell.github.io/Dense-Evolution/api/simulator/) · [MPS backend](https://tatopenn-cell.github.io/Dense-Evolution/api/mps/) for low-entanglement circuits at scale.\n- **Anti-OOM `Chunk` engine.** Circuits too large for one array, split dynamically and sized off the real compute device's own free memory — with disk-backed overflow past even that ceiling. [Chunk guide](https://tatopenn-cell.github.io/Dense-Evolution/api/chunk/).\n- **Real noise, real mitigation.** Stochastic Kraus channels, real-device noise imported from Qiskit backends, and Zero-Noise Extrapolation to correct for it. [Noise](https://tatopenn-cell.github.io/Dense-Evolution/api/noise/) · [Mitigation](https://tatopenn-cell.github.io/Dense-Evolution/api/mitigation/) · [what noise/mitigation/healing each mean](https://tatopenn-cell.github.io/Dense-Evolution/concepts/).\n- **Differentiable VQE, from scratch.** `circuit_to_energy_fn` is the same JAX-differentiable engine real molecular VQE runs on — real Hartree-Fock Hamiltonians, UCCSD/hardware-efficient ansätze, Adam optimization. [Autodiff](https://tatopenn-cell.github.io/Dense-Evolution/api/autodiff/).\n- **OpenQASM 2.0/3.0, both directions.** A real parser, plus Qiskit/PennyLane interop bridges. [QASM Parser](https://tatopenn-cell.github.io/Dense-Evolution/api/parser/) · [Interop](https://tatopenn-cell.github.io/Dense-Evolution/api/interop/).\n- **Code-agnostic QEC decoding**, Majorana/Jordan-Wigner fermion mapping, from-scratch Hartree-Fock for elements outside PennyLane's own basis set, and a traversable-wormhole-inspired teleportation protocol — see the [full API reference](https://tatopenn-cell.github.io/Dense-Evolution/api/) for all of it.\n\n## ▍ Benchmarks\n\nMeasured on Windows, CPU only, 8 GB RAM — PennyLane's `default.qubit` allocates the full statevector; Dense Evolution's `Chunk` holds constant ~2 GB regardless of qubit count.\n\n| Qubits | Hilbert Space | PennyLane | Dense Evolution | Chunk Geometry |\n|:------:|:-------------:|:---------:|:----------------:|:--------------:|\n| 26 | 67,108,864 | ✅ 1,074 MB | ✅ 2,050 MB | 1× (2²⁷) |\n| 28 | 268,435,456 | ❌ OOM | ✅ 2,050 MB | 2× (2²⁷) |\n| 32 | 4,294,967,296 | ❌ OOM | ✅ 2,048 MB | 32× (2²⁷) |\n\nOn Google Colab (12 GB RAM), n=28 runs in ~3s end-to-end (JIT-compiled, `num_chunks=2`) — the multi-chunk path is fast, not just OOM-safe. Past the real RAM ceiling (`Chunk` alone raises `MemoryPressureError` cleanly rather than crashing the process), `allow_disk_overflow=True` falls back to a slower disk-backed path instead of failing — correctness-first, not benchmarked for speed yet. Full measured table: [docs/api/chunk.md](https://tatopenn-cell.github.io/Dense-Evolution/api/chunk/).\n\n\n## ▍ Composer & MCP Server\n\nA real circuit editor (graphical or OpenQASM) running on your own machine, plus an MCP server exposing 22 tools so an agent (Claude Code, Claude Desktop, ...) can drive it directly. [Composer](https://tatopenn-cell.github.io/Dense-Evolution/composer/) · [MCP Server](https://tatopenn-cell.github.io/Dense-Evolution/mcp/).\n\n## ▍ Key Resources\n\n- [Full documentation & API reference](https://tatopenn-cell.github.io/Dense-Evolution/)\n- [Getting Started guide](https://tatopenn-cell.github.io/Dense-Evolution/getting-started/)\n- [Worked examples](https://tatopenn-cell.github.io/Dense-Evolution/examples/)\n- [Issue Tracker](https://github.com/tatopenn-cell/Dense-Evolution/issues)\n\n---\n\n## ▍ Changelog\n\n📜 [Full Changelog & Releases](https://github.com/tatopenn-cell/Dense-Evolution/releases) — every version, latest first.\n\n---\n\n## ▍ License\n\n**Business Source License 1.1** — converts automatically to **Apache 2.0** on **1 June 2029**.\n\n- Non-commercial use: unrestricted\n- Commercial use: ≤ 24 allocated qubits · ≤ 1,000 circuits/day · ≤ 10,000 shots/circuit\n- Attribution required: `© 2026 Salvatore Pennacchio <jtatopenn@libero.it> — Dense Evolution`\n\nFull text: [LICENSE.md](LICENSE.md)\n\n---\n\n## ▍ Cite This\n\nIf Dense-Evolution is useful in academic work, please cite it via the metadata in [CITATION.cff](CITATION.cff) (recognized by GitHub's own \"Cite this repository\" button, and by reference managers that support the [Citation File Format](https://citation-file-format.github.io/)).\n\nArchived on [Zenodo](https://zenodo.org/):\n\n- **Concept DOI** (always resolves to the latest version): [10.5281/zenodo.21855643](https://doi.org/10.5281/zenodo.21855643)\n- **This release (v8.1.61)**: [10.5281/zenodo.22009005](https://doi.org/10.5281/zenodo.22009005)\n\n---\n\n<div align=\"center\">\n  <sub>© 2026 Salvatore Pennacchio — Dense Evolution</sub>\n</div>\n",
  "bytes": 12357,
  "sha": "df5490d948691773f05978f74aadfe315c7ffe1f4884880708ad15da07dab9ca",
  "repo_slug": "tatopenn-cell/dense-evolution",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_tatopenn_cell_dense_evolution_819c9b0a/readme"
}