227 SUBROUTINE slatps( UPLO, TRANS, DIAG, NORMIN, N, AP, X, SCALE,
235 CHARACTER DIAG, NORMIN, TRANS, UPLO
240 REAL AP( * ), CNORM( * ), X( * )
247 parameter( zero = 0.0e+0, half = 0.5e+0, one = 1.0e+0 )
250 LOGICAL NOTRAN, NOUNIT, UPPER
251 INTEGER I, IMAX, IP, J, JFIRST, JINC, JLAST, JLEN
252 REAL BIGNUM, GROW, REC, SMLNUM, SUMJ, TJJ, TJJS,
253 $ tmax, tscal, uscal, xbnd, xj, xmax
258 REAL SASUM, SDOT, SLAMCH
259 EXTERNAL lsame, isamax, sasum, sdot, slamch
265 INTRINSIC abs, max, min
270 upper = lsame( uplo,
'U' )
271 notran = lsame( trans,
'N' )
272 nounit = lsame( diag,
'N' )
276 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
278 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
279 $ lsame( trans,
'C' ) )
THEN
281 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag,
'U' ) )
THEN
283 ELSE IF( .NOT.lsame( normin,
'Y' ) .AND. .NOT.
284 $ lsame( normin,
'N' ) )
THEN
286 ELSE IF( n.LT.0 )
THEN
290 CALL xerbla(
'SLATPS', -info )
301 smlnum = slamch(
'Safe minimum' ) / slamch(
'Precision' )
302 bignum = one / smlnum
305 IF( lsame( normin,
'N' ) )
THEN
315 cnorm( j ) = sasum( j-1, ap( ip ), 1 )
324 cnorm( j ) = sasum( n-j, ap( ip+1 ), 1 )
334 imax = isamax( n, cnorm, 1 )
336 IF( tmax.LE.bignum )
THEN
339 tscal = one / ( smlnum*tmax )
340 CALL sscal( n, tscal, cnorm, 1 )
346 j = isamax( n, x, 1 )
363 IF( tscal.NE.one )
THEN
375 grow = one / max( xbnd, smlnum )
377 ip = jfirst*( jfirst+1 ) / 2
379 DO 30 j = jfirst, jlast, jinc
388 tjj = abs( ap( ip ) )
389 xbnd = min( xbnd, min( one, tjj )*grow )
390 IF( tjj+cnorm( j ).GE.smlnum )
THEN
394 grow = grow*( tjj / ( tjj+cnorm( j ) ) )
411 grow = min( one, one / max( xbnd, smlnum ) )
412 DO 40 j = jfirst, jlast, jinc
421 grow = grow*( one / ( one+cnorm( j ) ) )
440 IF( tscal.NE.one )
THEN
452 grow = one / max( xbnd, smlnum )
454 ip = jfirst*( jfirst+1 ) / 2
456 DO 60 j = jfirst, jlast, jinc
465 xj = one + cnorm( j )
466 grow = min( grow, xbnd / xj )
470 tjj = abs( ap( ip ) )
472 $ xbnd = xbnd*( tjj / xj )
476 grow = min( grow, xbnd )
483 grow = min( one, one / max( xbnd, smlnum ) )
484 DO 70 j = jfirst, jlast, jinc
493 xj = one + cnorm( j )
500 IF( ( grow*tscal ).GT.smlnum )
THEN
505 CALL stpsv( uplo, trans, diag, n, ap, x, 1 )
510 IF( xmax.GT.bignum )
THEN
515 scale = bignum / xmax
516 CALL sscal( n, scale, x, 1 )
524 ip = jfirst*( jfirst+1 ) / 2
525 DO 100 j = jfirst, jlast, jinc
531 tjjs = ap( ip )*tscal
538 IF( tjj.GT.smlnum )
THEN
542 IF( tjj.LT.one )
THEN
543 IF( xj.GT.tjj*bignum )
THEN
548 CALL sscal( n, rec, x, 1 )
553 x( j ) = x( j ) / tjjs
555 ELSE IF( tjj.GT.zero )
THEN
559 IF( xj.GT.tjj*bignum )
THEN
564 rec = ( tjj*bignum ) / xj
565 IF( cnorm( j ).GT.one )
THEN
570 rec = rec / cnorm( j )
572 CALL sscal( n, rec, x, 1 )
576 x( j ) = x( j ) / tjjs
598 IF( cnorm( j ).GT.( bignum-xmax )*rec )
THEN
603 CALL sscal( n, rec, x, 1 )
606 ELSE IF( xj*cnorm( j ).GT.( bignum-xmax ) )
THEN
610 CALL sscal( n, half, x, 1 )
620 CALL saxpy( j-1, -x( j )*tscal, ap( ip-j+1 ), 1, x,
622 i = isamax( j-1, x, 1 )
632 CALL saxpy( n-j, -x( j )*tscal, ap( ip+1 ), 1,
634 i = j + isamax( n-j, x( j+1 ), 1 )
645 ip = jfirst*( jfirst+1 ) / 2
647 DO 140 j = jfirst, jlast, jinc
654 rec = one / max( xmax, one )
655 IF( cnorm( j ).GT.( bignum-xj )*rec )
THEN
661 tjjs = ap( ip )*tscal
666 IF( tjj.GT.one )
THEN
670 rec = min( one, rec*tjj )
673 IF( rec.LT.one )
THEN
674 CALL sscal( n, rec, x, 1 )
681 IF( uscal.EQ.one )
THEN
687 sumj = sdot( j-1, ap( ip-j+1 ), 1, x, 1 )
688 ELSE IF( j.LT.n )
THEN
689 sumj = sdot( n-j, ap( ip+1 ), 1, x( j+1 ), 1 )
697 sumj = sumj + ( ap( ip-j+i )*uscal )*x( i )
699 ELSE IF( j.LT.n )
THEN
701 sumj = sumj + ( ap( ip+i )*uscal )*x( j+i )
706 IF( uscal.EQ.tscal )
THEN
711 x( j ) = x( j ) - sumj
717 tjjs = ap( ip )*tscal
724 IF( tjj.GT.smlnum )
THEN
728 IF( tjj.LT.one )
THEN
729 IF( xj.GT.tjj*bignum )
THEN
734 CALL sscal( n, rec, x, 1 )
739 x( j ) = x( j ) / tjjs
740 ELSE IF( tjj.GT.zero )
THEN
744 IF( xj.GT.tjj*bignum )
THEN
748 rec = ( tjj*bignum ) / xj
749 CALL sscal( n, rec, x, 1 )
753 x( j ) = x( j ) / tjjs
772 x( j ) = x( j ) / tjjs - sumj
774 xmax = max( xmax, abs( x( j ) ) )
779 scale = scale / tscal
784 IF( tscal.NE.one )
THEN
785 CALL sscal( n, one / tscal, cnorm, 1 )
subroutine xerbla(srname, info)
subroutine saxpy(n, sa, sx, incx, sy, incy)
SAXPY
subroutine slatps(uplo, trans, diag, normin, n, ap, x, scale, cnorm, info)
SLATPS solves a triangular system of equations with the matrix held in packed storage.
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine stpsv(uplo, trans, diag, n, ap, x, incx)
STPSV