241 SUBROUTINE zlatbs( UPLO, TRANS, DIAG, NORMIN, N, KD, AB, LDAB, X,
242 $ SCALE, CNORM, INFO )
249 CHARACTER DIAG, NORMIN, TRANS, UPLO
250 INTEGER INFO, KD, LDAB, N
251 DOUBLE PRECISION SCALE
254 DOUBLE PRECISION CNORM( * )
255 COMPLEX*16 AB( LDAB, * ), X( * )
261 DOUBLE PRECISION ZERO, HALF, ONE, TWO
262 parameter( zero = 0.0d+0, half = 0.5d+0, one = 1.0d+0,
266 LOGICAL NOTRAN, NOUNIT, UPPER
267 INTEGER I, IMAX, J, JFIRST, JINC, JLAST, JLEN, MAIND
268 DOUBLE PRECISION BIGNUM, GROW, REC, SMLNUM, TJJ, TMAX, TSCAL,
270 COMPLEX*16 CSUMJ, TJJS, USCAL, ZDUM
274 INTEGER IDAMAX, IZAMAX
275 DOUBLE PRECISION DLAMCH, DZASUM
276 COMPLEX*16 ZDOTC, ZDOTU, ZLADIV
277 EXTERNAL lsame, idamax, izamax, dlamch, dzasum, zdotc,
284 INTRINSIC abs, dble, dcmplx, dconjg, dimag, max, min
287 DOUBLE PRECISION CABS1, CABS2
290 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
291 cabs2( zdum ) = abs( dble( zdum ) / 2.d0 ) +
292 $ abs( dimag( zdum ) / 2.d0 )
297 upper = lsame( uplo,
'U' )
298 notran = lsame( trans,
'N' )
299 nounit = lsame( diag,
'N' )
303 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
305 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
306 $ lsame( trans,
'C' ) )
THEN
308 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag,
'U' ) )
THEN
310 ELSE IF( .NOT.lsame( normin,
'Y' ) .AND. .NOT.
311 $ lsame( normin,
'N' ) )
THEN
313 ELSE IF( n.LT.0 )
THEN
315 ELSE IF( kd.LT.0 )
THEN
317 ELSE IF( ldab.LT.kd+1 )
THEN
321 CALL xerbla(
'ZLATBS', -info )
333 smlnum = dlamch(
'Safe minimum' ) / dlamch(
'Precision' )
334 bignum = one / smlnum
336 IF( lsame( normin,
'N' ) )
THEN
345 jlen = min( kd, j-1 )
346 cnorm( j ) = dzasum( jlen, ab( kd+1-jlen, j ), 1 )
353 jlen = min( kd, n-j )
355 cnorm( j ) = dzasum( jlen, ab( 2, j ), 1 )
366 imax = idamax( n, cnorm, 1 )
368 IF( tmax.LE.bignum*half )
THEN
371 tscal = half / ( smlnum*tmax )
372 CALL dscal( n, tscal, cnorm, 1 )
380 xmax = max( xmax, cabs2( x( j ) ) )
399 IF( tscal.NE.one )
THEN
411 grow = half / max( xbnd, smlnum )
413 DO 40 j = jfirst, jlast, jinc
420 tjjs = ab( maind, j )
423 IF( tjj.GE.smlnum )
THEN
427 xbnd = min( xbnd, min( one, tjj )*grow )
435 IF( tjj+cnorm( j ).GE.smlnum )
THEN
439 grow = grow*( tjj / ( tjj+cnorm( j ) ) )
454 grow = min( one, half / max( xbnd, smlnum ) )
455 DO 50 j = jfirst, jlast, jinc
464 grow = grow*( one / ( one+cnorm( j ) ) )
485 IF( tscal.NE.one )
THEN
497 grow = half / max( xbnd, smlnum )
499 DO 70 j = jfirst, jlast, jinc
508 xj = one + cnorm( j )
509 grow = min( grow, xbnd / xj )
511 tjjs = ab( maind, j )
514 IF( tjj.GE.smlnum )
THEN
519 $ xbnd = xbnd*( tjj / xj )
527 grow = min( grow, xbnd )
534 grow = min( one, half / max( xbnd, smlnum ) )
535 DO 80 j = jfirst, jlast, jinc
544 xj = one + cnorm( j )
551 IF( ( grow*tscal ).GT.smlnum )
THEN
556 CALL ztbsv( uplo, trans, diag, n, kd, ab, ldab, x, 1 )
561 IF( xmax.GT.bignum*half )
THEN
566 scale = ( bignum*half ) / xmax
567 CALL zdscal( n, scale, x, 1 )
577 DO 120 j = jfirst, jlast, jinc
583 tjjs = ab( maind, j )*tscal
590 IF( tjj.GT.smlnum )
THEN
594 IF( tjj.LT.one )
THEN
595 IF( xj.GT.tjj*bignum )
THEN
600 CALL zdscal( n, rec, x, 1 )
605 x( j ) = zladiv( x( j ), tjjs )
607 ELSE IF( tjj.GT.zero )
THEN
611 IF( xj.GT.tjj*bignum )
THEN
616 rec = ( tjj*bignum ) / xj
617 IF( cnorm( j ).GT.one )
THEN
622 rec = rec / cnorm( j )
624 CALL zdscal( n, rec, x, 1 )
628 x( j ) = zladiv( x( j ), tjjs )
650 IF( cnorm( j ).GT.( bignum-xmax )*rec )
THEN
655 CALL zdscal( n, rec, x, 1 )
658 ELSE IF( xj*cnorm( j ).GT.( bignum-xmax ) )
THEN
662 CALL zdscal( n, half, x, 1 )
673 jlen = min( kd, j-1 )
674 CALL zaxpy( jlen, -x( j )*tscal,
675 $ ab( kd+1-jlen, j ), 1, x( j-jlen ), 1 )
676 i = izamax( j-1, x, 1 )
677 xmax = cabs1( x( i ) )
679 ELSE IF( j.LT.n )
THEN
685 jlen = min( kd, n-j )
687 $
CALL zaxpy( jlen, -x( j )*tscal, ab( 2, j ), 1,
689 i = j + izamax( n-j, x( j+1 ), 1 )
690 xmax = cabs1( x( i ) )
694 ELSE IF( lsame( trans,
'T' ) )
THEN
698 DO 170 j = jfirst, jlast, jinc
705 rec = one / max( xmax, one )
706 IF( cnorm( j ).GT.( bignum-xj )*rec )
THEN
712 tjjs = ab( maind, j )*tscal
717 IF( tjj.GT.one )
THEN
721 rec = min( one, rec*tjj )
722 uscal = zladiv( uscal, tjjs )
724 IF( rec.LT.one )
THEN
725 CALL zdscal( n, rec, x, 1 )
732 IF( uscal.EQ.dcmplx( one ) )
THEN
738 jlen = min( kd, j-1 )
739 csumj = zdotu( jlen, ab( kd+1-jlen, j ), 1,
742 jlen = min( kd, n-j )
744 $ csumj = zdotu( jlen, ab( 2, j ), 1, x( j+1 ),
752 jlen = min( kd, j-1 )
754 csumj = csumj + ( ab( kd+i-jlen, j )*uscal )*
758 jlen = min( kd, n-j )
760 csumj = csumj + ( ab( i+1, j )*uscal )*x( j+i )
765 IF( uscal.EQ.dcmplx( tscal ) )
THEN
770 x( j ) = x( j ) - csumj
776 tjjs = ab( maind, j )*tscal
783 IF( tjj.GT.smlnum )
THEN
787 IF( tjj.LT.one )
THEN
788 IF( xj.GT.tjj*bignum )
THEN
793 CALL zdscal( n, rec, x, 1 )
798 x( j ) = zladiv( x( j ), tjjs )
799 ELSE IF( tjj.GT.zero )
THEN
803 IF( xj.GT.tjj*bignum )
THEN
807 rec = ( tjj*bignum ) / xj
808 CALL zdscal( n, rec, x, 1 )
812 x( j ) = zladiv( x( j ), tjjs )
831 x( j ) = zladiv( x( j ), tjjs ) - csumj
833 xmax = max( xmax, cabs1( x( j ) ) )
840 DO 220 j = jfirst, jlast, jinc
847 rec = one / max( xmax, one )
848 IF( cnorm( j ).GT.( bignum-xj )*rec )
THEN
854 tjjs = dconjg( ab( maind, j ) )*tscal
859 IF( tjj.GT.one )
THEN
863 rec = min( one, rec*tjj )
864 uscal = zladiv( uscal, tjjs )
866 IF( rec.LT.one )
THEN
867 CALL zdscal( n, rec, x, 1 )
874 IF( uscal.EQ.dcmplx( one ) )
THEN
880 jlen = min( kd, j-1 )
881 csumj = zdotc( jlen, ab( kd+1-jlen, j ), 1,
884 jlen = min( kd, n-j )
886 $ csumj = zdotc( jlen, ab( 2, j ), 1, x( j+1 ),
894 jlen = min( kd, j-1 )
896 csumj = csumj + ( dconjg( ab( kd+i-jlen, j ) )*
897 $ uscal )*x( j-jlen-1+i )
900 jlen = min( kd, n-j )
902 csumj = csumj + ( dconjg( ab( i+1, j ) )*uscal )
908 IF( uscal.EQ.dcmplx( tscal ) )
THEN
913 x( j ) = x( j ) - csumj
919 tjjs = dconjg( ab( maind, j ) )*tscal
926 IF( tjj.GT.smlnum )
THEN
930 IF( tjj.LT.one )
THEN
931 IF( xj.GT.tjj*bignum )
THEN
936 CALL zdscal( n, rec, x, 1 )
941 x( j ) = zladiv( x( j ), tjjs )
942 ELSE IF( tjj.GT.zero )
THEN
946 IF( xj.GT.tjj*bignum )
THEN
950 rec = ( tjj*bignum ) / xj
951 CALL zdscal( n, rec, x, 1 )
955 x( j ) = zladiv( x( j ), tjjs )
974 x( j ) = zladiv( x( j ), tjjs ) - csumj
976 xmax = max( xmax, cabs1( x( j ) ) )
979 scale = scale / tscal
984 IF( tscal.NE.one )
THEN
985 CALL dscal( n, one / tscal, cnorm, 1 )
subroutine xerbla(srname, info)
subroutine zaxpy(n, za, zx, incx, zy, incy)
ZAXPY
subroutine zlatbs(uplo, trans, diag, normin, n, kd, ab, ldab, x, scale, cnorm, info)
ZLATBS solves a triangular banded system of equations.
subroutine dscal(n, da, dx, incx)
DSCAL
subroutine zdscal(n, da, zx, incx)
ZDSCAL
subroutine ztbsv(uplo, trans, diag, n, k, a, lda, x, incx)
ZTBSV