Repository navigation
Conversation
xPBSTF rejects a pivot with IF( AJJ.LE.ZERO ) GO TO 50 at four sites per routine. A NaN is not .LE.ZERO, so a band matrix that contains one is factored into a NaN factor and returned with INFO = 0. This is the defect fixed for xPPTRF, xPBTF2 and xPTTRF in Reference-LAPACK#1380; xPOTF2, xPBTF2, xPPTRF, xPSTF2 and xPTTRF now all test AJJ.LE.ZERO.OR.xISNAN( AJJ ). The generalized band drivers xSBGV, xSBGVD, xSBGVX and the Hermitian xHBGV* call xPBSTF and document INFO = N+i when the leading minor of order i of B is not positive definite. With the NaN undetected they report something else. For N = 12, KD = 3, UPLO = 'U', A = 2 on the diagonal and 0.5 beside it, and B = 4 and 1 with B(3,3) = NaN, on the parent commit DPBSTF returns INFO = 0, DSBGV returns INFO = 11 from DSTEQR instead of 15, and DSBGVX returns INFO = 0 with M = 0, a silent success with no eigenvalues. The complex drivers CHBGV and ZHBGV do not return at all for some placements. Add the SISNAN / DISNAN term at all four sites of each of SPBSTF, DPBSTF, CPBSTF and ZPBSTF. A NaN on the diagonal is the pivot itself, so INFO is its column. A NaN off the diagonal is scaled at the pivot of its column and enters the diagonal of an earlier-tested row through the rank-one update, so it is reported at a later pivot; every position in the band reaches a pivot. With the fix the reproducer gives INFO = 3, 15 and 15. Test: the xeigtst drivers only generate positive definite B, and xPBSTF is tested nowhere else, so there are four standalone programs, test_[sdcz]pbstf_nan, in TESTING/EIG, registered in CMake like the other standalone test_* programs there. For six (N, KD) pairs and both values of UPLO each program writes a NaN into every entry of the band of a positive definite B and requires INFO = j from xPBSTF for a NaN at diagonal position j and some INFO in 1..N for a NaN off the diagonal. For a diagonal NaN it also requires INFO = N+j from xSBGV, xSBGVD and xSBGVX (xHBGV* in the complex case) for JOBZ = 'N' and 'V', and INFO = 0 from all of them for the finite matrix. On the parent commit the single and double programs report 718 failures each (250 from xPBSTF, 468 from the drivers); the complex programs do not finish, because CHBGV and ZHBGV hang on a NaN in B. With the fix all four pass. The 11172 SSG, DSG, CSG and ZSG tests and the 810 SSB, DSB, CHB and ZHB tests pass unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
rmlarsen
marked this pull request as draft
November 22, 2026 03:15
rmlarsen
marked this pull request as ready for review
November 22, 2026 03:25
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1502 +/- ##
==========================================
+ Coverage 70.63% 70.67% +0.03%
==========================================
Files 6243 6247 +4
Lines 501290 501588 +298
Branches 23516 23564 +48
==========================================
+ Hits 354100 354502 +402
+ Misses 146327 146203 -124
- Partials 863 883 +20
... and 14 files with indirect coverage changes Continue to review full report in Codecov by Harness.
|
This branch has not been deployed
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.
AI disclosure: This PR was prepared with Claude Code.
Summary
xPBSTFaccepts a NaN pivot and returnsINFO = 0, so a band matrix containing a NaN is "factored" into a NaN factor. This is the defect fixed forxPPTRF,xPBTF2andxPTTRFin #1380, left in the split factorization. The generalized band driversxSBGV,xSBGVD,xSBGVXandxHBGV,xHBGVD,xHBGVXdocumentINFO = N+iwhen the leading minor of order i of B is not positive definite, and with a NaN in B they report something else. For N = 12, KD = 3, A = 2 on the diagonal and 0.5 beside it, and B = 4 and 1 withB(3,3) = NaN:DPBSTFreturnsINFO = 0,DSBGVreturnsINFO = 11fromDSTEQRinstead of 15, andDSBGVXreturnsINFO = 0withM = 0, a silent success with no eigenvalues.CHBGVdoes not return at all on some placements.Description
The four pivot tests in each of
SPBSTF,DPBSTF,CPBSTFandZPBSTFareIF( AJJ.LE.ZERO ), and a NaN compares false.xPOTF2,xPOTRF2,xPBTF2,xPPTRF,xPSTF2andxPTTRFtestAJJ.LE.ZERO.OR.xISNAN( AJJ ).A NaN on the diagonal at j is the pivot itself, so with the guard
INFO = j. A NaN off the diagonal is scaled at the pivot of its column and enters, through the rank-one update, the diagonal of a row whose pivot is tested later, so it is reported at a later pivot. I found no position in the band that cannot reach a pivot, and the test below checks every one.Fix
Add
SISNAN/DISNANto the four tests of each routine, in the style ofxPBTF2. With the fix the reproducer givesDPBSTFINFO = 3,DSBGVINFO = 15andDSBGVXINFO = 15. Matrices without a NaN take exactly the same path as before.xSBGST,xHBGSTand the drivers only passINFOon, so they are unchanged.Reproducer
On master:
With the fix:
Regression test
xPBSTFis not tested by the LIN suite, and thexDRVSGdrivers in the EIG suite only generate positive definite B, so there are four standalone programs,test_[sdcz]pbstf_naninTESTING/EIG, registered in the CMake build like the other standalonetest_*programs there (those have no entries in the Make build either, so these have none).For six (N, KD) pairs, (12,3), (11,4), (7,1), (6,5), (2,1) and (1,0), and both values of UPLO, each program writes a NaN into every entry of the band of a positive definite B. It requires
INFO = jfromxPBSTFfor a NaN at diagonal position j and someINFOin 1..N for a NaN off the diagonal. For a diagonal NaN it also requiresINFO = N+jfromxSBGV,xSBGVDandxSBGVX(xHBGV*for the complex programs) with JOBZ = 'N' and 'V'. For the finite matrix all of them must return 0.On the parent commit the single and double programs each report 718 failures (250 from
xPBSTF, 468 from the drivers). The complex programs do not finish:CHBGVhangs on a NaN in B, and theZHBGVprogram also times out. With the fix all four programs pass.Test suite
The full test suite passes, configured as in CI (
CBLAS=ON,LAPACKE=ON,LAPACKE_WITH_TMG=ON) with the_64API. All 341 CTest entries pass (the 333 of master and the eight new programs), with 5755188 LAPACK tests (5755190 for the_64API), 11973112 LAPACKE tests, 319677 BLAS tests and 645492 CBLAS tests for each API, and 0 numerical errors and 0 other errors. The test counts are those of master; the new programs are not counted in them. A second build with CI's gfortran flags (-O2 -Wall -Wno-unused-dummy-argument -Wno-unused-variable -Wno-unused-label -Werror=conversion -fimplicit-none -frecursive -fcheck=all) passes the suite as well, and the changed files compile with the same warnings as on master. The builds used GNU Fortran and GCC 15.2.0 withCMAKE_BUILD_TYPE=Releaseon x86-64 Linux.Not changed here
xSBGVXandxHBGVXwith a NaN in A (not B) returnINFO = 0withM = 0; nothing checks A. This is a separate matter.Checklist
INFOthey document.)