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 xGEQP3 has two purposes:
to a fix a work-space bug in DGEQP3, SGEQP3
to add a quick return for M=0 to all 4 xGEQP3 routines
since lower level routines currently return non-zero INFO
when M=0, N>1, LWORK=1 even though the top level xGEQP3
accept this combination.
These are described in more detail below:
The computation of a block size in dgeqp3.f and sgeqp3.f
is based in a variable "SN", possibly smaller than the
input argument "N",
But subsequently, offsets into the "WORK" array, passed to lower
level routines, are based on "N" rather than "SN" which is
incorrect/inconsistent and can cause problems. For example:
dgeqp3.f and sgeqp3.f should be changed to use "N" instead of "SN" for the work-space
check (using "MINWS") and blocksize ("NB") calculation.
In other words,
MINWS = 2*SN + ( SN+1 )*NB
should be changed to
MINWS = 2* N + ( SN+1 )*NB
and
NB = ( LWORK-2*SN ) / ( SN+1 )
should be changed to
NB = ( LWORK-2* N ) / ( SN+1 )
in both files.
As currently coded, CGEQP3, DGEQP3, SGEQP3, ZGEQP3 all
accept M=0, N>1 with LWORK=1, but this combination causes
lower level routines (e.g. DORMQR in the case of DGEQP3)
to return non-zero INFO for insufficient work space.
For example when M=0 in DGEQP3, LWORK=1
passes the initial check (since IWS will be 1, not
greater than LWORK, which equals 1 in this example)
If M=0, N>1 DORMQR will be called
but DORMQR returns non-zero INFO if N>1, LWORK=1, even though LWORK=1 passed
the check in DGEQP3: (in this example NW will equal N which is greater than
both 1 and LWORK)
To improve the end-user experience, We believe this should be
fixed by adding a quick return for the M=0 case to
all four xGEQP3 routines.
For example in DGEQP3, change (around line 242)
to (add quick return for M=0)