Skip to content

?drvmr3 workspace sizes - #2

Closed
ACSimon33 wants to merge 2 commits into
ACSimon33:masterfrom
Reference-LAPACK:drvmr3-workspace-sizes
Closed

ACSimon33 wants to merge 2 commits into
ACSimon33:masterfrom
Reference-LAPACK:drvmr3-workspace-sizes

Conversation

@ACSimon33

Copy link
Copy Markdown
Owner

Description

The ?drvmr3 testers added in Reference-LAPACK#1361 run each matrix through a loop of four passes, commented "for minimal and adequate (for blocking) workspace". Every pass called xGESVDMR3 with the full LWORK, though, so each matrix was tested four times with the same input, and smaller workspaces were never tested. The complex testers computed a workspace size from the ZGESVD formula but never passed it. The real testers printed LSWORK in their error message without ever setting it, which nagfor reports as "Symbol LSWORK referenced but never set".

Additionally, the LWORK description in xGESVDMR3 was copied from xGESVDX and asks for less than the routines check for, so a caller who passes the documented minimum gets INFO = -19:

Routine Paths 1 and 1t, documented / enforced Other paths, documented / enforced
SGESVDMR3, DGESVDMR3 MIN(M,N)*(MIN(M,N)+4) / 8*MIN(M,N)**2 + 43*MIN(M,N) 2*MIN(M,N)+MAX(M,N) / MAX(7*MIN(M,N)**2 + 42*MIN(M,N), 5*MIN(M,N)**2 + 27*MIN(M,N) + MAX(M,N))
CGESVDMR3, ZGESVDMR3 MIN(M,N)*(MIN(M,N)+4) / MIN(M,N)*(MIN(M,N)+5) 2*MIN(M,N)+MAX(M,N) / 3*MIN(M,N)+MAX(M,N)

All four routines need only 1 when MIN(M,N) = 0.

Changes:

  • SRC/[sdcz]gesvdmr3.f: document the workspace the code enforces, as in the table. The code itself is unchanged.
  • TESTING/EIG/[sdcz]drvmr3.f: compute the documented minimum for each M and N. As in the routine, ILAENV( 6, 'xGESVD', ... ) decides between path 1 and path 2. Over the four passes, step LSWORK from that minimum up to LWORK, the same way ?drvbd does for the other SVD drivers. Pass LSWORK to every xGESVDMR3 call.

ACSimon33 and others added 2 commits October 22, 2026 10:10
The LWORK description was copied from xGESVDX and asks for less than
the routines check for, so a caller who passes the documented minimum
gets INFO = -19. State the minimum the code enforces: for the real
routines 8*MIN(M,N)**2 + 43*MIN(M,N) on paths 1 and 1t and
MAX(7*MIN(M,N)**2 + 42*MIN(M,N), 5*MIN(M,N)**2 + 27*MIN(M,N) + MAX(M,N))
on the others; for the complex routines MIN(M,N)*(MIN(M,N)+5) and
3*MIN(M,N) + MAX(M,N). Each needs only 1 when MIN(M,N) = 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The four passes of the "minimal and adequate workspace" loop all
passed LWORK, so every matrix was tested four times with the same
input. The complex testers computed a workspace size from the ZGESVD
formula but never used it, and the real ones printed LSWORK without
setting it ("Symbol LSWORK referenced but never set" from nagfor).
@ACSimon33
ACSimon33 force-pushed the drvmr3-workspace-sizes branch from 58600b3 to 2d8786e Compare October 22, 2026 08:16
@ACSimon33 ACSimon33 closed this Oct 23, 2026
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.

1 participant