Page 1 of 1

WORK(1) bug in ZHBGVD?

PostPosted: Tue Aug 28, 2007 7:36 am
by mickpont
I think there is a bug in the value of WORK(1) returned by ZHBGVD
when N = 1. In the LAPACK 3.1.1 version of the routine, WORK(1)
is always set to 1 when N = 1. However, if WANTZ = .TRUE. (i.e.
when JOBZ = 'V'), an extra element of workspace is needed
for use by the later calls of ZSTEDC, ZGEMM and ZLACPY.

I suggest that instead of

INFO = 0
IF( N.LE.1 ) THEN
LWMIN = 1
LRWMIN = 1
LIWMIN = 1
ELSE IF( WANTZ ) THEN
LWMIN = 2*N**2
LRWMIN = 1 + 5*N + 2*N**2
LIWMIN = 3 + 5*N
ELSE
LWMIN = N
LRWMIN = N
LIWMIN = 1
END IF

the code should read something like this:

INFO = 0
IF( WANTZ ) THEN
LWMIN = MAX( 1, 2*N**2 )
LRWMIN = MAX( 1, 1 + 5*N + 2*N**2 )
IF ( N.LE.1 ) THEN
LIWMIN = 1
ELSE
LIWMIN = 3 + 5*N
END IF
ELSE
LWMIN = MAX( 1, N )
LRWMIN = MAX( 1, N )
LIWMIN = 1
END IF


Similar problems may apply to CHBGVD, SSBGVD and DSBGVD.

Mick Pont