GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Report an infinite entry in xGESVJ with INFO = -6 by rmlarsen · Pull Request #1512 · Reference-LAPACK/lapack

Conversation

@rmlarsen

@rmlarsen rmlarsen commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

AI disclosure: This PR was prepared with Claude Code.

Summary

xGESVJ is meant to reject a matrix with an infinite entry with INFO = -6 (see the comment above the initial scaling: "If INFinite entries in A are detected, the procedure returns with INFO=-6"). Since xLASSQ was rewritten with the Blue/Anderson accumulators, this check never fires. DGESVJ on a 4-by-3 matrix with one +Inf entry returns INFO = 0 and SVA(1) = Infinity, with JOBA = 'G', 'L' and 'U' alike.

Description

For each column the initial scaling calls xLASSQ( M, A( 1, p ), 1, AAPP, AAQQ ) with AAPP = 0 and AAQQ = 1 and then tests IF( AAPP.GT.BIG ). That test dates from the old xLASSQ, which returned a scale in the first argument that was infinite for a column with an infinite entry. The current xLASSQ returns the scale in AAPP and the sum of squares in AAQQ. For a column holding +Inf or -Inf the scale comes back as the finite constant 1/SBIG and the sum of squares as Infinity. So AAPP is never above BIG, no matter what the column holds, and the infinity goes on into the Jacobi iterations. A NaN in a column gives a NaN sum of squares and a finite scale, and is not reported either way; the comment promises only infinite entries.

Fix

Compare the sum of squares with the overflow threshold instead: IF( AAQQ.GT.xLAMCH( 'Overflow' ) ), in the three branches (lower, upper and general) of SGESVJ, DGESVJ, CGESVJ and ZGESVJ. The documented INFO = -6 is still reported through XERBLA, as before. BIG is not used for this test, and is not changed: in SGESVJ, DGESVJ and ZGESVJ it equals the overflow threshold, but CGESVJ defines it as ONE / 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. For a finite column the sum of squares returned by xLASSQ cannot exceed the overflow threshold, so ordinary inputs, including columns whose norm overflows and which xGESVJ scales, take the same path as before. A single-precision CGESVJ call on that column returns INFO = 0 and SVA(1) = 9.2E+18 on master and with this change, which is what the check against BIG would have broken.

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:

 finite, norm > huge: INFO =           0  SVA(1) =   4.1806077948995773E+162
 infinite entry:      INFO =           0  SVA(1) =                  Infinity

With the fix the first line is unchanged, up to the random data, and the second call ends in XERBLA:

 finite, norm > huge: INFO =           0  SVA(1) =   2.6702882335194015E+162
 ** On entry to DGESVJ parameter number  6 had an illegal value

Regression test

xERRED (path DBD, run by svd.in) now has a block for each of SGESVJ, DGESVJ, CGESVJ and ZGESVJ. It passes a 2-by-2 identity with one infinite entry, in the lower triangle for JOBA = 'L', in the upper triangle for 'U' and in the lower triangle for 'G', and checks with CHKXER that XERBLA was called with INFO = -6. That is 3 error-exit tests per precision. On master all of them fail in each precision ("Illegal value of parameter number 6 not detected by xGESVJ", then "xGESVJ failed the tests of the error exits"); with the fix SGESVJ and DGESVJ report "passed the tests of the error exits (3 tests done)" and CGESVJ and ZGESVJ "(4 tests done)". Running svd.in through xeigtst[sdcz] with the fix gave 15 "passed the threshold" lines in each precision and no failures.

The related routine xGEJSV has the same dead test (see below).

Test suite

The full test suite passes, configured as in CI (CBLAS=ON, LAPACKE=ON, LAPACKE_WITH_TMG=ON) with the _64 API. All 333 CTest entries pass, with 5755188 LAPACK tests (5755190 for the _64 API), 11973112 LAPACKE tests, 319677 BLAS tests and 645492 CBLAS tests for each API, and 0 numerical errors and 0 other errors. These are the counts of master; the error-exit tests are not counted. 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 with CMAKE_BUILD_TYPE=Release on x86-64 Linux.

Not changed here

  • xGEJSV has the same test, IF ( AAPP .GT. BIG ) with INFO = -9 after xLASSQ, and it never fires either: DGEJSV on a matrix with one +Inf returns INFO = 0 with a NaN or infinite SVA(1). Its documentation does not promise any such report, only a general "illegal value" INFO, so I left it for the maintainers to decide whether to fix the test or document and remove it.
  • xGESVJ does not report NaN, and neither the comment nor the documentation of INFO says that it should.
  • xGSVJ0 and xGSVJ1 have no such test.

Checklist

  • The documentation has been updated. (Not needed: xGESVJ now does what its comment documents.)
  • If the PR solves a specific issue, it is set to be closed on merge. (No tracking issue.)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rmlarsen @claude
Report an infinite entry in xGESVJ with INFO = -6
cac0e5c
xGESVJ 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
rmlarsen marked this pull request as draft November 22, 2026 03:15
@rmlarsen
rmlarsen marked this pull request as ready for review November 22, 2026 03:25
@codecov

codecov Bot commented Nov 22, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.67%. Comparing base (ef55c9b) to head (6584013).
⚠️ Report is 3 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
TESTING/EIG/cerred.f 96.55% 1 Missing ⚠️
TESTING/EIG/derred.f 96.00% 1 Missing ⚠️
TESTING/EIG/serred.f 96.00% 1 Missing ⚠️
TESTING/EIG/zerred.f 96.55% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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     
Components Coverage Δ
BLAS 99.73% <ø> (ø)
CBLAS 96.95% <ø> (ø)
LAPACK 83.79% <100.00%> (+0.06%) ⬆️
LAPACKE 4.18% <ø> (ø)
TMGLIB 55.69% <ø> (ø)
BLAS testing 88.79% <ø> (ø)
CBLAS testing 89.65% <ø> (ø)
LAPACK testing 82.42% <96.29%> (+0.01%) ⬆️
LAPACKE testing ∅ <ø> (∅)
Files with missing lines Coverage Δ
SRC/cgesvj.f 71.53% <100.00%> (+1.75%) ⬆️
SRC/dgesvj.f 75.50% <100.00%> (+1.52%) ⬆️
SRC/sgesvj.f 76.68% <100.00%> (+1.52%) ⬆️
SRC/zgesvj.f 73.09% <100.00%> (+1.75%) ⬆️
TESTING/EIG/cerred.f 96.64% <96.55%> (-0.01%) ⬇️
TESTING/EIG/derred.f 96.63% <96.00%> (-0.05%) ⬇️
TESTING/EIG/serred.f 96.63% <96.00%> (-0.05%) ⬇️
TESTING/EIG/zerred.f 96.64% <96.55%> (-0.01%) ⬇️

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef55c9b...6584013. Read the comment docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rmlarsen
rmlarsen commented Nov 24, 2026
View reviewed changes
Comment thread TESTING/EIG/zerred.f Outdated
$ 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 )

@rmlarsen rmlarsen Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rmlarsen rmlarsen Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mohawk2 mohawk2 Nov 25, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rmlarsen rmlarsen Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mohawk2 mohawk2 Nov 26, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rmlarsen @claude
TESTING: use the standard CMPLX in the new ZERRED test
6584013
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]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@mohawk2 mohawk2 mohawk2 left review comments
Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@rmlarsen @mohawk2
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.