From 151acca47736cd2ceafeb237a18eacfe3158aa96 Mon Sep 17 00:00:00 2001 From: Kyungmin Lee Date: Fri, 8 May 2026 09:50:11 -0700 Subject: [PATCH] Fix JOBA argument in SGEJSV inner SGESVJ call (LSVEC && RSVEC branch) In the LSVEC && RSVEC branch of SGEJSV, the IF arm fills the strict upper triangle of U with U(p,q) = -SIGN(TEMP1, U(q,p)) while the ELSE arm zeros it via SLASET('U', ...). Both arms then call SGESVJ on U with JOBA='L', which tells SGESVJ that U is lower triangular and the strict upper is zero. After the IF arm that is not true: SGESVJ silently drops the upper-triangular data the IF arm just deposited, biasing the SVD result. JOBA='G' (general) is correct for both arms; DGEJSV already uses 'G' at the matching call site. --- SRC/sgejsv.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SRC/sgejsv.f b/SRC/sgejsv.f index 229a356a7..993aaa458 100644 --- a/SRC/sgejsv.f +++ b/SRC/sgejsv.f @@ -1706,7 +1706,7 @@ CALL SLASET('U', NR-1, NR-1, ZERO, ZERO, U(1,2), LDU ) END IF - CALL SGESVJ( 'L', 'U', 'V', NR, NR, U, LDU, SVA, + CALL SGESVJ( 'G', 'U', 'V', NR, NR, U, LDU, SVA, $ N, V, LDV, WORK(2*N+N*NR+1), LWORK-2*N-N*NR, INFO ) SCALEM = WORK(2*N+N*NR+1) NUMRANK = NINT(WORK(2*N+N*NR+2))