229 SUBROUTINE clatps( UPLO, TRANS, DIAG, NORMIN, N, AP, X, SCALE,
237 CHARACTER DIAG, NORMIN, TRANS, UPLO
243 COMPLEX AP( * ), X( * )
249 REAL ZERO, HALF, ONE, TWO
250 parameter( zero = 0.0e+0, half = 0.5e+0, one = 1.0e+0,
254 LOGICAL NOTRAN, NOUNIT, UPPER
255 INTEGER I, IMAX, IP, J, JFIRST, JINC, JLAST, JLEN
256 REAL BIGNUM, GROW, REC, SMLNUM, TJJ, TMAX, TSCAL,
258 COMPLEX CSUMJ, TJJS, USCAL, ZDUM
262 INTEGER ICAMAX, ISAMAX
264 COMPLEX CDOTC, CDOTU, CLADIV
265 EXTERNAL lsame, icamax, isamax, scasum, slamch, cdotc,
272 INTRINSIC abs, aimag, cmplx, conjg, max, min, real
278 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
279 cabs2( zdum ) = abs( real( zdum ) / 2. ) +
280 $ abs( aimag( zdum ) / 2. )
285 upper = lsame( uplo,
'U' )
286 notran = lsame( trans,
'N' )
287 nounit = lsame( diag,
'N' )
291 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
293 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
294 $ lsame( trans,
'C' ) )
THEN
296 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag,
'U' ) )
THEN
298 ELSE IF( .NOT.lsame( normin,
'Y' ) .AND. .NOT.
299 $ lsame( normin,
'N' ) )
THEN
301 ELSE IF( n.LT.0 )
THEN
305 CALL xerbla(
'CLATPS', -info )
316 smlnum = slamch(
'Safe minimum' )
317 bignum = one / smlnum
318 smlnum = smlnum / slamch(
'Precision' )
319 bignum = one / smlnum
322 IF( lsame( normin,
'N' ) )
THEN
332 cnorm( j ) = scasum( j-1, ap( ip ), 1 )
341 cnorm( j ) = scasum( n-j, ap( ip+1 ), 1 )
351 imax = isamax( n, cnorm, 1 )
353 IF( tmax.LE.bignum*half )
THEN
356 tscal = half / ( smlnum*tmax )
357 CALL sscal( n, tscal, cnorm, 1 )
365 xmax = max( xmax, cabs2( x( j ) ) )
382 IF( tscal.NE.one )
THEN
394 grow = half / max( xbnd, smlnum )
396 ip = jfirst*( jfirst+1 ) / 2
398 DO 40 j = jfirst, jlast, jinc
408 IF( tjj.GE.smlnum )
THEN
412 xbnd = min( xbnd, min( one, tjj )*grow )
420 IF( tjj+cnorm( j ).GE.smlnum )
THEN
424 grow = grow*( tjj / ( tjj+cnorm( j ) ) )
441 grow = min( one, half / max( xbnd, smlnum ) )
442 DO 50 j = jfirst, jlast, jinc
451 grow = grow*( one / ( one+cnorm( j ) ) )
470 IF( tscal.NE.one )
THEN
482 grow = half / max( xbnd, smlnum )
484 ip = jfirst*( jfirst+1 ) / 2
486 DO 70 j = jfirst, jlast, jinc
495 xj = one + cnorm( j )
496 grow = min( grow, xbnd / xj )
501 IF( tjj.GE.smlnum )
THEN
506 $ xbnd = xbnd*( tjj / xj )
516 grow = min( grow, xbnd )
523 grow = min( one, half / max( xbnd, smlnum ) )
524 DO 80 j = jfirst, jlast, jinc
533 xj = one + cnorm( j )
540 IF( ( grow*tscal ).GT.smlnum )
THEN
545 CALL ctpsv( uplo, trans, diag, n, ap, x, 1 )
550 IF( xmax.GT.bignum*half )
THEN
555 scale = ( bignum*half ) / xmax
556 CALL csscal( n, scale, x, 1 )
566 ip = jfirst*( jfirst+1 ) / 2
567 DO 110 j = jfirst, jlast, jinc
573 tjjs = ap( ip )*tscal
580 IF( tjj.GT.smlnum )
THEN
584 IF( tjj.LT.one )
THEN
585 IF( xj.GT.tjj*bignum )
THEN
590 CALL csscal( n, rec, x, 1 )
595 x( j ) = cladiv( x( j ), tjjs )
597 ELSE IF( tjj.GT.zero )
THEN
601 IF( xj.GT.tjj*bignum )
THEN
606 rec = ( tjj*bignum ) / xj
607 IF( cnorm( j ).GT.one )
THEN
612 rec = rec / cnorm( j )
614 CALL csscal( n, rec, x, 1 )
618 x( j ) = cladiv( x( j ), tjjs )
640 IF( cnorm( j ).GT.( bignum-xmax )*rec )
THEN
645 CALL csscal( n, rec, x, 1 )
648 ELSE IF( xj*cnorm( j ).GT.( bignum-xmax ) )
THEN
652 CALL csscal( n, half, x, 1 )
662 CALL caxpy( j-1, -x( j )*tscal, ap( ip-j+1 ), 1, x,
664 i = icamax( j-1, x, 1 )
665 xmax = cabs1( x( i ) )
674 CALL caxpy( n-j, -x( j )*tscal, ap( ip+1 ), 1,
676 i = j + icamax( n-j, x( j+1 ), 1 )
677 xmax = cabs1( x( i ) )
683 ELSE IF( lsame( trans,
'T' ) )
THEN
687 ip = jfirst*( jfirst+1 ) / 2
689 DO 150 j = jfirst, jlast, jinc
696 rec = one / max( xmax, one )
697 IF( cnorm( j ).GT.( bignum-xj )*rec )
THEN
703 tjjs = ap( ip )*tscal
708 IF( tjj.GT.one )
THEN
712 rec = min( one, rec*tjj )
713 uscal = cladiv( uscal, tjjs )
715 IF( rec.LT.one )
THEN
716 CALL csscal( n, rec, x, 1 )
723 IF( uscal.EQ.cmplx( one ) )
THEN
729 csumj = cdotu( j-1, ap( ip-j+1 ), 1, x, 1 )
730 ELSE IF( j.LT.n )
THEN
731 csumj = cdotu( n-j, ap( ip+1 ), 1, x( j+1 ), 1 )
739 csumj = csumj + ( ap( ip-j+i )*uscal )*x( i )
741 ELSE IF( j.LT.n )
THEN
743 csumj = csumj + ( ap( ip+i )*uscal )*x( j+i )
748 IF( uscal.EQ.cmplx( tscal ) )
THEN
753 x( j ) = x( j ) - csumj
759 tjjs = ap( ip )*tscal
766 IF( tjj.GT.smlnum )
THEN
770 IF( tjj.LT.one )
THEN
771 IF( xj.GT.tjj*bignum )
THEN
776 CALL csscal( n, rec, x, 1 )
781 x( j ) = cladiv( x( j ), tjjs )
782 ELSE IF( tjj.GT.zero )
THEN
786 IF( xj.GT.tjj*bignum )
THEN
790 rec = ( tjj*bignum ) / xj
791 CALL csscal( n, rec, x, 1 )
795 x( j ) = cladiv( x( j ), tjjs )
814 x( j ) = cladiv( x( j ), tjjs ) - csumj
816 xmax = max( xmax, cabs1( x( j ) ) )
825 ip = jfirst*( jfirst+1 ) / 2
827 DO 190 j = jfirst, jlast, jinc
834 rec = one / max( xmax, one )
835 IF( cnorm( j ).GT.( bignum-xj )*rec )
THEN
841 tjjs = conjg( ap( ip ) )*tscal
846 IF( tjj.GT.one )
THEN
850 rec = min( one, rec*tjj )
851 uscal = cladiv( uscal, tjjs )
853 IF( rec.LT.one )
THEN
854 CALL csscal( n, rec, x, 1 )
861 IF( uscal.EQ.cmplx( one ) )
THEN
867 csumj = cdotc( j-1, ap( ip-j+1 ), 1, x, 1 )
868 ELSE IF( j.LT.n )
THEN
869 csumj = cdotc( n-j, ap( ip+1 ), 1, x( j+1 ), 1 )
877 csumj = csumj + ( conjg( ap( ip-j+i ) )*uscal )*
880 ELSE IF( j.LT.n )
THEN
882 csumj = csumj + ( conjg( ap( ip+i ) )*uscal )*
888 IF( uscal.EQ.cmplx( tscal ) )
THEN
893 x( j ) = x( j ) - csumj
899 tjjs = conjg( ap( ip ) )*tscal
906 IF( tjj.GT.smlnum )
THEN
910 IF( tjj.LT.one )
THEN
911 IF( xj.GT.tjj*bignum )
THEN
916 CALL csscal( n, rec, x, 1 )
921 x( j ) = cladiv( x( j ), tjjs )
922 ELSE IF( tjj.GT.zero )
THEN
926 IF( xj.GT.tjj*bignum )
THEN
930 rec = ( tjj*bignum ) / xj
931 CALL csscal( n, rec, x, 1 )
935 x( j ) = cladiv( x( j ), tjjs )
954 x( j ) = cladiv( x( j ), tjjs ) - csumj
956 xmax = max( xmax, cabs1( x( j ) ) )
961 scale = scale / tscal
966 IF( tscal.NE.one )
THEN
967 CALL sscal( n, one / tscal, cnorm, 1 )
subroutine xerbla(srname, info)
subroutine caxpy(n, ca, cx, incx, cy, incy)
CAXPY
subroutine clatps(uplo, trans, diag, normin, n, ap, x, scale, cnorm, info)
CLATPS solves a triangular system of equations with the matrix held in packed storage.
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine ctpsv(uplo, trans, diag, n, ap, x, incx)
CTPSV