Repository navigation
Fix SGEBAL test failure - #1338
Merged
Merged
Conversation
The relative-error denominator used MAX(A(I,J), AIN(I,J)) without taking absolute values. For entries where both matrices are negative, the subsequent clamp replaced the denominator with SFMIN, and the difference divided by SFMIN overflowed to Infinity in single precision (sbal.in example 11). The complex checkers already use CABS1 here. sbal now reports the same finite largest error (0.100E+01, example 5) as the other three precisions. Co-Authored-By: Claude Fable 5 <[email protected]>
langou
approved these changes
Jul 28, 2026
Contributor
|
Oh my. That was the error!!!!!! 🤦 Well, thanks a lot. Good to fix this. |
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
SCHKBL/DCHKBLmeasure the relative error between the balanced matrix and the storedreference with
The denominator is missing
ABS. For an entry where bothA(I,J)andAIN(I,J)arenegative,
MAXreturns a negative value, the clamp on the next line replaces it withSFMIN, and the (non-negative) numerator is then divided by the smallest normalizednumber.
In single precision, that overflows.
xeigtsts < sbal.inon master reports:The complex checkers already get this right —
CCHKBL/ZCHKBLapplyCABS1to botharguments of the
MAX(TESTING/EIG/cchkbl.f:142).Fix
Take absolute values before the
MAX, matching the complex checkers:Applied to
TESTING/EIG/schkbl.fandTESTING/EIG/dchkbl.f.Effect
SGEBAL(sbal.in)Infinityat example 11, floating overflow0.100E+01at example 5DGEBAL(dbal.in)0.100D+01at example 50.100D+01at example 5 (unchanged)CGEBAL(cbal.in)0.100E+01at example 5ZGEBAL(zbal.in)0.100D+01at example 5All four precisions now report the same finite largest error at the same example.
DCHKBL's reported value does not change on the current data — in double precision theentries hitting the negative-denominator path happen to be exactly equal, so the numerator
is zero and
0/SFMINis harmless. The metric was equally wrong there, though, and wouldmisreport for any input where those entries differ, so it is fixed alongside the single
precision one.
Notes
SCALEcomparison loop just below usesMAX( SCALE( I ), SCALIN( I ) )with noABS. Left as is deliberately:?GEBALreturns scaling factors that are positive powersof the radix, so
ABSwould be a no-op. The complex checkers do the same.SRC/orBLAS/is touched, so no library behaviorchanges — this only fixes the error metric used to report
?GEBALaccuracy.