-
Notifications
You must be signed in to change notification settings - Fork 480
Description
I came accross this issue working with LAPACK via Julia (see #42762 ). The 7-th argument of the LAPACK subroutines DGEQRF and DGERQF is LWORK, the length of work array WORK.
According to the documentation of DGEQRF, for a normal call for a M x N matrix, LWORK must satisfy LWORK >= max( 1, N ). For an exceptional call with LWORK = -1 and N = 0, the "optimal" dimension LWORK = 0 is returned in WORK(1). Therefore, at the second call, LWORK = 0 is (normally) used, which leads to error -7. To be consistent with the documentation, the returned "optimal" value of LWORK for the call with LWORK = -1 must be at least WORK(1) = 1.
According to the documentation of DGERQF, for a normal call for a M x N matrix, LWORK must satisfy LWORK >= max( 1, M ). For an exceptional call with LWORK = -1 and N = 0, the "optimal" dimension LWORK = 1 is returned in WORK(1), which is a not consistent with the documentation if M > 1. Therefore, at the second call, LWORK = 1 is (normally) used, which leads to error -7 if M > 1. To be consistent with the documentation, the returned "optimal" value of LWORK for the call with LWORK = -1 must be at least WORK(1) = MAX(1,M).