Commit 15da603
fix(esn): scale by true spectral radius, not infinity-norm (obligation 1.1) (#101)
## What
`esn::scale_to_spectral_radius` scaled the recurrent matrix by its **max
absolute row sum** (the matrix ∞-norm), which only *bounds* the spectral
radius from above (ρ(W) ≤ ‖W‖∞). So the configured `spectral_radius`
(e.g. `0.9`) was **never the value actually realised** — the true ρ was
some unknown smaller number. This is the genuine correctness bug behind
obligation **1.1** (Echo State Property).
## Fix
- Add `estimate_spectral_radius()` — **power iteration** (deterministic
non-degenerate start vector, convergence-checked, nilpotent/zero-matrix
guards). This estimates |λ_max|, the quantity that actually governs the
Echo State Property.
- `scale_to_spectral_radius()` now scales by the estimated spectral
radius, so the configured value is achieved.
## Tests (added)
- `test_spectral_radius_estimate_diagonal` — diagonal matrix ρ =
max|diag| (exact for power iteration).
- `test_scale_to_spectral_radius_achieves_target` — after scaling, the
**re-estimated ρ = 0.9**, proving the target is realised (not merely
bounded).
- Full suite green: `cargo test -p esn` → 11 unit + 6 integration pass.
## Notes
- Branch is off `main`; clean (no licence churn — that's tracked
separately).
- This is the first proof-obligation made real from the **#84** map.
Closes neurophone **#88**.
Closes #88
https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Gu1JFCZHuBtBhAWPr4sMQw)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 0f215a5 commit 15da603
1 file changed
Lines changed: 71 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
179 | 222 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
189 | 226 | | |
190 | 227 | | |
191 | 228 | | |
| |||
305 | 342 | | |
306 | 343 | | |
307 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
308 | 369 | | |
309 | 370 | | |
310 | 371 | | |
| |||
0 commit comments