Repository navigation
Conversation
aggressive_early_deflation sorted the window with a bubble sort ported from LAPACK dlaqr3, but over the deflated part (dlaqr3's initial I = NS + 1 only sets the first pass's end) and with each next window set from the last swap's position. schur_swap reports success even when schur_swap_22 rejects an ill-conditioned swap, so the same pair was compared forever: Mat::eigen of the f32 matrix J_n + 1e-6 G scaled to 2^-100 did not return at n = 128 and 257. The sort now follows dlaqr3: it sorts the undeflated part infqr..ns, ends each pass at kend, one before where the previous pass stopped, and swaps with schur_swap_checked (the dlaexc ports for 1 x 2 and 2 x 1), leaving a rejected pair in place. Upstream faer 0.24.4 has the same code; the upstream report is faer-029. Closes #144 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 29, 2026
Member
Author
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.
Closes #144.
Problem
aggressive_early_deflationsorts the deflation window's eigenvalues with a bubble sort ported from LAPACKdlaqr3. The port had two faults:ns..jw.dlaqr3's initialI = NS + 1only sets the first pass's end, and the port read it as the start of the sort.schur_swapreports success even whenschur_swap_22rejects an ill-conditioned 2 x 2 swap, so the pass recorded the same position every time and compared the same pair forever.Mat::eigenof thef32matrixJ_n + 1e-6 G, scaled to2^-100, did not return at n = 128 and 257.Fix
The sort follows
dlaqr3line by line:infqr..ns.kend, one before where the previous pass stopped, so the sort ends after at mostnspasses whatever the swaps do.schur_swap_checked(thedlaexcports for 1 x 2 and 2 x 1), and a rejected swap leaves the pair in place, asdlaqr3does afterDTREXCfails.After a successful swap, the next position
i + n2equalsDTREXC's adjustedILSTfor all four block-size pairs.Tests
tests::aed_sort_terminates_when_a_swap_fails: runs the reproducer at n = 128 and 257 throughhessenberg_schur_real, each under a 120 s timeout. Onorigin/mainit times out at n = 128; here it finishes in about 2 s. Both factors must be finite, and:2^-100, the residual must be within LAPACK'ssmlnum = safmin * n / eps;2^-80must have residual within10 n eps |H|;10 n eps.2^-90and below, the residual relative to|H|is large onorigin/maintoo, and also with the sort disabled. The input there lies belowsmlnum, and?HSEQRlikewise does not scale its input.Mat::eigenscales its input since LAPACK validation: the nonsymmetric EVD fixtures exceed the GET22-style residual threshold (4 dtypes) #112.cargo test --release -p t4a-faer --lib: 553 passed, 0 failed.linalg::evd: 51 of 52 pass. The failure is the knownc32entry inscripts/lapack-known-failures.json(LAPACK validation: the nonsymmetric EVD fixtures exceed the GET22-style residual threshold (4 dtypes) #112); it goes through the complex Schur, which this PR does not touch.Records
upstream-reports/faer-029-real-schur-aed-sort-hang. It reproduces on faer 0.24.4 (neither size returns within 60 s), and upstreammain0ecd846has the same code.🤖 Generated with Claude Code