Repository navigation
fix(lsmr): keep MGK's ⟨v, Mv⟩ in range at extreme ‖A‖ - #404
Merged
Merged
Conversation
This was referenced Sep 23, 2026
schroedk
added this pull request to stack #402
September 23, 2026 17:07
schroedk
force-pushed
the
fix/lsmr-metric-range
branch
from
September 23, 2026 17:32
b6d8886 to
7797589
Compare
schroedk
force-pushed
the
fix/lsmr-metric-range
branch
from
September 24, 2026 09:48
7797589 to
94a8b48
Compare
schroedk
removed this pull request from stack #402
September 24, 2026 09:48
schroedk
added this pull request to stack #407
September 24, 2026 09:48
schroedk
force-pushed
the
fix/lsmr-metric-range
branch
from
September 24, 2026 11:31
94a8b48 to
aa1fd8f
Compare
schroedk
force-pushed
the
fix/lsmr-metric-range
branch
2 times, most recently
from
September 24, 2026 12:56
099cd97 to
317b1f7
Compare
MGK normalizes `u` in place once β leaves 1e±64, since `Aᵀu` scales with ‖A‖β; inside that band the stream is unchanged. `alpha_from_vp` lets a NaN ⟨v, Mv⟩ (∞ − ∞ from finite terms) reach its re-sum, which now scales both norms to 2⁵⁰⁰ so a cosine below 2⁻¹⁰⁷⁴ survives. The power-of-two scaling sweep now covers the preconditioned solve, exact up to raw ‖A‖ ≈ 1e244 with ‖M⁻¹‖‖A‖ finite; past it the solve fails with InvalidInput.
schroedk
force-pushed
the
fix/lsmr-metric-range
branch
from
September 24, 2026 12:57
317b1f7 to
c56a756
Compare
Bitwise-identical: to_f64 on 2M random m·2^e plus a sweep, alpha_from_vp's tail on 200k random pairs. Drops the never-read breakdown store of u_norm_inv and restores pow2's doc reason.
A vp whose terms round to subnormals can land below zero for a positive pair; the finite-vp clamp returned α = 0 there, reported as an exact solve. Only a normal vp is trusted over the scaled re-sum.
Run past Krylov exhaustion at extreme anisotropy with tol = 0, h̄ grows by ~1/ε a step until it overflows, and x += t_x·h̄ becomes 0·∞. Only tolerance stops measured x, so a budget stop returned the NaN as Ok. Plain lsmr did this on main; mlsmr started to once #404 recovered overflowing ⟨v, Mv⟩.
schroedk
added a commit
that referenced
this pull request
Sep 24, 2026
Run past Krylov exhaustion at extreme anisotropy with tol = 0, h̄ grows by ~1/ε a step until it overflows, and x += t_x·h̄ becomes 0·∞. Only tolerance stops measured x, so a budget stop returned the NaN as Ok. Plain lsmr did this on main; mlsmr started to once #404 recovered overflowing ⟨v, Mv⟩. Co-Authored-By: Claude <noreply@anthropic.com>
Replaces the target-minus-exponent pair and its parity fix-up; bitwise identical on 400k random pairs, 222k of them through the fallback.
schroedk
force-pushed
the
fix/lsmr-metric-range
branch
from
September 24, 2026 14:07
17eb85f to
1570aab
Compare
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.
Stack 4/5 (extreme scales), on main after #403.
uin place onceβleaves1e±64, sinceAᵀuscales with‖A‖β; inside that band the stream is unchanged.alpha_from_vplets a NaN⟨v, Mv⟩(∞ − ∞from finite terms) reach its re-sum, which scales both norms to2^500so a cosine below2^-1074survives; a subnormal negative⟨v, Mv⟩takes the re-sum's sign.xfails withInvalidInput. Past Krylov exhaustion attol = 0,h̄overflows andxbecame NaN, which budget stops returned asOk(plainlsmron main too;mlsmronce this PR recovered the overflowing dot).Preconditioned solves are exact up to raw
‖A‖ ≈ 1e244with‖M⁻¹‖‖A‖finite; past it they can fail withInvalidInput. The power-of-two scaling sweep gains anmlsmrarm.Mutants: never normalizing
ufails the sweep and the overflowing-dot test; always normalizing fails the headroom pin; the old re-sum fails bothalpha_from_vpunit tests;is_finiteforis_normalfails the subnormal-pair test; dropping the finite-xguard fails both exhaustion cases.