Commit graph

2 commits

Author SHA1 Message Date
allaunthefox
cd91eca22f fix: address 3 bugs from spectral codebook review
Bug 1: Phinary packing not injective (integration_sprint.py)
- Old: float accumulation (phinary += c * PHI^(-i)) loses precision
- New: integer positional packing with provable injectivity
  - Integer coefficients: base = max(|coeff|) + 1
  - Float coefficients: quantize to 16-bit, pack in base 65536
- Round-trip is now guaranteed injective

Bug 2: Torus winding saturates at n >= 65536 (pist_braid_bridge.py)
- spiral_to_torus_winding stores b = n//2 as Q16.16, clamps at 32768
- Added spiral_to_torus_winding_safe() with saturation detection
- Returns (winding, saturated) tuple so callers can handle overflow
- Documented the limitation in docstrings

Bug 3: Power iteration non-convergence (pist_braid_bridge.py + MatrixN.lean)
- power_iteration_q16 now returns (eigenvalue, converged) tuple
- Detects oscillation via Rayleigh quotient stability check
- Added exact_eigenvalue_q16() fallback using numpy
- compute_pist_spectral auto-falls-back on non-convergence
- Lean MatrixN.lean: documented known limitation in docstring

All 3 bugs are from the independent review by Claude Fable.
2026-07-01 21:08:41 +00:00
Allaun Silverfox
553e57fe96 feat(integration): full sprint integration test with real quimb TN backend
- integration_sprint.py: Unified pipeline with inline numba/tqdm stubs
- Real quimb TensorNetwork backend verified (not numpy fallback)
- Erdos-Renyi G(20, 1/20): 28/28 checks pass across all modes
- Cross-mode agreement: CV=0.0000 (perfect agreement)
- Phi-corkscrew spiral index: 20121 -> DNA: PZCGB (Hachimoji 8-state)
- 4 modes: esp32, photonic, quantum, tensor -- all agree
- Auto-OOM fallback for n>20 on memory-constrained systems
- Receipt: sprint_receipt.json
2026-06-23 03:54:34 -05:00