lapack
lapack copied to clipboard
Overly restrictive argument checking in LAPACKE_?gesvd
Description As pointed out by Gonum's Dan Kortschak in https://github.com/OpenMathLib/OpenBLAS/issues/5051 , the LAPACKE bindings for the GESVD functions appear to be overly restrictive in the LDVT argument check performed on row-major calls: When the JOBVT argument is "N" and consequently the output matrix "VT" will not be referenced at all according to the provided documentation, the current code still insists on a nonzero LDVT, taking the INFO=12 error exit instead of providing a work size estimate in LAPACKE_?gesvd_work.c
It occurs to me that the code in e.g.
https://github.com/Reference-LAPACK/lapack/blob/6ec7f2bc4ecf4c4a93496aa2fa519575bc0e39ca/LAPACKE/src/lapacke_dgesvd_work.c#L75
should be conditional on if( LAPACKE_lsame( jobvt, 'a' ) || LAPACKE_lsame( jobvt, 's' ) ) {
Checklist
- [x] I've included a minimal example to reproduce the issue (see in referenced OpenBLAS ticket)
- [x] I'd be willing to make a PR to solve this issue