159 SUBROUTINE chbtrd( VECT, UPLO, N, KD, AB, LDAB, D, E, Q, LDQ,
168 INTEGER INFO, KD, LDAB, LDQ, N
172 COMPLEX AB( LDAB, * ), Q( LDQ, * ), WORK( * )
179 parameter( zero = 0.0e+0 )
181 parameter( czero = ( 0.0e+0, 0.0e+0 ),
182 $ cone = ( 1.0e+0, 0.0e+0 ) )
185 LOGICAL INITQ, UPPER, WANTQ
186 INTEGER I, I2, IBL, INCA, INCX, IQAEND, IQB, IQEND, J,
187 $ j1, j1end, j1inc, j2, jend, jin, jinc, k, kd1,
188 $ kdm1, kdn, l, last, lend, nq, nr, nrt
198 INTRINSIC abs, conjg, max, min, real
208 initq = lsame( vect,
'V' )
209 wantq = initq .OR. lsame( vect,
'U' )
210 upper = lsame( uplo,
'U' )
217 IF( .NOT.wantq .AND. .NOT.lsame( vect,
'N' ) )
THEN
219 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
221 ELSE IF( n.LT.0 )
THEN
223 ELSE IF( kd.LT.0 )
THEN
225 ELSE IF( ldab.LT.kd1 )
THEN
227 ELSE IF( ldq.LT.max( 1, n ) .AND. wantq )
THEN
231 CALL xerbla(
'CHBTRD', -info )
243 $
CALL claset(
'Full', n, n, czero, cone, q, ldq )
264 ab( kd1, 1 ) = real( ab( kd1, 1 ) )
269 DO 80 k = kdn + 1, 2, -1
278 CALL clargv( nr, ab( 1, j1-1 ), inca,
280 $ kd1, d( j1 ), kd1 )
288 IF( nr.GE.2*kd-1 )
THEN
290 CALL clartv( nr, ab( l+1, j1-1 ), inca,
291 $ ab( l, j1 ), inca, d( j1 ),
296 jend = j1 + ( nr-1 )*kd1
297 DO 20 jinc = j1, jend, kd1
298 CALL crot( kdm1, ab( 2, jinc-1 ), 1,
299 $ ab( 1, jinc ), 1, d( jinc ),
307 IF( k.LE.n-i+1 )
THEN
312 CALL clartg( ab( kd-k+3, i+k-2 ),
313 $ ab( kd-k+2, i+k-1 ), d( i+k-1 ),
314 $ work( i+k-1 ), temp )
315 ab( kd-k+3, i+k-2 ) = temp
319 CALL crot( k-3, ab( kd-k+4, i+k-2 ), 1,
320 $ ab( kd-k+3, i+k-1 ), 1, d( i+k-1 ),
331 $
CALL clar2v( nr, ab( kd1, j1-1 ), ab( kd1, j1 ),
332 $ ab( kd, j1 ), inca, d( j1 ),
338 CALL clacgv( nr, work( j1 ), kd1 )
339 IF( 2*kd-1.LT.nr )
THEN
351 $
CALL clartv( nrt, ab( kd-l, j1+l ),
353 $ ab( kd-l+1, j1+l ), inca,
354 $ d( j1 ), work( j1 ), kd1 )
357 j1end = j1 + kd1*( nr-2 )
358 IF( j1end.GE.j1 )
THEN
359 DO 40 jin = j1, j1end, kd1
360 CALL crot( kd-1, ab( kd-1, jin+1 ),
362 $ ab( kd, jin+1 ), incx,
363 $ d( jin ), work( jin ) )
366 lend = min( kdm1, n-j2 )
369 $
CALL crot( lend, ab( kd-1, last+1 ), incx,
370 $ ab( kd, last+1 ), incx, d( last ),
384 iqend = max( iqend, j2 )
388 $ iqaend = iqaend + kd
389 iqaend = min( iqaend, iqend )
390 DO 50 j = j1, j2, kd1
393 iqb = max( 1, j-ibl )
394 nq = 1 + iqaend - iqb
395 iqaend = min( iqaend+kd, iqend )
396 CALL crot( nq, q( iqb, j-1 ), 1, q( iqb,
398 $ 1, d( j ), conjg( work( j ) ) )
402 DO 60 j = j1, j2, kd1
403 CALL crot( n, q( 1, j-1 ), 1, q( 1, j ),
405 $ d( j ), conjg( work( j ) ) )
411 IF( j2+kdn.GT.n )
THEN
419 DO 70 j = j1, j2, kd1
424 work( j+kd ) = work( j )*ab( 1, j+kd )
425 ab( 1, j+kd ) = d( j )*ab( 1, j+kd )
440 IF( abst.NE.zero )
THEN
446 $ ab( kd, i+2 ) = ab( kd, i+2 )*t
448 CALL cscal( n, conjg( t ), q( 1, i+1 ), 1 )
463 d( i ) = real( ab( kd1, i ) )
477 ab( 1, 1 ) = real( ab( 1, 1 ) )
482 DO 200 k = kdn + 1, 2, -1
491 CALL clargv( nr, ab( kd1, j1-kd1 ), inca,
492 $ work( j1 ), kd1, d( j1 ), kd1 )
500 IF( nr.GT.2*kd-1 )
THEN
502 CALL clartv( nr, ab( kd1-l, j1-kd1+l ),
504 $ ab( kd1-l+1, j1-kd1+l ), inca,
505 $ d( j1 ), work( j1 ), kd1 )
508 jend = j1 + kd1*( nr-1 )
509 DO 140 jinc = j1, jend, kd1
510 CALL crot( kdm1, ab( kd, jinc-kd ), incx,
511 $ ab( kd1, jinc-kd ), incx,
512 $ d( jinc ), work( jinc ) )
519 IF( k.LE.n-i+1 )
THEN
524 CALL clartg( ab( k-1, i ), ab( k, i ),
525 $ d( i+k-1 ), work( i+k-1 ), temp )
530 CALL crot( k-3, ab( k-2, i+1 ), ldab-1,
531 $ ab( k-1, i+1 ), ldab-1, d( i+k-1 ),
542 $
CALL clar2v( nr, ab( 1, j1-1 ), ab( 1, j1 ),
543 $ ab( 2, j1-1 ), inca, d( j1 ),
553 CALL clacgv( nr, work( j1 ), kd1 )
554 IF( nr.GT.2*kd-1 )
THEN
562 $
CALL clartv( nrt, ab( l+2, j1-1 ),
564 $ ab( l+1, j1 ), inca, d( j1 ),
568 j1end = j1 + kd1*( nr-2 )
569 IF( j1end.GE.j1 )
THEN
570 DO 160 j1inc = j1, j1end, kd1
571 CALL crot( kdm1, ab( 3, j1inc-1 ), 1,
572 $ ab( 2, j1inc ), 1, d( j1inc ),
576 lend = min( kdm1, n-j2 )
579 $
CALL crot( lend, ab( 3, last-1 ), 1,
580 $ ab( 2, last ), 1, d( last ),
596 iqend = max( iqend, j2 )
600 $ iqaend = iqaend + kd
601 iqaend = min( iqaend, iqend )
602 DO 170 j = j1, j2, kd1
605 iqb = max( 1, j-ibl )
606 nq = 1 + iqaend - iqb
607 iqaend = min( iqaend+kd, iqend )
608 CALL crot( nq, q( iqb, j-1 ), 1, q( iqb,
610 $ 1, d( j ), work( j ) )
614 DO 180 j = j1, j2, kd1
615 CALL crot( n, q( 1, j-1 ), 1, q( 1, j ),
617 $ d( j ), work( j ) )
622 IF( j2+kdn.GT.n )
THEN
630 DO 190 j = j1, j2, kd1
635 work( j+kd ) = work( j )*ab( kd1, j )
636 ab( kd1, j ) = d( j )*ab( kd1, j )
651 IF( abst.NE.zero )
THEN
657 $ ab( 2, i+1 ) = ab( 2, i+1 )*t
659 CALL cscal( n, t, q( 1, i+1 ), 1 )
674 d( i ) = real( ab( 1, i ) )