Skip to content

TESTING: xCHKHS test 11 matches eigenvalues by value - #1491

Open
tesch1 wants to merge 1 commit into
Reference-LAPACK:masterfrom
tesch1:chkhs-eig-order
Open

tesch1 wants to merge 1 commit into
Reference-LAPACK:masterfrom
tesch1:chkhs-eig-order

Conversation

@tesch1

@tesch1 tesch1 commented Nov 14, 2026 •

Copy link
Copy Markdown

Problem

Test 11 of xCHKHS (added in #1410) compares the eigenvalues of xHSEQR with JOB = 'S' (W1) and JOB = 'E' (W3) index by index. xHSEQR gives the order of W only for JOB = 'S' (W(i) = H(i,i)); with JOB = 'E' only the active block is updated, the rounding is different, and the eigenvalues can converge in a different order. The test skips eigenvalues with s(j) < sqrt(ulp) for this reason, but swaps also occur above that limit, including for well-conditioned eigenvalues. The test then reports the distance between two different eigenvalues as an error.

Two cases from OpenBLAS make lapack-test on Apple M4 (the BLAS results are correct to rounding; only the rounding order differs from reference BLAS):

Type 18 (with the new SME2 complex level-3 kernels):

 Matrix order=   16, type=18, seed=2120, 768,2414,2241, result  11 is 3.804D+07
 j   W1(j)                                       W3(j)                                       s(j)
 4  -4.470520223800539-145 -2.340153660314876-145  -1.730052957268723-145 -4.958320996975495-145  1.683E-08
 5  -1.730052957268725-145 -4.958320996975512-145  -4.470520223800536-145 -2.340153660314883-145  4.323E-09

s(4) = 1.683e-8 is just above sqrt(ulp) = 1.49e-8. The printed result is exactly s(4) |W1(4) - W1(5)| / (ulp max|W|); |W1(4) - W1(5)| is half of max|W|.

Type 20 (same build, with reference ZTRMM linked in):

 Matrix order=   16, type=20, seed=  92,1809,3428,4033, result  11 is 1.363D+15
 j   W1(j)                                       W3(j)                                       s(j)
 3  -1.751891102656373+137 -4.113998276324342+137  -4.045524541131387+137 -3.115199442781849+137  5.316E-01
 4  -4.045524541131391+137 -3.115199442781856+137  -1.751891102656374+137 -4.113998276324335+137  6.528E-01

Here the swapped eigenvalues are well-conditioned, so a different skip limit cannot prevent the failure.

In both cases all other eigenvalues agree index by index, and with each W1(j) paired with the nearest W3(i) the lists agree to rounding:

case result 11, by index result 11, nearest W3(i) max |dW| / (ulp max|W|) min gap / max|W|
type 18 3.8e7 1.4e-7 10.7 0.13
type 20 1.4e15 6.1 10.3 0.22

The nearest-W3(i) pairing is a one-to-one exchange of the two indices in both cases.

Change

In all four drivers, each W1(j) is compared with the nearest W3(i) instead of W3(j). The s(j) weighting, the s(j) < sqrt(ulp) skip and the normalization are unchanged. When the eigenvalue gaps are larger than twice the tolerance, each W3(i) can be the nearest value for only one W1(j), so a wrong or missing value in W3 still fails the test.

Testing

  • nep.in with reference BLAS: s, d, c and z pass (gfortran 16, CMake).
  • OpenBLAS make lapack-test on Apple M4 (TARGET=VORTEXM4): 1 COMPLEX16 error before, 0 errors after, in all precisions. The type 20 case above also passes.
  • The test still finds wrong eigenvalues: with W3(2) multiplied by 1 + 1e-10 in zchkhs.f, nep.in reports 190 test 11 failures.

Test 11 (from PR Reference-LAPACK#1410) compares the eigenvalues of xHSEQR with JOB = 'S'
and JOB = 'E' by index. The two paths can return the eigenvalues in a
different order, so a swap of two eigenvalues with s(j) just above
sqrt(ulp) fails the test although the two lists agree. Compare each
W1(j) with the nearest W3(i) instead.
@codecov

codecov Bot commented Nov 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.20%. Comparing base (0c51225) to head (5673c61).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1491   +/-   ##
=======================================
  Coverage   70.20%   70.20%           
=======================================
  Files        6237     6237           
  Lines      500437   500453   +16     
  Branches    23536    23536           
=======================================
+ Hits       351336   351352   +16     
  Misses     148639   148639           
  Partials      462      462           
Components Coverage Δ
BLAS 99.73% <ø> (ø)
CBLAS 97.10% <ø> (ø)
LAPACK 83.63% <ø> (ø)
LAPACKE 2.17% <ø> (ø)
TMGLIB 55.69% <ø> (ø)
BLAS testing 88.77% <ø> (ø)
CBLAS testing 89.65% <ø> (ø)
LAPACK testing 82.39% <100.00%> (+<0.01%) ⬆️
LAPACKE testing ∅ <ø> (∅)
Files with missing lines Coverage Δ
TESTING/EIG/cchkhs.f 69.77% <100.00%> (+0.34%) ⬆️
TESTING/EIG/dchkhs.f 71.89% <100.00%> (+0.28%) ⬆️
TESTING/EIG/schkhs.f 71.89% <100.00%> (+0.28%) ⬆️
TESTING/EIG/zchkhs.f 69.77% <100.00%> (+0.34%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0c51225...5673c61. Read the comment docs.

This branch has not been deployed

No deployments
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.

1 participant