240 SUBROUTINE slatbs( UPLO, TRANS, DIAG, NORMIN, N, KD, AB, LDAB, X,
241 $ SCALE, CNORM, INFO )
248 CHARACTER DIAG, NORMIN, TRANS, UPLO
249 INTEGER INFO, KD, LDAB, N
253 REAL AB( LDAB, * ), CNORM( * ), X( * )
260 parameter( zero = 0.0e+0, half = 0.5e+0, one = 1.0e+0 )
263 LOGICAL NOTRAN, NOUNIT, UPPER
264 INTEGER I, IMAX, J, JFIRST, JINC, JLAST, JLEN, MAIND
265 REAL BIGNUM, GROW, REC, SMLNUM, SUMJ, TJJ, TJJS,
266 $ tmax, tscal, uscal, xbnd, xj, xmax
271 REAL SASUM, SDOT, SLAMCH
272 EXTERNAL lsame, isamax, sasum, sdot, slamch
278 INTRINSIC abs, max, min
283 upper = lsame( uplo,
'U' )
284 notran = lsame( trans,
'N' )
285 nounit = lsame( diag,
'N' )
289 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
291 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
292 $ lsame( trans,
'C' ) )
THEN
294 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag,
'U' ) )
THEN
296 ELSE IF( .NOT.lsame( normin,
'Y' ) .AND. .NOT.
297 $ lsame( normin,
'N' ) )
THEN
299 ELSE IF( n.LT.0 )
THEN
301 ELSE IF( kd.LT.0 )
THEN
303 ELSE IF( ldab.LT.kd+1 )
THEN
307 CALL xerbla(
'SLATBS', -info )
319 smlnum = slamch(
'Safe minimum' ) / slamch(
'Precision' )
320 bignum = one / smlnum
322 IF( lsame( normin,
'N' ) )
THEN
331 jlen = min( kd, j-1 )
332 cnorm( j ) = sasum( jlen, ab( kd+1-jlen, j ), 1 )
339 jlen = min( kd, n-j )
341 cnorm( j ) = sasum( jlen, ab( 2, j ), 1 )
352 imax = isamax( n, cnorm, 1 )
354 IF( tmax.LE.bignum )
THEN
357 tscal = one / ( smlnum*tmax )
358 CALL sscal( n, tscal, cnorm, 1 )
364 j = isamax( n, x, 1 )
383 IF( tscal.NE.one )
THEN
395 grow = one / max( xbnd, smlnum )
397 DO 30 j = jfirst, jlast, jinc
406 tjj = abs( ab( maind, j ) )
407 xbnd = min( xbnd, min( one, tjj )*grow )
408 IF( tjj+cnorm( j ).GE.smlnum )
THEN
412 grow = grow*( tjj / ( tjj+cnorm( j ) ) )
427 grow = min( one, one / max( xbnd, smlnum ) )
428 DO 40 j = jfirst, jlast, jinc
437 grow = grow*( one / ( one+cnorm( j ) ) )
458 IF( tscal.NE.one )
THEN
470 grow = one / max( xbnd, smlnum )
472 DO 60 j = jfirst, jlast, jinc
481 xj = one + cnorm( j )
482 grow = min( grow, xbnd / xj )
486 tjj = abs( ab( maind, j ) )
488 $ xbnd = xbnd*( tjj / xj )
490 grow = min( grow, xbnd )
497 grow = min( one, one / max( xbnd, smlnum ) )
498 DO 70 j = jfirst, jlast, jinc
507 xj = one + cnorm( j )
514 IF( ( grow*tscal ).GT.smlnum )
THEN
519 CALL stbsv( uplo, trans, diag, n, kd, ab, ldab, x, 1 )
524 IF( xmax.GT.bignum )
THEN
529 scale = bignum / xmax
530 CALL sscal( n, scale, x, 1 )
538 DO 100 j = jfirst, jlast, jinc
544 tjjs = ab( maind, j )*tscal
551 IF( tjj.GT.smlnum )
THEN
555 IF( tjj.LT.one )
THEN
556 IF( xj.GT.tjj*bignum )
THEN
561 CALL sscal( n, rec, x, 1 )
566 x( j ) = x( j ) / tjjs
568 ELSE IF( tjj.GT.zero )
THEN
572 IF( xj.GT.tjj*bignum )
THEN
577 rec = ( tjj*bignum ) / xj
578 IF( cnorm( j ).GT.one )
THEN
583 rec = rec / cnorm( j )
585 CALL sscal( n, rec, x, 1 )
589 x( j ) = x( j ) / tjjs
611 IF( cnorm( j ).GT.( bignum-xmax )*rec )
THEN
616 CALL sscal( n, rec, x, 1 )
619 ELSE IF( xj*cnorm( j ).GT.( bignum-xmax ) )
THEN
623 CALL sscal( n, half, x, 1 )
634 jlen = min( kd, j-1 )
635 CALL saxpy( jlen, -x( j )*tscal,
636 $ ab( kd+1-jlen, j ), 1, x( j-jlen ), 1 )
637 i = isamax( j-1, x, 1 )
640 ELSE IF( j.LT.n )
THEN
646 jlen = min( kd, n-j )
648 $
CALL saxpy( jlen, -x( j )*tscal, ab( 2, j ), 1,
650 i = j + isamax( n-j, x( j+1 ), 1 )
659 DO 140 j = jfirst, jlast, jinc
666 rec = one / max( xmax, one )
667 IF( cnorm( j ).GT.( bignum-xj )*rec )
THEN
673 tjjs = ab( maind, j )*tscal
678 IF( tjj.GT.one )
THEN
682 rec = min( one, rec*tjj )
685 IF( rec.LT.one )
THEN
686 CALL sscal( n, rec, x, 1 )
693 IF( uscal.EQ.one )
THEN
699 jlen = min( kd, j-1 )
700 sumj = sdot( jlen, ab( kd+1-jlen, j ), 1,
703 jlen = min( kd, n-j )
705 $ sumj = sdot( jlen, ab( 2, j ), 1, x( j+1 ), 1 )
712 jlen = min( kd, j-1 )
714 sumj = sumj + ( ab( kd+i-jlen, j )*uscal )*
718 jlen = min( kd, n-j )
720 sumj = sumj + ( ab( i+1, j )*uscal )*x( j+i )
725 IF( uscal.EQ.tscal )
THEN
730 x( j ) = x( j ) - sumj
736 tjjs = ab( maind, j )*tscal
743 IF( tjj.GT.smlnum )
THEN
747 IF( tjj.LT.one )
THEN
748 IF( xj.GT.tjj*bignum )
THEN
753 CALL sscal( n, rec, x, 1 )
758 x( j ) = x( j ) / tjjs
759 ELSE IF( tjj.GT.zero )
THEN
763 IF( xj.GT.tjj*bignum )
THEN
767 rec = ( tjj*bignum ) / xj
768 CALL sscal( n, rec, x, 1 )
772 x( j ) = x( j ) / tjjs
791 x( j ) = x( j ) / tjjs - sumj
793 xmax = max( xmax, abs( x( j ) ) )
796 scale = scale / tscal
801 IF( tscal.NE.one )
THEN
802 CALL sscal( n, one / tscal, cnorm, 1 )
subroutine xerbla(srname, info)
subroutine saxpy(n, sa, sx, incx, sy, incy)
SAXPY
subroutine slatbs(uplo, trans, diag, normin, n, kd, ab, ldab, x, scale, cnorm, info)
SLATBS solves a triangular banded system of equations.
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine stbsv(uplo, trans, diag, n, k, a, lda, x, incx)
STBSV