Skip to content

TESTING: Accept the documented xGEES reordering exit codes N+1 and N+2 - #1355

Merged
langou merged 1 commit into
Reference-LAPACK:masterfrom
ACSimon33:accept-gees-reorder-exit-codes
Sep 8, 2026
Merged

langou merged 1 commit into
Reference-LAPACK:masterfrom
ACSimon33:accept-gees-reorder-exit-codes

Conversation

@ACSimon33

Copy link
Copy Markdown
Collaborator

Problem

ded.out (the xeigtstd < ded.in output collected by lapack_testing.py) reports four failures on macOS and on arm64 Linux:

Testing DOUBLE PRECISION 'Nonsymmetric Eigenvalue' (ded.out) - passed: 14678
-->  DDRVES: DGEES1 returned INFO=     6.
-->  DDRVES: DGEES1 returned INFO=     6.
-->  DES:    2 out of  3810 tests failed to pass the threshold
-->  DGET24: DGEESX1 returned INFO=     6.
-->  DGET24: DGEESX1 returned INFO=     6.
-->  DSX:    2 out of  3494 tests failed to pass the threshold
failing to pass the threshold: 4
Info Error: 4

Root cause

The chain is DGEES → DTRSEN → DTREXC → DLAEXC. Instrumenting DLAEXC shows exactly one rejected swap:

J1=2  N1=2  N2=2                     (swap rows 2:3 past rows 4:5)
DNORM  = 1.7182987758677357E+138
THRESH = 3.8153897283071631E+123     (= 10*eps*DNORM)
resid  = 8.0344355986676333E+126     (2105 x THRESH)
DLASY2: SCALE=1.0  XNORM=1.5519803771084378E+07  IERR=1

DLAEXC is doing its job. The Sylvester solution has norm 1.6e7, so the direct 2×2/2×2 swap cannot be performed backward-stably and the Bai–Demmel acceptance test correctly refuses it. DTRSEN reports INFO = 1, and dgees.f maps that to INFO = N+1, documented as "the eigenvalues could not be reordered because some eigenvalues were too close to separate (the problem is very ill-conditioned)".

Fix

Nothing in SRC/ needs to change. Tests 1–6 (unsorted: ‖A − VS·T·VSᵀ‖, orthogonality) pass for this matrix, so the Schur decomposition is backward stable; DLAEXC correctly refuses an unstable swap; INFO = N+1 is exactly what dgees.f documents.

{s,d}drves.f and {s,d}get24.f already tolerate INFO = N+2 but score the equally documented N+1 as a numerical failure. Both are now accepted and reported:

                  IF( IINFO.EQ.N+1 ) THEN
                     WRITE( NOUNIT, FMT = 9991 )'DGEES1', IINFO, N,
     $                  JTYPE, IOLDSD
                     GO TO 220
                  ELSE IF( IINFO.EQ.N+2 ) THEN
                     WRITE( NOUNIT, FMT = 9990 )'DGEES1', IINFO, N,
     $                  JTYPE, IOLDSD
                  ELSE IF( IINFO.NE.0 ) THEN
                     RESULT( 1+RSUB ) = ULPINV
                     ...
  • N+1 — the tests that need the sorted Schur form are left unrun
    (RESULT = -1) instead of set to 1/ulp, and INFO is not set. The
    accepted branch uses the same exit statement the failure path used at that
    site (RETURN at xGEESX1, GO TO 250 at xGEESX2–8, GO TO 300 at
    xGEESX9, GO TO 220 in the drivers).
  • N+2 — unchanged behaviour, it just gains a message. It was previously
    tolerated with no trace in the output.

cdrves.f, zdrves.f, cget24.f and zget24.f need no change: complex Schur
forms consist only of 1×1 blocks, so CTREXC never rejects a swap and N+1
cannot occur.

{S,D}GEES and {S,D}GEESX return N+1 when the eigenvalues are too close for
xTRSEN to reorder, and N+2 when roundoff undoes the sort order afterwards.
Both are documented outcomes for a very ill conditioned matrix, but
{s,d}drves.f and {s,d}get24.f scored N+1 as a numerical failure while N+2 was
tolerated silently.

Accept both and report them with a message naming the known exit code. For
N+1 the tests that need the sorted Schur form are left unrun (RESULT = -1)
rather than set to 1/ulp; N+2 keeps testing exactly as before. This clears the
four DES/DSX failures on matrix type 17 at N=5, where DLAEXC correctly refuses
a 2x2/2x2 swap it cannot perform stably.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings August 7, 2026 14:46

This comment was marked as outdated.

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.38%. Comparing base (69992ad) to head (e2e67bc).
⚠️ Report is 747 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1355       +/-   ##
===========================================
+ Coverage    0.00%   82.38%   +82.38%     
===========================================
  Files        1937     1945        +8     
  Lines      190566   190130      -436     
===========================================
+ Hits            0   156637   +156637     
+ Misses     190566    33493   -157073     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ACSimon33
ACSimon33 requested a balanced review from Copilot September 7, 2026 13:37

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are confined to test harness logic and correctly align expected outcomes with documented xGEES/xGEESX INFO=N+1/N+2 semantics without affecting library routines.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@langou
langou merged commit 169b902 into Reference-LAPACK:master Sep 8, 2026
18 checks passed
@ACSimon33 ACSimon33 mentioned this pull request Oct 19, 2026
1 of 2 tasks
ilayn added a commit to ilayn/semicolon-lapack that referenced this pull request Oct 26, 2026
…ects (#43)

- Use the DLAMCH constant the Fortran asks for in 35 routines (and their
  s/c copies). DBL_EPSILON stood in for DLAMCH('Epsilon'), which is half
  of it, or the reverse. In xLAGTS this doubled the pivot tolerance, and
  inverse iteration in xSTEIN failed on tight clusters, so ZHEEVX/ZHPEVX
  returned INFO > 0 where reference LAPACK succeeds.
- xGEDMD returns after XERBLA in the NaN checks of X and Y.
  Reference-LAPACK/lapack#1395
- ZLAGHE/CLAGHE guard a zero leading element of the reflector.
  Reference-LAPACK/lapack#1365
  Reference-LAPACK/lapack#1366
- xTSQR01 checks the GEMLQ('R','N') residual it computes.
  Reference-LAPACK/lapack#1364
- xDRVES: Fortran xSLECT with SELOPT = 0, complete test 13, and the
  documented xGEES exit codes N+1 and N+2.
  Reference-LAPACK/lapack#1355
- IL/IU drawn from the full [1, N] range in the CHKST, DRVST, DRVSG,
  CHKBD and DRVBD drivers, and the xDRVBD GESVDX tests ported line by
  line.
  Reference-LAPACK/lapack#1347
- xDRVLS random right-hand sides and EPS, real QZ drivers SAFMIN/ULP, RFP
  driver parameters from the *test_rfp.in files, invented singular values
  removed from the xDRVBD generator, new seed for zDRVST/zDRVST2STG.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants