Calculate CUNMLQ LWORK consistently when K=0#1225
Conversation
CUNMLQ's documentation says LWORK must be:
If SIDE = 'L', LWORK >= max(1,N);
if SIDE = 'R', LWORK >= max(1,M).
In the current implementation, however, when K=0 a workspace query
will return LWORK=1 in WORK(1). This means a subsequent call to CUNMLQ
with a workspace of that size will fail with INFO = -12.
The other ???MLQ routines return consistent values of LWORK when K=0
(that is, equal to or greater than NW) so this patch makes CUNMLQ's
behaviour match theirs.
|
Assuming that the caller then goes ahead and allocates a large work array as told, wouldn't a more efficient alternative be to amend the LWORK size test in CUNMLQ with a special case for K=0 ? (Or simply |
|
I was unsure why CUNMLQ handles workspace queries differently from ZUNMLQ and DORMLQ/SORMLQ when K=0. Those subroutines do not have the condition:
so behave in accordance with the API specifications in their documentation (that is, they return a value of LWORK >= MAX(1,M) or MAX(1,N) regardless of the value of K). Is there a need for CUNMLQ to have this special behaviour when K=0? |
|
|
Thank you -- I'm not sure if I need to retrigger something to get the failing check to pass? It was an error in contacting the conda mirror, so nothing to do with the changes in the PR. |
|
Apparently I don't have the necessary permissions to trigger a rerun on Appveyor, so the quickest would be to close&reopen this PR so that all CI jobs get run again |
|
BTW git blame suggests that the differing behavior in CUNMLQ may have been accidental, probably resulting from a local optimization attempt that inadvertently became part of commit 34420f1 in the lapack-3.6.0 timeframe, roughly ten years ago. |
Description
CUNMLQ's documentation says LWORK must be:
In the current implementation, however, when K=0 a workspace query will return LWORK=1 in WORK(1). This means a subsequent call to CUNMLQ with a workspace of that size will fail with INFO = -12.
The other ???MLQ routines return consistent values of LWORK when K=0 (that is, equal to or greater than NW) so this patch makes CUNMLQ's behaviour match theirs.
Checklist