Commit Graph
3530 Commits
Author SHA1 Message Date
langou fbd4146ce5 Merge pull request #1286 from jschueller/issue255
dlasd2/slasd2: Increase deflation tolerance to match dlasd7/slasd7
2026-06-13 04:02:37 -06:00
langou 1b2cbb7649 Merge pull request #1293 from jschueller/issue965
dbbcsd/sbbcsd/cbbcsd/zbbcsd: fix insufficiently accurate U2 in CS dec…
2026-06-13 03:58:48 -06:00
langou 048d12f150 Merge pull request #1292 from jschueller/issue546
ormqr/ormlq/ormrq/ormql, unmqr/unmlq/unmrq/unmql: fix minimum workspa…
2026-06-13 03:57:23 -06:00
langou 21af89cef0 Merge pull request #1287 from jschueller/issue734
LAPACKE/tprfb_work: fix row-major A dimensions for SIDE='R'
2026-06-13 03:55:39 -06:00
langou e938bbbe24 Merge pull request #1285 from jschueller/issue242
bdsqr: Fix INFO return when NCVT=NRU=NCC=0
2026-06-13 03:54:01 -06:00
langou f5340708e6 Merge pull request #1294 from changangela/fix-lapacke-nancheck-overflow
Fix integer overflow in LAPACKE nancheck helpers for large matrices
2026-06-12 01:55:18 -06:00
langou 192037884c Merge pull request #1261 from ACSimon33/fix_warnings
Fix Intel Classic build on Windows and various warnings
2026-06-12 01:42:07 -06:00
langou 078d8978db Merge pull request #1280 from ACSimon33/cherry-pick-7872e2d6
Fixed CBLAS symbol name: cblas_zaxbpy_64 -> cblas_zaxpby_64
2026-06-12 01:38:54 -06:00
langou fd8e6db995 Merge pull request #1289 from jschueller/issue676
gelsy: fix ILAENV workspace query routines for TZRZF/UNMRZ
2026-06-12 01:37:02 -06:00
langou d5dbabe3f5 Merge pull request #1291 from jschueller/issue549
dorcsd2by1/uncsd2by1: avoid OOB access with zero rows
2026-06-12 01:34:55 -06:00
Yue Chang 23b489104f Fix integer overflow in LAPACKE nancheck helpers for large matrices
Offset computations like j*lda overflow 32-bit lapack_int once
n = lda >= 46341, e.g. LAPACKE_dpotrf crashes in its NaN check before
the factorization runs. Cast to size_t (or int64_t for the tz offsets)
the same way ge/gb/tp/tf already do.
2026-06-12 01:41:44 -04:00
Julien Schueller a73f4a6524 dbbcsd/sbbcsd/cbbcsd/zbbcsd: fix insufficiently accurate U2 in CS decomposition
The Golub-Reinsch-SVD-style iteration in xBBCSD used an absolute
convergence threshold THRESH ~ 90*EPS to decide when off-diagonal
bulges are negligible and can be skipped.  For rows where the
diagonal entries are small (tiny singular values in the ratio),
this absolute threshold is too large relative to the diagonal,
causing the algorithm to stop chasing bulges prematurely and
producing inaccurate singular vectors (||X21 - U2 D2 V^*|| up to
50*EPS ||X21||).

Fix: change all bulge-convergence checks (RESTART flags in the
inner loop, initial bulge-chase decisions, and the IMAX-1 cleanup)
from absolute to relative by scaling THRESH by the adjacent diagonal
entries:

  RESTART11 = |B11E|^2+|BULGE|^2 <= (THRESH * MAX(|B11D(I-1)|,|B11D(I)|,UNFL))^2

This mirrors DBDSQR's relative convergence check |E| <= TOL*|D|.
Applied to all 4 bidiagonal blocks (B11/B21/B12/B22) at all 3
check-points in the iteration.

