Skip to content

TESTING: fix random IL/IU selection in the symmetric eigenvalue testers - #1347

Merged
langou merged 2 commits into
Reference-LAPACK:masterfrom
ACSimon33:random_il_iu_selection
Aug 2, 2026
Merged

langou merged 2 commits into
Reference-LAPACK:masterfrom
ACSimon33:random_il_iu_selection

Conversation

@ACSimon33

Copy link
Copy Markdown
Collaborator

Description

xCHKST, xCHKST2STG and DDRVST never actually tested a partial eigenvalue range. Their "choose random values for IL and IU" code applied INT to the (0,1) deviate instead of to the scaled value:

IL = 1 + ( N-1 )*INT( DLARND( 1, ISEED2 ) )

xLARND(1,·) returns a value strictly inside (0,1), so INT(...) is 0 on every call and the expression collapses to IL = IU = 1. Every RANGE='I'/RANGE='V' test in those routines has been running on a single eigenvector.

Two commits: the fix, then a follow-up that widens the drawn range to the full [1,N].

1. TESTING: fix random IL and IU selection in xCHKST and DDRVST

50 sites in 9 files, rewritten to the form already used by xDRVBD, xDRVSG, xDRVST2STG and the s/c/z xDRVST variants:

IL = 1 + INT( ( N-1 )*DLARND( 1, ISEED2 ) )

2. TESTING: draw IL and IU from the full [1,N] range

1 + INT( (N-1)*u ) with u ∈ (0,1) yields [1, N-1], so IU = N can never be drawn. The consumer in ddrvst.f explicitly guards for it:

IF( IU.NE.N ) THEN
   VU = D1( IU ) + MAX( HALF*( D1( IU+1 )-D1( IU ) ), ... )
ELSE IF( N.GT.0 ) THEN
   VU = D1( N ) + MAX( HALF*( D1( N )-D1( 1 ) ), ... )

The IU.NE.N test exists only to keep D1(IU+1) in bounds, so the ELSE branch was written for a case the generator could not produce. It has never executed. This commit switches all 46 IL/IU draw pairs (92 lines, 30 files, covering x{chk,drv}st, x{chk,drv}st2stg, xdrvsg, xdrvsg2stg, xchkbd, xdrvbd) to:

IL = 1 + INT( N*DLARND( 1, ISEED2 ) )

The (N-1) form predates the git history (2008 trunk import), so there is no recorded rationale. It looks like the linear map of [0,1] onto [1,N], which is correct with NINT but drops the top value under truncation.

ACSimon33 and others added 2 commits August 2, 2026 02:13
INT was applied to the (0,1) deviate instead of the scaled value, so
IL and IU were always 1 and the RANGE='I'/'V' paths never tested more
than a single eigenvector.  Matches the form already used in xDRVBD,
xDRVSG and the other xDRVST variants.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1+INT((N-1)*u) with u in (0,1) can never reach N, so the IU=N branch
of the RANGE='V' bound in xDRVST has been unreachable since the code
was written.  xLARND excludes 0 and 1, so 1+INT(N*u) covers [1,N].

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

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.

Pull request overview

This PR fixes the symmetric/Hermitian eigenvalue tester drivers so that random index-range selection (IL, IU) actually exercises partial eigenvalue/eigenvector computations, and expands the random draw so the full index range [1, N] can be selected (including IU = N).

Changes:

  • Corrects the index-range RNG expressions so IL/IU are no longer effectively constant (= 1) in multiple testers.
  • Switches the scaling from (N-1)/(MNMIN-1) to N/MNMIN so the top endpoint (N or MNMIN) can be drawn.
  • Applies these updates consistently across real/complex and 1-stage/2-stage tester variants.

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.

Show a summary per file
File Description
TESTING/EIG/zdrvst2stg.f Update random IL/IU generation to scale by N so full [1,N] is reachable.
TESTING/EIG/zdrvst.f Same IL/IU scaling fix for the ZDRVST Hermitian tester.
TESTING/EIG/zdrvsg2stg.f Same IL/IU scaling fix for generalized Hermitian tester (2-stage).
TESTING/EIG/zdrvsg.f Same IL/IU scaling fix for generalized Hermitian tester.
TESTING/EIG/zdrvbd.f Update IL/IU scaling to use MNMIN so [1,MNMIN] is reachable.
TESTING/EIG/zchkst2stg.f Fix broken IL/IU selection and widen draw to [1,N] in multiple test sections.
TESTING/EIG/zchkst.f Fix broken IL/IU selection and widen draw to [1,N] in multiple test sections.
TESTING/EIG/sdrvst2stg.f Update random IL/IU generation to scale by N (single precision, 2-stage).
TESTING/EIG/sdrvst.f Update random IL/IU generation to scale by N (single precision).
TESTING/EIG/sdrvsg2stg.f Same IL/IU scaling fix for generalized symmetric tester (single, 2-stage).
TESTING/EIG/sdrvsg.f Same IL/IU scaling fix for generalized symmetric tester (single).
TESTING/EIG/sdrvbd.f Update IL/IU scaling to use MNMIN so [1,MNMIN] is reachable (single).
TESTING/EIG/schkst2stg.f Fix broken IL/IU selection and widen draw to [1,N] in multiple test sections (single, 2-stage).
TESTING/EIG/schkst.f Fix broken IL/IU selection and widen draw to [1,N] in multiple test sections (single).
TESTING/EIG/schkbd.f Update IL/IU scaling to use MNMIN so [1,MNMIN] is reachable (single).
TESTING/EIG/ddrvst2stg.f Update random IL/IU generation to scale by N (double, 2-stage).
TESTING/EIG/ddrvst.f Update random IL/IU generation to scale by N (double).
TESTING/EIG/ddrvsg2stg.f Same IL/IU scaling fix for generalized symmetric tester (double, 2-stage).
TESTING/EIG/ddrvsg.f Same IL/IU scaling fix for generalized symmetric tester (double).
TESTING/EIG/ddrvbd.f Update IL/IU scaling to use MNMIN so [1,MNMIN] is reachable (double).
TESTING/EIG/dchkst2stg.f Fix broken IL/IU selection and widen draw to [1,N] in multiple test sections (double, 2-stage).
TESTING/EIG/dchkst.f Fix broken IL/IU selection and widen draw to [1,N] in multiple test sections (double).
TESTING/EIG/dchkbd.f Update IL/IU scaling to use MNMIN so [1,MNMIN] is reachable (double).
TESTING/EIG/cdrvst2stg.f Update random IL/IU generation to scale by N (complex single, 2-stage).
TESTING/EIG/cdrvst.f Update random IL/IU generation to scale by N (complex single).
TESTING/EIG/cdrvsg2stg.f Same IL/IU scaling fix for generalized Hermitian tester (complex single, 2-stage).
TESTING/EIG/cdrvsg.f Same IL/IU scaling fix for generalized Hermitian tester (complex single).
TESTING/EIG/cdrvbd.f Update IL/IU scaling to use MNMIN so [1,MNMIN] is reachable (complex single).
TESTING/EIG/cchkst2stg.f Fix broken IL/IU selection and widen draw to [1,N] in multiple test sections (complex single, 2-stage).
TESTING/EIG/cchkst.f Fix broken IL/IU selection and widen draw to [1,N] in multiple test sections (complex single).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@langou
langou merged commit fad42f8 into Reference-LAPACK:master Aug 2, 2026
16 checks passed
@ACSimon33 ACSimon33 mentioned this pull request Aug 2, 2026
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