GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Report an infinite entry in xGESVJ with INFO = -6 by rmlarsen · Pull Request #1512 · Reference-LAPACK/lapack Conversation
Contributor
AI disclosure: This PR was prepared with Claude Code. Summary
Description For each column the initial scaling calls Fix Compare the sum of squares with the overflow threshold instead: Reproducer program repro use, intrinsic :: ieee_arithmetic implicit none integer, parameter :: m = 4, n = 3 double precision :: a(m,n), sva(n), v(n,n), work(100) integer :: info ! finite matrix whose second column has a norm above huge(1d0) call random_number(a) a(1:2,2) = huge(1d0) call dgesvj('G', 'U', 'V', m, n, a, m, sva, 0, v, n, work, 100, info) print *, 'finite, norm > huge: INFO =', info, ' SVA(1) =', sva(1) ! the same matrix with one infinite entry call random_number(a) a(2,2) = ieee_value(1d0, ieee_positive_inf) call dgesvj('G', 'U', 'V', m, n, a, m, sva, 0, v, n, work, 100, info) print *, 'infinite entry: INFO =', info, ' SVA(1) =', sva(1) end program repro On master: With the fix the first line is unchanged, up to the random data, and the second call ends in Regression test
The related routine Test suite The full test suite passes, configured as in CI ( Not changed here
Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsxGESVJ is meant to reject a matrix with an infinite entry with
INFO = -6 ("If INFinite entries in A are detected, the procedure
returns with INFO=-6"). The test after each column's xLASSQ call is
IF( AAPP.GT.BIG ), written for the old xLASSQ, whose scale argument
became infinite. The current xLASSQ returns the scale in AAPP, the
finite constant 1/SBIG for a column with an infinity, and the sum of
squares in AAQQ, which is then Infinity. AAPP never exceeds BIG, so
the test never fires. DGESVJ on a 4-by-3 matrix with one +Inf entry
returns INFO = 0 and SVA(1) = Infinity, in the lower, upper and
general branches alike.
Test the sum of squares against the overflow threshold,
IF( AAQQ.GT.xLAMCH( 'Overflow' ) ), in the three branches of SGESVJ,
DGESVJ, CGESVJ and ZGESVJ. BIG is not used, because CGESVJ defines it
as 1/SFMIN, about 2**126, and a finite column of 2**21 + 8 entries
CMPLX( 2.0**52, 2.0**52 ) has a sum of squares above that although
its norm is far from overflowing. The INFO = -6 is still reported
through XERBLA as before. For finite columns the sum of squares
cannot exceed the overflow threshold, so ordinary inputs, including
columns whose norm overflows and which xGESVJ scales, are unchanged.
NaN is not covered by the documentation and is not reported.
Test: xERRED (path DBD, run by svd.in) passes a 2-by-2 identity with
one infinite entry to xGESVJ with JOBA = 'L', 'U' and 'G', and in the
complex routines also with an infinity in the imaginary part only, and
checks with CHKXER that XERBLA is called with INFO = -6. On the parent
commit all 3 tests (4 in the complex precisions) fail in each
precision ("Illegal value of parameter number 6 not detected"); with
the fix they pass.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
rmlarsen
marked this pull request as draft
rmlarsen
marked this pull request as ready for review
|
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@ ## master #1512 +/- ## ========================================== + Coverage 70.63% 70.67% +0.03% ========================================== Files 6243 6243 Lines 501290 501518 +228 Branches 23516 23516 ========================================== + Hits 354100 354438 +338 + Misses 146327 146218 -109 + Partials 863 862 -1
... and 9 files with indirect coverage changes Continue to review full report in Codecov by Harness.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| $ NMAX, W, 20*NMAX, RW, LW, INFO ) | ||
| CALL CHKXER( 'ZGESVJ', INFOT, NOUT, LERR, OK ) | ||
| A( 2, 1 ) = ZERO | ||
| A( 2, 1 ) = DCMPLX( ZERO, RONE / RZERO ) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
DCMPLX is a non-standard intrinsic. 773fd2f ("TESTING: replace non-standard double complex intrinsics") removed every use from TESTING because NAG Fortran only accepts it under -dcfuns, and this reintroduces it (one use). The NAG jobs are skipped on fork PRs (they finish in a few seconds here) but do build on master, so this would only show up after merge. Use CMPLX( ..., KIND=... ) with a kind parameter, as that commit did.
Found in an AI-assisted self-review (Claude Code).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 6584013: CMPLX( ..., KIND=DP ).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It might be valuable to make a Fortran linter CI job that spots things we know NAG doesn't like, to reduce this kind of issue.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Repository secrets are not passed to workflows run from a fork, so the nagfor configurations skip themselves on fork PRs, and a VAX intrinsic only surfaces once the PR is on master. A check that greps the added lines under TESTING/ for DCMPLX, DCONJG, DIMAG, DREAL and CDABS would have caught every case in this batch without needing a NAG licence. That is a CI change rather than part of this fix, so I have kept it out of this PR.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Agreed on it being a separate thing. I'm hoping that someone more knowledgeable than me about Fortran knows of a well-known Fortran linter that can do this in a better (i.e. complete) way than grepping; maybe under the LLVM banner?
Stretch goal would be for NAG themselves to publish a linter type version of their compiler.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The test added on this branch builds its double complex values with DCMPLX, a VAX extension that NAG Fortran only accepts under -dcfuns. 773fd2f removed every such use from TESTING, and the NAG jobs do not run on pull requests from forks, so the build would only break after the merge. Use CMPLX( ..., KIND=DP ) with a DP kind parameter, as that commit did. The values are the same; the complex16 LAPACK tests of this branch run 1151229 tests with no failures. Co-Authored-By: Claude Fable 5.2 <[email protected]>
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.