251 SUBROUTINE zhbgvd( JOBZ, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, W,
252 $ z, ldz, work, lwork, rwork, lrwork, iwork,
262 INTEGER info, ka, kb, ldab, ldbb, ldz, liwork, lrwork,
267 DOUBLE PRECISION rwork( * ), w( * )
268 COMPLEX*16 ab( ldab, * ), bb( ldbb, * ), work( * ),
275 COMPLEX*16 cone, czero
276 parameter( cone = ( 1.0d+0, 0.0d+0 ),
277 $ czero = ( 0.0d+0, 0.0d+0 ) )
280 LOGICAL lquery, upper, wantz
282 INTEGER iinfo, inde, indwk2, indwrk, liwmin, llrwk,
283 $ llwk2, lrwmin, lwmin
297 wantz =
lsame( jobz,
'V' )
298 upper =
lsame( uplo,
'U' )
299 lquery = ( lwork.EQ.-1 .OR. lrwork.EQ.-1 .OR. liwork.EQ.-1 )
306 ELSE IF( wantz )
THEN
308 lrwmin = 1 + 5*n + 2*n**2
315 IF( .NOT.( wantz .OR.
lsame( jobz,
'N' ) ) )
THEN
317 ELSE IF( .NOT.( upper .OR.
lsame( uplo,
'L' ) ) )
THEN
319 ELSE IF( n.LT.0 )
THEN
321 ELSE IF( ka.LT.0 )
THEN
323 ELSE IF( kb.LT.0 .OR. kb.GT.ka )
THEN
325 ELSE IF( ldab.LT.ka+1 )
THEN
327 ELSE IF( ldbb.LT.kb+1 )
THEN
329 ELSE IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) )
THEN
338 IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
340 ELSE IF( lrwork.LT.lrwmin .AND. .NOT.lquery )
THEN
342 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
348 CALL
xerbla(
'ZHBGVD', -info )
350 ELSE IF( lquery )
THEN
361 CALL
zpbstf( uplo, n, kb, bb, ldbb, info )
372 llwk2 = lwork - indwk2 + 2
373 llrwk = lrwork - indwrk + 2
374 CALL
zhbgst( jobz, uplo, n, ka, kb, ab, ldab, bb, ldbb, z, ldz,
375 $ work, rwork( indwrk ), iinfo )
384 CALL
zhbtrd( vect, uplo, n, ka, ab, ldab, w, rwork( inde ), z,
389 IF( .NOT.wantz )
THEN
390 CALL
dsterf( n, w, rwork( inde ), info )
392 CALL
zstedc(
'I', n, w, rwork( inde ), work, n, work( indwk2 ),
393 $ llwk2, rwork( indwrk ), llrwk, iwork, liwork,
395 CALL
zgemm(
'N',
'N', n, n, n, cone, z, ldz, work, n, czero,
396 $ work( indwk2 ), n )
397 CALL
zlacpy(
'A', n, n, work( indwk2 ), n, z, ldz )