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.
This PR for xGELSD has two purposes:
fix work space checks in "Path 2a" in CGELSD and ZGELSD
add quick return for NRHS=0 to all four xGELSD, since lower
level xLALSD does not accept NRHS=0.
These are decsribed below in more detail:
We believe the workspace check for "Path 2a" in
cgelsd.f and zgelsd.f is incorrect. Here is the
check currently in zgelsd.f (around line 531):
We believe
$ MAX( M, 2*M-4, NRHS, N-3*M ) ) THEN
should be changed to
$ MAX( M, 2*M-4, NRHS, N-3*M, M*NRHS ) ) THEN
This part of the workspace will be passed to ZLALSD
which requires workspace with M*NRHS elements:
Note that within ZLALSD the name "N" is used for the third argument:
while ZGELSD passes "M" to ZLALSD in "Path 2a":
To be consistent with the preceding, the following test in Path 2a
should be changed to (add M*NRHS to inner MAX list)
Both cgelsd.f and zgelsd.f have these issues.
As currently coded, CGELSD, DGELSD, SGELSD, ZGELSD
all accept NRHS=0, but lower level routines return
non-zero INFO when passed NRHS=0.
For example, DGELSD accepts NRHS=0
but NRHS=0 will be passed to DLALSD, for example,
+490 CALL DLALSD( 'U', SMLSIZ, N, NRHS, S, WORK( IE ), B, LDB,
+491 $ RCOND, RANK, WORK( NWORK ), IWORK, INFO )
"lapack/SRC/dgelsd.f"
and DLALSD does not accept NRHS=0
We believe this should be fixed by adding a quick return for the NRHS=0
case to all four xGELSD routines.
For example, change (around line 370 in DGELSD)
to (add NRHS.EQ.0 to the IF list)
To improve the end-user experience, this should be fixed
in CGELSD, DGELSD, SGELSD, ZGELSD.