Fixes #965
2026-06-11 19:15:11 +02:00
Julien Schueller 05628e3e0d ormqr/ormlq/ormrq/ormql, unmqr/unmlq/unmrq/unmql: fix minimum workspace for tiny M,N,K
The workspace query formula LWKOPT = NW*NB + TSIZE used TSIZE = LDT*NBMAX
= 65*64 = 4160, a hardcoded constant.  The blocked algorithm only stores
one T matrix block at a time (reused across loop iterations), so the
per-iteration workspace is LDT*NB, not LDT*NBMAX.  For tiny M,N,K where
a single block suffices (NB >= N or NB >= K), LWKOPT was always >= 4160
regardless of problem size.

Fix: change LWKOPT = NW*NB + TSIZE  ->  LWKOPT = NW*NB + LDT*NB.

The NB adjustment formula when LWORK is limited must consistently use
the per-iteration T storage instead of TSIZE:

  NB = (LWORK - TSIZE) / LDWORK  ->  NB = LWORK / (LDWORK + LDT)

Applied to all 16 routines (s,d,c,z x {orm,unm}{qr,rq,lq,ql}).

Closes #546
2026-06-11 17:06:32 +02:00
Julien Schueller 6649f3999f dorcsd2by1/uncsd2by1: avoid OOB access with zero rows
When P=0 and M=Q (U2 is M-by-M, X21 is M-by-M and orthogonal),
or P=M and M=Q (U1 is M-by-M, X11 is M-by-M and orthogonal),
or Q=0, the minimal dimension R = MIN(P, M-P, Q, M-Q) is zero,
so C and S are empty.  In these degenerate cases the preceding
code entered the R == P or R == M-P branch and called the
bidiagonalization subroutines (SORBDB2/SORBDB3) which then
accessed elements X21(I,I+1) or X11(I,I+1) out of bounds in
the second DO loop (I = P+1, Q or I = M-P+1, Q).

Fix: handle R = 0 directly in the four driver routines before
the case-dependent bidiagonalization path.  The three trivial
CSD cases are:

  Q = 0:     set U1 = I, U2 = I, return.
  P = 0, M = Q:  copy X21 to U2, set V1T = I, return.
  P = M, M = Q:  copy X11 to U1, set V1T = I, return.

All other R=0 configurations are non-standard and still fall
through to the existing path (which may fail).

Fixes #549
2026-06-11 16:58:16 +02:00
Julien Schueller ed7d20cd23 gelsy: fix ILAENV workspace query routines for TZRZF/UNMRZ
The workspace NB queries in all four ?gelsy variants used
?GERQF and ?UNMRQ, but the routines actually called at runtime
are ?TZRZF and ?UNMRZ (real) / ?UNMRZ (complex).

While ?GERQF and ?TZRZF are related (both produce an RQ-like
factorization), their block sizes may differ in ILAENV's tuned
values.  If the user relied on LWKOPT from the query to allocate
exactly the right workspace, the actual ?TZRZF/?UNMRZ calls could
underflow or overflow the work array.

Fix the ILAENV calls to match the routines actually invoked:
  ?GERQF -> ?TZRZF
  ?UNMRQ -> ?UNMRZ

Closes #676
2026-06-11 16:26:07 +02:00
langou 077667a1be Merge pull request #1284 from jschueller/cblas
Misc fixes
2026-06-11 08:14:19 -06:00
Julien Schueller fd020b441b LAPACKE/tprfb_work: fix row-major A dimensions for SIDE='R'
The row-major path hardcoded `lda_t = MAX(1,k)`, which is only correct
when SIDE='L' (A is K-by-N). When SIDE='R', A is M-by-K and the
transposition dimensions, allocation, and leading-dimension checks were
all wrong.

