241 SUBROUTINE clatbs( 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
255 COMPLEX AB( LDAB, * ), X( * )
261 REAL ZERO, HALF, ONE, TWO
262 parameter( zero = 0.0e+0, half = 0.5e+0, one = 1.0e+0,
266 LOGICAL NOTRAN, NOUNIT, UPPER
267 INTEGER I, IMAX, J, JFIRST, JINC, JLAST, JLEN, MAIND
268 REAL BIGNUM, GROW, REC, SMLNUM, TJJ, TMAX, TSCAL,
270 COMPLEX CSUMJ, TJJS, USCAL, ZDUM
274 INTEGER ICAMAX, ISAMAX
276 COMPLEX CDOTC, CDOTU, CLADIV
277 EXTERNAL lsame, icamax, isamax, scasum, slamch, cdotc,
284 INTRINSIC abs, aimag, cmplx, conjg, max, min, real
290 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
291 cabs2( zdum ) = abs( real( zdum ) / 2. ) +
292 $ abs( aimag( zdum ) / 2. )
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(
'CLATBS', -info )
333 smlnum = slamch(
'Safe minimum' ) / slamch(
'Precision' )
334 bignum = one / smlnum
336 IF( lsame( normin,
'N' ) )
THEN
345 jlen = min( kd, j-1 )
346 cnorm( j ) = scasum( jlen, ab( kd+1-jlen, j ), 1 )
353 jlen = min( kd, n-j )
355 cnorm( j ) = scasum( jlen, ab( 2, j ), 1 )
366 imax = isamax( n, cnorm, 1 )
368 IF( tmax.LE.bignum*half )
THEN
371 tscal = half / ( smlnum*tmax )
372 CALL sscal( 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 ctbsv( uplo, trans, diag, n, kd, ab, ldab, x, 1 )
561 IF( xmax.GT.bignum*half )
THEN
566 scale = ( bignum*half ) / xmax
567 CALL csscal( n, scale, x, 1 )
577 DO 110 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 csscal( n, rec, x, 1 )
605 x( j ) = cladiv( 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 csscal( n, rec, x, 1 )
628 x( j ) = cladiv( x( j ), tjjs )
650 IF( cnorm( j ).GT.( bignum-xmax )*rec )
THEN
655 CALL csscal( n, rec, x, 1 )
658 ELSE IF( xj*cnorm( j ).GT.( bignum-xmax ) )
THEN
662 CALL csscal( n, half, x, 1 )
673 jlen = min( kd, j-1 )
674 CALL caxpy( jlen, -x( j )*tscal,
675 $ ab( kd+1-jlen, j ), 1, x( j-jlen ), 1 )
676 i = icamax( j-1, x, 1 )
677 xmax = cabs1( x( i ) )
679 ELSE IF( j.LT.n )
THEN
685 jlen = min( kd, n-j )
687 $
CALL caxpy( jlen, -x( j )*tscal, ab( 2, j ), 1,
689 i = j + icamax( n-j, x( j+1 ), 1 )
690 xmax = cabs1( x( i ) )
694 ELSE IF( lsame( trans,
'T' ) )
THEN
698 DO 150 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 = cladiv( uscal, tjjs )
724 IF( rec.LT.one )
THEN
725 CALL csscal( n, rec, x, 1 )
732 IF( uscal.EQ.cmplx( one ) )
THEN
738 jlen = min( kd, j-1 )
739 csumj = cdotu( jlen, ab( kd+1-jlen, j ), 1,
742 jlen = min( kd, n-j )
744 $ csumj = cdotu( 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.cmplx( 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 csscal( n, rec, x, 1 )
798 x( j ) = cladiv( x( j ), tjjs )
799 ELSE IF( tjj.GT.zero )
THEN
803 IF( xj.GT.tjj*bignum )
THEN
807 rec = ( tjj*bignum ) / xj
808 CALL csscal( n, rec, x, 1 )
812 x( j ) = cladiv( x( j ), tjjs )
831 x( j ) = cladiv( x( j ), tjjs ) - csumj
833 xmax = max( xmax, cabs1( x( j ) ) )
840 DO 190 j = jfirst, jlast, jinc
847 rec = one / max( xmax, one )
848 IF( cnorm( j ).GT.( bignum-xj )*rec )
THEN
854 tjjs = conjg( ab( maind, j ) )*tscal
859 IF( tjj.GT.one )
THEN
863 rec = min( one, rec*tjj )
864 uscal = cladiv( uscal, tjjs )
866 IF( rec.LT.one )
THEN
867 CALL csscal( n, rec, x, 1 )
874 IF( uscal.EQ.cmplx( one ) )
THEN
880 jlen = min( kd, j-1 )
881 csumj = cdotc( jlen, ab( kd+1-jlen, j ), 1,
884 jlen = min( kd, n-j )
886 $ csumj = cdotc( jlen, ab( 2, j ), 1, x( j+1 ),
894 jlen = min( kd, j-1 )
896 csumj = csumj + ( conjg( ab( kd+i-jlen, j ) )*
897 $ uscal )*x( j-jlen-1+i )
900 jlen = min( kd, n-j )
902 csumj = csumj + ( conjg( ab( i+1, j ) )*uscal )*
908 IF( uscal.EQ.cmplx( tscal ) )
THEN
913 x( j ) = x( j ) - csumj
919 tjjs = conjg( 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 csscal( n, rec, x, 1 )
941 x( j ) = cladiv( x( j ), tjjs )
942 ELSE IF( tjj.GT.zero )
THEN
946 IF( xj.GT.tjj*bignum )
THEN
950 rec = ( tjj*bignum ) / xj
951 CALL csscal( n, rec, x, 1 )
955 x( j ) = cladiv( x( j ), tjjs )
974 x( j ) = cladiv( x( j ), tjjs ) - csumj
976 xmax = max( xmax, cabs1( x( j ) ) )
979 scale = scale / tscal
984 IF( tscal.NE.one )
THEN
985 CALL sscal( n, one / tscal, cnorm, 1 )
subroutine xerbla(srname, info)
subroutine caxpy(n, ca, cx, incx, cy, incy)
CAXPY
subroutine clatbs(uplo, trans, diag, normin, n, kd, ab, ldab, x, scale, cnorm, info)
CLATBS solves a triangular banded system of equations.
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine ctbsv(uplo, trans, diag, n, k, a, lda, x, incx)
CTBSV