lapack
lapack copied to clipboard
[Related: Documentation] dgesvdx IL IU parameters
For the range case of dgesvdx, the documentation for IL and IU says:
1 <= IL <= IU <= min(M,N)
but the correct order is: 1 <= IU <= IL <= min(M,N) as the greater singular values pop up first.
Also, in the documentation for LWORK says:
LWORK >= MAX(1,MIN(M,N)*(MIN(M,N)+4)) for the paths (comments inside the code): - PATH 1 (M much larger than N) - PATH 1t (N much larger than M) LWORK >= MAX(1,MIN(M,N)*2+MAX(M,N)) for the other paths.
But for PATH 1:
minwrk = n*(n*3+20)
for PATH 1t:
minwrk = m*(m*3+20)
for PATH 2:
minwrk = max(n*(n*2+19),4*n+m)
and for PATH 2t:
minwrk = max(m*(m*2+19),4*m+n)
So, the documentation should say: LWORK >= MAX(1,MIN(M,N)(3MIN(M,N)+20)) for the paths (comments inside the code): - PATH 1 (M much larger than N) - PATH 1t (N much larger than M) LWORK >= MAX(1, MIN(M,N)* (2 * MIN(M,N)+19), 4*MIN(M,N) + MAX(M,N)) for the other paths.
Thanks @lecarrera-tec !
[edited] I agree with your correction for the LWORK.
In fact, IL and IU are input parameters for the case RANGE='I' and refer to the singular values in ascending order. Note that IU.LT.IL provokes an error:
https://github.com/Reference-LAPACK/lapack/blob/2dafa3d2756a7825c23a8c8456781561e36668ae/SRC/dgesvdx.f#L354-L358
Thanks to @langou for noticing that!
* Do you plan to submit a pull request? If not, I can do it. Just to mention, the same problems exist in the other three gesvdx methods.
Test for Lapack DGESVDX with RANGE=I :
https://gist.github.com/weslleyspereira/0587d103761e3aee36163e00d753de49