Repository navigation
TESTING/MATGEN: guard zero leading element in ZLAGHE - #1365
Merged
langou merged 1 commit intoAug 24, 2026
Merged
Conversation
langou
approved these changes
Aug 23, 2026
Contributor
|
Should we push the same change for 'CLAGHE' too? if yes, @nakatamaho, can you do it? |
Contributor
Author
|
I'll reaise a PR soon |
Contributor
Author
|
#1366 here it is. Thanks! |
langou
pushed a commit
that referenced
this pull request
Aug 24, 2026
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 #1365's ZLAGHE fix.
Contributor
|
Thanks! |
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
ZLAGHEcomputes the phase of a Householder reflector with expressions of the form:When
WNis nonzero but the leading element is exactly zero, this evaluates asInf * 0and produces NaNs. This can occur at higher precision because rounding may make the leading element exactly zero while the remaining vector has a nonzero norm.This patch handles both reflector-generation loops:
WA = ZERO,TAU = ZERO;WA = DCMPLX(WN,0);Choosing a positive-real phase is valid for a zero leading element and produces a finite reflector with
TAU = 1.Motivation
The issue was observed through MPLAPACK's MPFR binary128 (
113-bit) ZHB test withN=20,K=16, clustered eigenvalues.ZLAGHEreturned a matrix containing NaN, which later causedCSTEQRto fail. The same case did not reproduce at 112 or 114 bits.Validation
gfortran -ffixed-form -ffixed-line-length-72 -fsyntax-only TESTING/MATGEN/zlaghe.f