We have found that the workspace query for xGESDD returns values that are too small for certain matrix sizes, causing the subsequent call to xGESDD to fail with INFO=-12. We have verified that this happens for JOBZ='A' and JOBZ='S' but not for JOBZ='N' or JOBZ='O'. Example program:
program sgesddbug
implicit none
integer, parameter :: m = 6163, n = 2967, min_lwork = n*(6+4*n)+m
integer :: lwork, info
real :: A(m,n), U(m,n), VT(n,n), sigma(n), iwork(8*n)
real, allocatable :: work(:)
lwork = -1
allocate(work(1))
call sgesdd('s', m, n, A, m, sigma, U, m, VT, n, work, lwork, iwork, info)
write (*,*) 'lwork = ',work(1), ', minimum lwork = ', min_lwork
lwork = nint(work(1))
deallocate(work)
allocate(work(lwork))
call sgesdd('s', m, n, A, m, sigma, U, m, VT, n, work, lwork, iwork, info)
write (*,*) 'info = ', info
end
prints:
lwork = 35233124.0 , minimum lwork = 35236321
<some BLAS error string>
info = -12
Best regards,
Rasmus Munk Larsen,
Google Knowledge & Research, Mountain View.

