aa: make rank tolerance dim-independent (len·ε·|R₁₁|)#46
Merged
Conversation
The pivoted-QR rank tolerance was aug_rows·ε·|R₁₁| with aug_rows = dim + mem, following LAPACK's max(m,n)·ε·σ₁ convention. For AA this conflates two different dimensions: `dim` is the caller's state vector length, while the inner LS that we're rank-revealing has only `len` columns (where len ≤ mem, typically 5–20). The worst-case Wilkinson bound does grow with row count, but when the row count is the user's fixed-point state — not the algorithmic size of the LS — scaling the tolerance by it is a category error. Concrete consequence: at large state dim the old floor can exceed the noise floor the regularizer itself enforces. With reg=1e-12 and dim=1e6 the old tolerance (~2e-10 × |R₁₁|) sits well above the √r floor (1e-6 × |R₁₁|) that the augmented √r·I rows guarantee by construction. Columns the regularizer certifies as healthy could be silently dropped. Switching to len·ε·|R₁₁| decouples the tolerance from dim while remaining tiny in absolute terms (len ≤ mem ≤ ~20 in practice). No observable change on the existing bench (all 14 configs identical iteration counts and final errors); this is a large-dim robustness fix, not a perf change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
bodono
added a commit
that referenced
this pull request
Apr 22, 2026
Since 0.0.2: - Pivoted-QR solver hygiene: warn on mem>dim, slim aa_reset (#44) - Runtime min_len knob to gate when AA starts extrapolating (#45) - Dim-independent rank tolerance (len·ε·|R₁₁|) (#46) - Lifetime diagnostics API: aa_get_stats + AaStats struct with split rejection-cause counters (#47) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
aug_rows·ε·|R₁₁|withaug_rows = dim + mem, following LAPACK'smax(m,n)·ε·σ₁convention. For AA this conflates two different dimensions:dimis the caller's state vector length, while the inner LS we're rank-revealing has onlylencolumns (len ≤ mem, typically 5–20).len·ε·|R₁₁|decouples the tolerance fromdim. Principled argument: the rank question is about thelencolumns of[A; √r I_len]; the talldimrows are the caller's state, not part of the LS's algorithmic dimension.reg=1e-12anddim=1e6, old tol ≈ 2e-10·|R₁₁| sits well above the √r floor (1e-6·|R₁₁|) that the augmented√r·Irows guarantee by construction — columns the regularizer certifies as healthy could be silently dropped.Test plan
make LDLIBS="-framework Accelerate" test)🤖 Generated with Claude Code