From 2168562eea51ef0eb9933a8f1f26f2f4d34806d3 Mon Sep 17 00:00:00 2001 From: NFTAC Date: Fri, 24 Apr 2026 18:11:52 -0700 Subject: [PATCH] docs(readme): fix spectral-radius example for 1-D diagonal A get_A() returns a 1-D tensor (the diagonal of a diagonal state matrix), so torch.linalg.eigvals(A) raises 'input must have at least 2 dimensions'. The eigenvalues of a diagonal matrix are its diagonal entries, so A.abs().max() is both correct and simpler. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index af2d774..0df5477 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,9 @@ out = model.generate(ids, max_new_tokens=8, n_loops=8) print(f"[{attn_type.upper()}] Generated shape: {out.shape}") A = model.recurrent.injection.get_A() -rho = torch.linalg.eigvals(A).abs().max().item() +# get_A() returns the diagonal of a diagonal state matrix (shape: (dim,)), +# so its eigenvalues are simply its entries. +rho = A.abs().max().item() print( f"[{attn_type.upper()}] Spectral radius ρ(A) = {rho:.4f} (must be < 1)" )