227 SUBROUTINE ssbgvd( 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 REAL ab( ldab, * ), bb( ldbb, * ), w( * ),
242 $ work( * ), z( ldz, * )
249 parameter( one = 1.0e+0, zero = 0.0e+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(
'SSBGVD', -info )
317 ELSE IF( lquery )
THEN
328 CALL
spbstf( uplo, n, kb, bb, ldbb, info )
338 indwk2 = indwrk + n*n
339 llwrk2 = lwork - indwk2 + 1
340 CALL
ssbgst( jobz, uplo, n, ka, kb, ab, ldab, bb, ldbb, z, ldz,
341 $ work( indwrk ), iinfo )
350 CALL
ssbtrd( vect, uplo, n, ka, ab, ldab, w, work( inde ), z, ldz,
351 $ work( indwrk ), iinfo )
355 IF( .NOT.wantz )
THEN
356 CALL
ssterf( n, w, work( inde ), info )
358 CALL
sstedc(
'I', n, w, work( inde ), work( indwrk ), n,
359 $ work( indwk2 ), llwrk2, iwork, liwork, info )
360 CALL
sgemm(
'N',
'N', n, n, n, one, z, ldz, work( indwrk ), n,
361 $ zero, work( indwk2 ), n )
362 CALL
slacpy(
'A', n, n, work( indwk2 ), n, z, ldz )