159 SUBROUTINE ssbtrd( VECT, UPLO, N, KD, AB, LDAB, D, E, Q, LDQ,
168 INTEGER INFO, KD, LDAB, LDQ, N
171 REAL AB( LDAB, * ), D( * ), E( * ), Q( LDQ, * ),
179 parameter( zero = 0.0e+0, one = 1.0e+0 )
182 LOGICAL INITQ, UPPER, WANTQ
183 INTEGER I, I2, IBL, INCA, INCX, IQAEND, IQB, IQEND, J,
184 $ j1, j1end, j1inc, j2, jend, jin, jinc, k, kd1,
185 $ kdm1, kdn, l, last, lend, nq, nr, nrt
204 initq = lsame( vect,
'V' )
205 wantq = initq .OR. lsame( vect,
'U' )
206 upper = lsame( uplo,
'U' )
213 IF( .NOT.wantq .AND. .NOT.lsame( vect,
'N' ) )
THEN
215 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
217 ELSE IF( n.LT.0 )
THEN
219 ELSE IF( kd.LT.0 )
THEN
221 ELSE IF( ldab.LT.kd1 )
THEN
223 ELSE IF( ldq.LT.max( 1, n ) .AND. wantq )
THEN
227 CALL xerbla(
'SSBTRD', -info )
239 $
CALL slaset(
'Full', n, n, zero, one, q, ldq )
263 DO 80 k = kdn + 1, 2, -1
272 CALL slargv( nr, ab( 1, j1-1 ), inca,
274 $ kd1, d( j1 ), kd1 )
282 IF( nr.GE.2*kd-1 )
THEN
284 CALL slartv( nr, ab( l+1, j1-1 ), inca,
285 $ ab( l, j1 ), inca, d( j1 ),
290 jend = j1 + ( nr-1 )*kd1
291 DO 20 jinc = j1, jend, kd1
292 CALL srot( kdm1, ab( 2, jinc-1 ), 1,
293 $ ab( 1, jinc ), 1, d( jinc ),
301 IF( k.LE.n-i+1 )
THEN
306 CALL slartg( ab( kd-k+3, i+k-2 ),
307 $ ab( kd-k+2, i+k-1 ), d( i+k-1 ),
308 $ work( i+k-1 ), temp )
309 ab( kd-k+3, i+k-2 ) = temp
313 CALL srot( k-3, ab( kd-k+4, i+k-2 ), 1,
314 $ ab( kd-k+3, i+k-1 ), 1, d( i+k-1 ),
325 $
CALL slar2v( nr, ab( kd1, j1-1 ), ab( kd1, j1 ),
326 $ ab( kd, j1 ), inca, d( j1 ),
332 IF( 2*kd-1.LT.nr )
THEN
344 $
CALL slartv( nrt, ab( kd-l, j1+l ),
346 $ ab( kd-l+1, j1+l ), inca,
347 $ d( j1 ), work( j1 ), kd1 )
350 j1end = j1 + kd1*( nr-2 )
351 IF( j1end.GE.j1 )
THEN
352 DO 40 jin = j1, j1end, kd1
353 CALL srot( kd-1, ab( kd-1, jin+1 ),
355 $ ab( kd, jin+1 ), incx,
356 $ d( jin ), work( jin ) )
359 lend = min( kdm1, n-j2 )
362 $
CALL srot( lend, ab( kd-1, last+1 ), incx,
363 $ ab( kd, last+1 ), incx, d( last ),
377 iqend = max( iqend, j2 )
381 $ iqaend = iqaend + kd
382 iqaend = min( iqaend, iqend )
383 DO 50 j = j1, j2, kd1
386 iqb = max( 1, j-ibl )
387 nq = 1 + iqaend - iqb
388 iqaend = min( iqaend+kd, iqend )
389 CALL srot( nq, q( iqb, j-1 ), 1, q( iqb,
391 $ 1, d( j ), work( j ) )
395 DO 60 j = j1, j2, kd1
396 CALL srot( n, q( 1, j-1 ), 1, q( 1, j ),
398 $ d( j ), work( j ) )
404 IF( j2+kdn.GT.n )
THEN
412 DO 70 j = j1, j2, kd1
417 work( j+kd ) = work( j )*ab( 1, j+kd )
418 ab( 1, j+kd ) = d( j )*ab( 1, j+kd )
429 e( i ) = ab( kd, i+1 )
443 d( i ) = ab( kd1, i )
460 DO 200 k = kdn + 1, 2, -1
469 CALL slargv( nr, ab( kd1, j1-kd1 ), inca,
470 $ work( j1 ), kd1, d( j1 ), kd1 )
478 IF( nr.GT.2*kd-1 )
THEN
480 CALL slartv( nr, ab( kd1-l, j1-kd1+l ),
482 $ ab( kd1-l+1, j1-kd1+l ), inca,
483 $ d( j1 ), work( j1 ), kd1 )
486 jend = j1 + kd1*( nr-1 )
487 DO 140 jinc = j1, jend, kd1
488 CALL srot( kdm1, ab( kd, jinc-kd ), incx,
489 $ ab( kd1, jinc-kd ), incx,
490 $ d( jinc ), work( jinc ) )
497 IF( k.LE.n-i+1 )
THEN
502 CALL slartg( ab( k-1, i ), ab( k, i ),
503 $ d( i+k-1 ), work( i+k-1 ), temp )
508 CALL srot( k-3, ab( k-2, i+1 ), ldab-1,
509 $ ab( k-1, i+1 ), ldab-1, d( i+k-1 ),
520 $
CALL slar2v( nr, ab( 1, j1-1 ), ab( 1, j1 ),
521 $ ab( 2, j1-1 ), inca, d( j1 ),
531 IF( nr.GT.2*kd-1 )
THEN
539 $
CALL slartv( nrt, ab( l+2, j1-1 ),
541 $ ab( l+1, j1 ), inca, d( j1 ),
545 j1end = j1 + kd1*( nr-2 )
546 IF( j1end.GE.j1 )
THEN
547 DO 160 j1inc = j1, j1end, kd1
548 CALL srot( kdm1, ab( 3, j1inc-1 ), 1,
549 $ ab( 2, j1inc ), 1, d( j1inc ),
553 lend = min( kdm1, n-j2 )
556 $
CALL srot( lend, ab( 3, last-1 ), 1,
557 $ ab( 2, last ), 1, d( last ),
573 iqend = max( iqend, j2 )
577 $ iqaend = iqaend + kd
578 iqaend = min( iqaend, iqend )
579 DO 170 j = j1, j2, kd1
582 iqb = max( 1, j-ibl )
583 nq = 1 + iqaend - iqb
584 iqaend = min( iqaend+kd, iqend )
585 CALL srot( nq, q( iqb, j-1 ), 1, q( iqb,
587 $ 1, d( j ), work( j ) )
591 DO 180 j = j1, j2, kd1
592 CALL srot( n, q( 1, j-1 ), 1, q( 1, j ),
594 $ d( j ), work( j ) )
599 IF( j2+kdn.GT.n )
THEN
607 DO 190 j = j1, j2, kd1
612 work( j+kd ) = work( j )*ab( kd1, j )
613 ab( kd1, j ) = d( j )*ab( kd1, j )