## [CZ]GESVDX complex workspace corrections / info = -17

Post here if you want to report a bug to the LAPACK team

### [CZ]GESVDX complex workspace corrections / info = -17

Firstly, in [SDCZ]GESVDX, INFO = -17 for illegal LDVT not INFO = -16
--------------------

In [CZ]GESVDX there is some confusion over use of ITEMP to index both real and complex
work arrays.
I would suggest using ITEMPR for RWORK, as in:

itempr = itgkz + n*(n*2+1)
and then use rwork(itempr) in place of rwork(itemp)

I get the following
path 1:
Code: Select all
`          minwrk = n*(n+5)          maxwrk = n + n*ILAENV(1,'ZGEQRF',' ',m,n,-1,-1)          maxwrk = Max(maxwrk,n*n+2*n+2*n*ILAENV(1,'ZGEBRD',' ',n,n,-1,-1))          If (wantu .or. wantvt) Then             maxwrk = Max(maxwrk,n*n+2*n+n*ILAENV(1,'ZUNMQR','LN',n,n,n,-1))          End If`

path2:
Code: Select all
`          minwrk = 3*n + m          maxwrk = 2*n + (m+n)*ILAENV(1,'ZGEBRD',' ',m,n,-1,-1)          If (wantu .or. wantvt) Then            maxwrk = Max(maxwrk,2*n+n*ILAENV(1,'ZUNMQR','LN',n,n,n,-1))          End If`

and similar for paths 1t and 2t with M and N switched.
lawrence mulholland

Posts: 25
Joined: Mon Jun 11, 2012 6:33 am
Location: NAG Ltd, Oxford, UK

### Re: [CZ]GESVDX complex workspace corrections / info = -17

Hi Lawrence,

Thanks for the bug fix.

(1) Firstly, in [SDCZ]GESVDX, INFO = -17 for illegal LDVT not INFO = -16. Yes, thanks corrected in commit 1654.

(2) Then the rest (workspace computation during a workspace query and changing ITEMP to ITEMPR in relation to RWORK) is addressed in commit 1656 and 1657.

For reference here is the new code:
Code: Select all
`      IF( INFO.EQ.0 ) THEN         MINWRK = 1         MAXWRK = 1         IF( MINMN.GT.0 ) THEN            IF( M.GE.N ) THEN               MNTHR = ILAENV( 6, 'ZGESVD', JOBU // JOBVT, M, N, 0, 0 )               IF( M.GE.MNTHR ) THEN**                 Path 1 (M much larger than N)*                  MINWRK = N*(N+5)                  MAXWRK = N + N*ILAENV(1,'ZGEQRF',' ',M,N,-1,-1)                  MAXWRK = MAX(MAXWRK,     \$                     N*N+2*N+2*N*ILAENV(1,'ZGEBRD',' ',N,N,-1,-1))                  IF (WANTU .OR. WANTVT) THEN                     MAXWRK = MAX(MAXWRK,     \$                       N*N+2*N+N*ILAENV(1,'ZUNMQR','LN',N,N,N,-1))                  END IF               ELSE**                 Path 2 (M at least N, but not much larger)*                  MINWRK = 3*N + M                  MAXWRK = 2*N + (M+N)*ILAENV(1,'ZGEBRD',' ',M,N,-1,-1)                  IF (WANTU .OR. WANTVT) THEN                     MAXWRK = MAX(MAXWRK,     \$                        2*N+N*ILAENV(1,'ZUNMQR','LN',N,N,N,-1))                  END IF               END IF            ELSE               MNTHR = ILAENV( 6, 'ZGESVD', JOBU // JOBVT, M, N, 0, 0 )               IF( N.GE.MNTHR ) THEN**                 Path 1t (N much larger than M)*                  MINWRK = M*(M+5)                  MAXWRK = M + M*ILAENV(1,'ZGELQF',' ',M,N,-1,-1)                  MAXWRK = MAX(MAXWRK,     \$                     M*M+2*M+2*M*ILAENV(1,'ZGEBRD',' ',M,M,-1,-1))                  IF (WANTU .OR. WANTVT) THEN                     MAXWRK = MAX(MAXWRK,     \$                       M*M+2*M+M*ILAENV(1,'ZUNMQR','LN',M,M,M,-1))                  END IF               ELSE**                 Path 2t (N greater than M, but not much larger)**                  MINWRK = 3*M + N                  MAXWRK = 2*M + (M+N)*ILAENV(1,'ZGEBRD',' ',M,N,-1,-1)                  IF (WANTU .OR. WANTVT) THEN                     MAXWRK = MAX(MAXWRK,     \$                        2*M+M*ILAENV(1,'ZUNMQR','LN',M,M,M,-1))                  END IF               END IF            END IF         END IF`

Thanks a lot, Lawrence.
Julien.
Julien Langou

Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

### Re: [CZ]GESVDX complex workspace corrections / info = -17

Hi Lawrence,

Thank you for pointing out to these problems with the complex workspace in [CZ]GESVDX. I have revised the workspace, and in my estimates minwrk is a little smaller. Please see http://crd.lbl.gov/~osni/TEMP/gesvdx_workspace.pdf (it look like we cannot upload a pdf file in this system...) I was then wondering whether I have missed something -- that would be embarrassing since I have revised the code a number of times.

Regards,

Osni
osni

Posts: 8
Joined: Fri Apr 29, 2005 2:57 pm