- Introduce nrowsA/ncolsA/nrowsV determined by SIDE (following the
  same pattern as the LAPACKE_?tpmqrt_work fix in PR #540).
- lda_t now uses nrowsA instead of always k.
- lda check compares against ncolsA instead of always m.
- A transpose uses (nrowsA, ncolsA) instead of (k, m).
- LDV check depends on STOREV: ldv >= nrowsV for STOREV='C',
  ldv >= k for STOREV='R'.
- V transpose uses nrowsV rows instead of ldv.

Closes #734
2026-06-11 16:08:45 +02:00
Julien Schueller 0e0f23592e dlasd2/slasd2: Increase deflation tolerance to match dlasd7/slasd7
Fix DBDSDC/SBDSDC returning non-orthogonal U/V for bidiagonal matrices
with many nearly-equal singular values (e.g., all singular values ≈ 1).

The divide-and-conquer bidiagonal SVD has two code paths:
- Full vector path (DLASD2/SLASD2): deflation tolerance = 8 * EPS
- Compact path  (DLASD7/SLASD7): deflation tolerance = 64 * EPS

With the weaker tolerance (8*EPS), singular values differing by only
~10*EPS (e.g., ~2e-15 for double precision) escape deflation.  The
subsequent Z computation in DLASD3 then suffers catastrophic
cancellation from denominators (σ_i - σ_j) that are tiny, polluting the
singular vectors and causing loss of orthogonality.

Raise DLASD2 and SLASD2 to 64*EPS, matching DLASD7 and SLASD7, so more
close singular values are deflated and the singular-vector computation
remains stable.

Closes #255
2026-06-11 15:56:56 +02:00
langou 92ef3aaeb8 Merge pull request #1259 from ACSimon33/fix_python_test_summary
Fix Python test summary
2026-06-11 07:47:29 -06:00
Julien Schueller 3ecbd1d097 bdsqr: Fix INFO return when NCVT=NRU=NCC=0
Problem: When NCVT = NRU = NCC = 0 (no singular vectors requested),
BDSQR calls the dqds algorithm. If dqds failed with INFO = 1 or 3,
the routine returned immediately with that error, even though the
standard QR algorithm could still compute the singular values. Only
INFO = 2 triggered the fallback.

Change `IF( INFO .NE. 2 ) RETURN` to `IF( INFO .EQ. 0 ) RETURN`
after the dqds call, so the standard QR fallback runs on any
dqds failure (INFO=1,2,3) and not only INFO=2.

Closes #242
2026-06-11 15:33:25 +02:00
langou 6e88a11703 Merge pull request #1251 from martin-frbg/issue1183
Optimize looping over the lower triangular in fat matrix cases of LACPY/LANTR/LASCL
2026-06-11 07:16:58 -06:00
Julien Schueller 283cf5b76d Make LAPACKE_[cz]tgexc pass ifst/ilst as pointer outputs
Per LAPACK docs, in [cz]tgexc, ilst is [in,out]. The LAPACKE C
interface was passing both ifst and ilst by value as input-only
scalars, so callers could never observe the updated ilst value.

Change both ifst and ilst to lapack_int* pointers in the complex
tgexc variants to match the real-precision stgexc/dtgexc interface
and the underlying Fortran semantics.

Fixes #771
2026-06-11 15:05:22 +02:00
Julien Schueller 91c0f61b87 Guard ?GEEV/?GEEVX undo-scaling against negative INFO
When ?HSEQR encounters non-finite input, it can return a negative
INFO. The undo-scaling block at label 50 then computes N-INFO (which
exceeds N) and indexes WR( INFO+1 ) (out of bounds), causing memory
corruption through ?LASCL.

Add INFO.GE.0 to the outer IF( SCALEA ) guard so the undo-scaling
block is skipped entirely when INFO is negative. The inner
IF( INFO.GT.0 ) guard only covered the second pair of ?LASCL calls.

Fixes #1128
2026-06-11 15:05:19 +02:00
Julien Schueller 6dc1a78eae Fix DROTMG/SROTMG rescaling overwriting DH12
When DFLAG=0 and both DD1 and DD2 need rescaling, the first
scaling loop transitions DFLAG from 0 to -1 and correctly
scales DH11 and DH12. But the second scaling loop then hits
the ELSE branch (matching DFLAG=-1) which unconditionally
resets DH21=-1 and DH12=1, overwriting the scaled DH12.

Change ELSE to ELSE IF (DFLAG.EQ.ONE) so the implied-element
initialization (DH21=-1, DH12=1) only fires when DFLAG=1,
not when DFLAG=-1 (where all elements are already explicit).

Fixes #244
2026-06-11 15:05:19 +02:00
Julien Schueller 526a4fbbd3 Fix mislabeled comments in dget38.f
Two comments in the DGEHRD/DHSEQR test incorrectly say "Compute
Schur form":
- The DGEHRD call reduces to upper Hessenberg form, not Schur.
- The DHSEQR call computes eigenvalues and the Schur form, so
  use a more descriptive label.

Fixes #587
2026-06-11 15:05:19 +02:00
Julien Schueller 3d668fe93f LAPACKE: Make LDU/LDVT checks in GESVD conditional on JOBU/JOBVT
When JOBU='N' or JOBVT='N', the U and VT matrices are not referenced,
so the leading dimension checks should be skipped.  Previously the
code rejected ldvt=0 (and ldu=0) even when those matrices were not
used, causing a spurious INFO=12 error on row-major calls with
JOBVT='N' (or INFO=10 for JOBU='N').

Fixes #1090
2026-06-11 14:39:38 +02:00
Julien Schueller fd16118505 cblas_ctrmm: fix error check
Closes #1188
2026-06-11 14:39:38 +02:00
Julien Schueller 7a721b3fac lapacke: fix memory allocation on error 2026-06-11 14:39:38 +02:00
Julien Schueller d296703051 lapacke_zgedmdq: fix routine name 2026-06-11 14:39:38 +02:00
Julien Schueller 8a43b6869a cblas_zgemmtr: Fix routine name 2026-06-11 14:39:38 +02:00
Julien Schueller ea7f51048f cblas_dgemmtr: Fix syntax error 2026-06-11 14:39:38 +02:00
langou 54b6620d27 Merge pull request #1264 from AymenQ/fix-complex-nrm2-inf-test
Fix complex NRM2 tests for matching infinite results
2026-06-11 04:15:19 -06:00
langou a66e2a37c4 Merge pull request #1252 from scr2016/refactor-github-workflow-file-cmake_yml--config
in .github/workflows/cmake.yml, removed redundant '--config ${{env.BUILD_TYPE}}' from 'cmake --build build'
2026-06-01 00:25:52 -06:00
langou 7e4e6bf07e Merge pull request #1039 from haox1/stebz
Fixes of STEBZ
2026-05-24 09:08:06 -06:00
langou 8515a319e7 Merge pull request #1283 from sergey-v-kuznetsov/fixes_for_issue-1282
Fixes for LAPACK test crashes -ffpe-trap
2026-05-21 03:08:53 -06:00
sergey-v-kuznetsov 40abea27f7 Fixes for LAPACK test crashes -ffpe-trap 2026-05-20 15:41:08 -07:00
Simon Maertens c0e868327e Fixed CBLAS symbol name: cblas_zaxbpy_64 -> cblas_zaxpby_64 2026-05-13 14:03:03 +02:00
langou 67c7c8ac05 Merge pull request #1274 from kyungminlee/fix-sggev3-query
Gate SGGEV3 workspace query on ILV, not ILVL
2026-05-11 07:54:43 -06:00
langou e014d6ce59 Merge pull request #1275 from kyungminlee/fix-dlaswlq-nb
Reject NB=0 in DLASWLQ argument validation
2026-05-11 07:38:43 -06:00
Kyungmin Lee 971961bd21 Gate SGGEV3 workspace query on ILV, not ILVL
The actual SLAQZ0 call uses 'S' when ILV is true and 'E' otherwise,
but the query gated that choice on ILVL, undersizing LWORK for
JOBVL='N', JOBVR='V'. Mirror DGGEV3: gate SLAQZ0 and SGGHD3 on ILV,
SORGQR on ILVL.
2026-05-11 04:58:16 -07:00
Kyungmin Lee f51069fa5e Reject NB=0 in DLASWLQ argument validation
DLASWLQ tested NB.LT.0 instead of NB.LE.0, accepting NB=0 silently and
falling into the divide-by-(NB-M) path on line 255 (KK = MOD((N-M),(NB-M)))
when M=0. The single/complex/double-complex siblings all use NB.LE.0.
2026-05-11 04:38:33 -07:00
langou 5da5348aa0 Merge pull request #1242 from nakatamaho/cleanup/con-lsame-norm
SRC: use LSAME for NORM checks in condition routines
2026-05-11 04:45:26 -06:00
langou 382c275cb1 Merge pull request #1273 from kyungminlee/fix-laqz0-xerbla-sign
Fix XERBLA sign in ?LAQZ0 LWORK check
2026-05-11 01:59:23 -06:00
langou a2303521f8 Merge pull request #1272 from kyungminlee/fix-info-position-drift
Fix INFO=-N in argument-validation
2026-05-11 01:59:04 -06:00
langou 6e881c3dce Merge pull request #1271 from kyungminlee/fix-stale-externals
Fix stale externals and documentation typo
2026-05-11 01:58:31 -06:00
langou 6d7772085a Merge pull request #1270 from kyungminlee/fix-dgejsv-lwork
Fix workspace size argument in DGEJSV inner DGESVJ call
2026-05-11 01:57:58 -06:00
langou 62b2396d7b Merge pull request #1269 from kyungminlee/fix-sgejsv-joba
Fix JOBA argument in SGEJSV inner SGESVJ call (LSVEC && RSVEC branch)
2026-05-11 01:12:32 -06:00
Kyungmin LeeandClaude Opus 4.7 b172f0b839 Fix XERBLA sign in ?LAQZ0 LWORK check
The argument-validation block at the top of ?LAQZ0 sets INFO=-i and
correctly calls XERBLA(name, -INFO), but the second validation block
(LWORK .LT. LWORKREQ) calls XERBLA(name, INFO) with the negative
value. XERBLA prints its argument verbatim, so this would emit
"parameter number -18 had an illegal value" instead of "18".

Affects S/D/C/Z LAQZ0; ?LAQZ2 and the rest of LAPACK already use
the correct -INFO form.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 04:43:38 -07:00
Kyungmin LeeandClaude Opus 4.7 34fffb77e7 Fix INFO=-N in argument-validation
INFO=-N value reported to XERBLA on a too-small workspace
(or LRWORK) does not match the actual signature position of the
argument being tested.

Sites:
- ?ORBDB4 / ?UNBDB4: LWORK test reported -14 (WORK), should be -15.
- ?GGSVD3: LWORK.LT.1 test reported -24 (the INFO arg in S/D;
  IWORK in C/Z), should be -22 (LWORK).
- ?ORCSD / ?UNCSD: LWORK test reported -22 (LDU2), should be -28
  (LWORK). Z/C also report LRWORK as -24 (LDV1T), should be -30.
- C/ZLAQZ0: LWORK test reported -19 (RWORK), should be -18.
  (S/DLAQZ0 use ALPHAR+ALPHAI instead of ALPHA, so LWORK is at
  position 19 there and -19 is already correct.)
- C/ZLAQZ2: LWORK test reported -26 (RWORK), should be -25.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 04:39:07 -07:00
Kyungmin Lee effffd0f9a Add SGGES XERBLA EXTERNAL and fix ZRSCL doc-header typo
SGGES body calls XERBLA at line 423 but the EXTERNAL block omits it;
DGGES correctly lists XERBLA. Add it.

ZRSCL's Doxygen header advertised the routine as ZDRSCL (which is a
different routine that ZRSCL calls internally). Fix the brief, the
download links, and the filename references so the generated docs
correspond to ZRSCL.
2026-05-09 04:08:29 -07:00