HUB
Sign inSign up
quantummemory-lab logo

credkellar/quantummemory-lab

By credkellar

โ€ขUpdated 17 days ago

QuantumMemory-Lab: quantum memory lab - T1/T2 Kraus channels, Hahn echo, 3-qubit code. Sim only!!!!!

Image
Machine learning & AI
Developer tools
Data science
1

193

credkellar/quantummemory-lab repository overview

โ QuantumMemory-Lab ๐Ÿง โš›๏ธ

Quantum Memory Lab โ€” by Darion Kellar

Educational quantum memory lab in ONE pure-Python file: single-qubit density matrices built from scratch (2x2 complex arithmetic, no numpy), amplitude damping (T1) and phase damping (T2) applied as exact Kraus channels, a Hahn spin echo that refocuses a labelled quasi-static detuning ensemble (FID coherence 0.000036 at 40 us vs echo 0.9996 at the same total time), a 3-qubit repetition code whose logical error rate p_L = 3p^2 - 2p^3 is enumerated pattern by pattern for both the bit-flip and phase-flip codes (break-even exactly at p = 1/2), a computed memory-lifetime extension (fidelity falls to 0.9 at 11.16 us bare vs 24.85 us coded, x2.23), and a from-scratch kNN memory-health classifier whose labels come from the lab's own health policy.

Pure Python standard library. Zero dependencies. Zero network. Honest scope: every device number is a LABELLED teaching value (T1 = 100 us, T2 = 80 us, detuning spread 0.15 rad/us, error timescale 50 us) โ€” no qubit was stored, no coherence record was set, and nothing here is hardware, a product, or a benchmark of any real device. The arithmetic is exact for the toy channels; the physics claims stop there. Every hardware / product / network / repeater / breakthrough use is a permanent HOLD gate (14 total).

โ ๐Ÿณ Quick start

docker pull credkellar/quantummemory-lab:latest
docker run --rm credkellar/quantummemory-lab:latest

The default command runs the full demo plus the built-in self-checks (CHECKS 71/71).

Run a specific command instead:

docker run --rm credkellar/quantummemory-lab:latest python3 main.py checks    # CHECKS 71/71
docker run --rm credkellar/quantummemory-lab:latest python3 main.py store     # fidelity vs time tables
docker run --rm credkellar/quantummemory-lab:latest python3 main.py echo      # FID vs Hahn echo report
docker run --rm credkellar/quantummemory-lab:latest python3 main.py code      # repetition code + lifetime
docker run --rm credkellar/quantummemory-lab:latest python3 main.py benchmark # bare vs echo vs coded table
docker run --rm credkellar/quantummemory-lab:latest python3 main.py classify  # kNN health classifier report
docker run --rm credkellar/quantummemory-lab:latest python3 main.py holds     # 14 HOLD gates

โ ๐Ÿ”ฌ What's inside

  • Density matrices from scratch โ€” 2x2 complex helpers (multiply, dagger, Kronecker, trace, closed-form eigenvalues); every stored state is checked for trace 1, Hermiticity, purity, and positive eigenvalues after each channel.
  • Kraus channels, exact โ€” amplitude damping with gamma = 1 - exp(-t/T1): F(|1>) = exp(-t/T1) to 1e-9. Phase damping: F(|+>) = (1 + exp(-t/T2)) / 2 exactly โ€” 0.6839 at t = T2 โ€” matched against the Kraus computation, never quoted.
  • Hahn echo vs FID โ€” a 401-member detuning ensemble with Gaussian weights: free-induction coherence dies on the T2* = 9.43 us scale (0.000036 at 40 us), while the echo โ€” which cancels every static detuning exactly and only feels the labelled slow drift โ€” holds 0.9996 at the same 40 us.
  • Repetition code, enumerated โ€” all 8 flip patterns weighted exactly; bit-flip and phase-flip codes both land on p_L = 3p^2 - 2p^3 (p = 0.1 -> 0.028, a x3.57 gain; p = 0.01 -> 0.000298, x33.56), cross-checked against an 8x8 density-matrix mixture. The code wins exactly when p < 1/2; break-even at p = 1/2 is asserted.
  • Lifetime, computed โ€” under the labelled flip model p(t) = (1 - exp(-t/50 us)) / 2, storage fidelity reaches 0.9 at 11.16 us bare vs 24.85 us coded: a x2.23 extension found by bisection on the exact formulas.
  • Storage benchmark โ€” bare vs echo vs coded at matched times in one table, including the honest crossover: the code's edge fades as p(t) saturates toward 1/2.
  • TinyML kNN classifier โ€” healthy / degraded / lost from (fidelity, t/T2, p_L); labels generated by the lab's own health policy over its training grid.
  • Advisory seats โ€” Gemini Argon 4 DECIDER (names-only, tighten-only, sha256 trace), Muse advisor (can never override HOLD), Google Flow plan-only (rendered = False, live = 0).

โ โœ… Verified

  • pytest: 40 passed
  • Built-in checks: CHECKS 71/71
  • Deterministic: double-run byte-identical
  • Base image: python:3.12-slim

โ ๐Ÿท๏ธ Categories

Science ยท Developer tools ยท Machine learning & AI

  • License: MIT ยฉ 2026 Darion Kellar
  • Image: credkellar/quantummemory-lab:latest
Tag summary
Recent tags
Content type
Image
Digest
sha256:02dcaef1fโ€ฆ
Size
41.5 MB
Last updated
17 days ago
docker pull credkellar/quantummemory-lab:latest