Skip to content

TESTING/LIN: fix short-wide TSQR residual checks - #1364

Merged
langou merged 1 commit into
Reference-LAPACK:masterfrom
nakatamaho:fix-tsqr01-short-wide-residual
Aug 23, 2026
Merged

langou merged 1 commit into
Reference-LAPACK:masterfrom
nakatamaho:fix-tsqr01-short-wide-residual

Conversation

@nakatamaho

@nakatamaho nakatamaho commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

In the short-wide (SW) branch of DTSQR01 and CTSQR01, the test computes the residual for the C*Q operation into CF, but then measures a different workspace DF.

The current code is effectively:

CALL DGEMM( 'N', 'N', M, N, N, -ONE, C, M, Q, N, ONE, CF, M )
RESID = DLANGE( '1', N, M, DF, N, RWORK )

The same issue exists in the complex routine with CGEMM and CLANGE.

Why this is wrong

In this part of the test:

  • C is an M-by-N input matrix.
  • CF is its M-by-N work copy and receives the C*Q residual.
  • DF belongs to the preceding Q^T*D test and contains stale data at this point.
  • The norm dimensions and leading dimension must therefore be M, N, M, not N, M, N.

This can make the test report a failure based on the previous DF workspace rather than on the C*Q residual. For example, the issue was exposed by a short-wide case with M=1, N=3, MB=20, and NB=3.

Fix

Use the result buffer and dimensions corresponding to the C*Q computation:

RESID = DLANGE( '1', M, N, CF, M, RWORK )

and the analogous CLANGE call in CTSQR01.

Validation

  • gfortran -c -ffixed-form -std=legacy TESTING/LIN/dtsqr01.f
  • gfortran -c -ffixed-form -std=legacy TESTING/LIN/ctsqr01.f
  • git diff --check

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.38%. Comparing base (69992ad) to head (ffd1229).
⚠️ Report is 749 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1364       +/-   ##
===========================================
+ Coverage    0.00%   82.38%   +82.38%     
===========================================
  Files        1937     1945        +8     
  Lines      190566   190130      -436     
===========================================
+ Hits            0   156637   +156637     
+ Misses     190566    33493   -157073     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@langou
langou merged commit c2d59c7 into Reference-LAPACK:master Aug 23, 2026
18 checks passed
@nakatamaho

Copy link
Copy Markdown
Contributor Author

thank you very much!

nakatamaho added a commit to nakatamaho/mplapack that referenced this pull request Aug 23, 2026
Apply the upstream LAPACK fix from Reference-LAPACK/lapack#1364 (merged).
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants