227 SUBROUTINE dsbgvd( JOBZ, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, W,
228 $ z, ldz, work, lwork, iwork, liwork, info )
237 INTEGER info, ka, kb, ldab, ldbb, ldz, liwork, lwork, n
241 DOUBLE PRECISION ab( ldab, * ), bb( ldbb, * ), w( * ),
242 $ work( * ), z( ldz, * )
248 DOUBLE PRECISION one, zero
249 parameter( one = 1.0d+0, zero = 0.0d+0 )
252 LOGICAL lquery, upper, wantz
254 INTEGER iinfo, inde, indwk2, indwrk, liwmin, llwrk2,
269 wantz =
lsame( jobz,
'V' )
270 upper =
lsame( uplo,
'U' )
271 lquery = ( lwork.EQ.-1 .OR. liwork.EQ.-1 )
277 ELSE IF( wantz )
THEN
279 lwmin = 1 + 5*n + 2*n**2
285 IF( .NOT.( wantz .OR.
lsame( jobz,
'N' ) ) )
THEN
287 ELSE IF( .NOT.( upper .OR.
lsame( uplo,
'L' ) ) )
THEN
289 ELSE IF( n.LT.0 )
THEN
291 ELSE IF( ka.LT.0 )
THEN
293 ELSE IF( kb.LT.0 .OR. kb.GT.ka )
THEN
295 ELSE IF( ldab.LT.ka+1 )
THEN
297 ELSE IF( ldbb.LT.kb+1 )
THEN
299 ELSE IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) )
THEN
307 IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
309 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
315 CALL
xerbla(
'DSBGVD', -info )
317 ELSE IF( lquery )
THEN
328 CALL
dpbstf( uplo, n, kb, bb, ldbb, info )
338 indwk2 = indwrk + n*n
339 llwrk2 = lwork - indwk2 + 1
340 CALL
dsbgst( jobz, uplo, n, ka, kb, ab, ldab, bb, ldbb, z, ldz,
341 $ work( indwrk ), iinfo )
350 CALL
dsbtrd( vect, uplo, n, ka, ab, ldab, w, work( inde ), z, ldz,
351 $ work( indwrk ), iinfo )
355 IF( .NOT.wantz )
THEN
356 CALL
dsterf( n, w, work( inde ), info )
358 CALL
dstedc(
'I', n, w, work( inde ), work( indwrk ), n,
359 $ work( indwk2 ), llwrk2, iwork, liwork, info )
360 CALL
dgemm(
'N',
'N', n, n, n, one, z, ldz, work( indwrk ), n,
361 $ zero, work( indwk2 ), n )
362 CALL
dlacpy(
'A', n, n, work( indwk2 ), n, z, ldz )