Repository navigation
TESTING/MATGEN: guard zero leading element in CLAGHE - #1366
Merged
langou merged 1 commit intoAug 24, 2026
Merged
Conversation
CLAGHE formed the phase of a Householder reflector as (WN / ABS(WORK(1))) * WORK(1), and used the analogous expression in the band-reduction loop. If WN is nonzero while the leading element rounds to zero, this evaluates as Inf * 0 and contaminates the generated Hermitian matrix with NaNs. Use a finite positive-real phase when the leading element is zero, while preserving the zero-norm and ordinary phase paths. This is the complex-single counterpart of PR Reference-LAPACK#1365's ZLAGHE fix.
langou
approved these changes
Aug 24, 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.
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.
Summary
This is a follow-up to #1365 for the complex-single counterpart,
CLAGHE.CLAGHEcomputes the phase of a Householder reflector using expressions of the formWhen
WNis nonzero but the leading element is exactly zero, the expression evaluates asInf * 0and can produce NaNs. This is possible at higher precision when rounding makes the leading element zero while the remaining vector still has a nonzero norm. The same expression occurs in both reflector-generation loops inCLAGHE.The patch:
WA = ZEROandTAU = ZEROfor a zero norm;WA = CMPLX(WN, 0.0E+0)for a nonzero norm with a zero leading element;The positive-real phase is valid for a zero leading element and yields a finite reflector with
TAU = 1.Validation
gfortran -ffixed-form -ffixed-line-length-72 -fsyntax-only TESTING/MATGEN/claghe.f