229 SUBROUTINE zlatps( UPLO, TRANS, DIAG, NORMIN, N, AP, X, SCALE,
237 CHARACTER DIAG, NORMIN, TRANS, UPLO
239 DOUBLE PRECISION SCALE
242 DOUBLE PRECISION CNORM( * )
243 COMPLEX*16 AP( * ), X( * )
249 DOUBLE PRECISION ZERO, HALF, ONE, TWO
250 parameter( zero = 0.0d+0, half = 0.5d+0, one = 1.0d+0,
254 LOGICAL NOTRAN, NOUNIT, UPPER
255 INTEGER I, IMAX, IP, J, JFIRST, JINC, JLAST, JLEN
256 DOUBLE PRECISION BIGNUM, GROW, REC, SMLNUM, TJJ, TMAX, TSCAL,
258 COMPLEX*16 CSUMJ, TJJS, USCAL, ZDUM
262 INTEGER IDAMAX, IZAMAX
263 DOUBLE PRECISION DLAMCH, DZASUM
264 COMPLEX*16 ZDOTC, ZDOTU, ZLADIV
265 EXTERNAL lsame, idamax, izamax, dlamch, dzasum, zdotc,
272 INTRINSIC abs, dble, dcmplx, dconjg, dimag, max, min
275 DOUBLE PRECISION CABS1, CABS2
278 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
279 cabs2( zdum ) = abs( dble( zdum ) / 2.d0 ) +
280 $ abs( dimag( zdum ) / 2.d0 )
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(
'ZLATPS', -info )
316 smlnum = dlamch(
'Safe minimum' )
317 bignum = one / smlnum
318 smlnum = smlnum / dlamch(
'Precision' )
319 bignum = one / smlnum
322 IF( lsame( normin,
'N' ) )
THEN
332 cnorm( j ) = dzasum( j-1, ap( ip ), 1 )
341 cnorm( j ) = dzasum( n-j, ap( ip+1 ), 1 )
351 imax = idamax( n, cnorm, 1 )
353 IF( tmax.LE.bignum*half )
THEN
356 tscal = half / ( smlnum*tmax )
357 CALL dscal( 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 ztpsv( uplo, trans, diag, n, ap, x, 1 )
550 IF( xmax.GT.bignum*half )
THEN
555 scale = ( bignum*half ) / xmax
556 CALL zdscal( n, scale, x, 1 )
566 ip = jfirst*( jfirst+1 ) / 2
567 DO 120 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 zdscal( n, rec, x, 1 )
595 x( j ) = zladiv( 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 zdscal( n, rec, x, 1 )
618 x( j ) = zladiv( x( j ), tjjs )
640 IF( cnorm( j ).GT.( bignum-xmax )*rec )
THEN
645 CALL zdscal( n, rec, x, 1 )
648 ELSE IF( xj*cnorm( j ).GT.( bignum-xmax ) )
THEN
652 CALL zdscal( n, half, x, 1 )
662 CALL zaxpy( j-1, -x( j )*tscal, ap( ip-j+1 ), 1, x,
664 i = izamax( j-1, x, 1 )
665 xmax = cabs1( x( i ) )
674 CALL zaxpy( n-j, -x( j )*tscal, ap( ip+1 ), 1,
676 i = j + izamax( 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 170 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 = zladiv( uscal, tjjs )
715 IF( rec.LT.one )
THEN
716 CALL zdscal( n, rec, x, 1 )
723 IF( uscal.EQ.dcmplx( one ) )
THEN
729 csumj = zdotu( j-1, ap( ip-j+1 ), 1, x, 1 )
730 ELSE IF( j.LT.n )
THEN
731 csumj = zdotu( 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.dcmplx( 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 zdscal( n, rec, x, 1 )
781 x( j ) = zladiv( x( j ), tjjs )
782 ELSE IF( tjj.GT.zero )
THEN
786 IF( xj.GT.tjj*bignum )
THEN
790 rec = ( tjj*bignum ) / xj
791 CALL zdscal( n, rec, x, 1 )
795 x( j ) = zladiv( x( j ), tjjs )
814 x( j ) = zladiv( x( j ), tjjs ) - csumj
816 xmax = max( xmax, cabs1( x( j ) ) )
825 ip = jfirst*( jfirst+1 ) / 2
827 DO 220 j = jfirst, jlast, jinc
834 rec = one / max( xmax, one )
835 IF( cnorm( j ).GT.( bignum-xj )*rec )
THEN
841 tjjs = dconjg( ap( ip ) )*tscal
846 IF( tjj.GT.one )
THEN
850 rec = min( one, rec*tjj )
851 uscal = zladiv( uscal, tjjs )
853 IF( rec.LT.one )
THEN
854 CALL zdscal( n, rec, x, 1 )
861 IF( uscal.EQ.dcmplx( one ) )
THEN
867 csumj = zdotc( j-1, ap( ip-j+1 ), 1, x, 1 )
868 ELSE IF( j.LT.n )
THEN
869 csumj = zdotc( n-j, ap( ip+1 ), 1, x( j+1 ), 1 )
877 csumj = csumj + ( dconjg( ap( ip-j+i ) )*uscal )
880 ELSE IF( j.LT.n )
THEN
882 csumj = csumj + ( dconjg( ap( ip+i ) )*uscal )*
888 IF( uscal.EQ.dcmplx( tscal ) )
THEN
893 x( j ) = x( j ) - csumj
899 tjjs = dconjg( ap( ip ) )*tscal
906 IF( tjj.GT.smlnum )
THEN
910 IF( tjj.LT.one )
THEN
911 IF( xj.GT.tjj*bignum )
THEN
916 CALL zdscal( n, rec, x, 1 )
921 x( j ) = zladiv( x( j ), tjjs )
922 ELSE IF( tjj.GT.zero )
THEN
926 IF( xj.GT.tjj*bignum )
THEN
930 rec = ( tjj*bignum ) / xj
931 CALL zdscal( n, rec, x, 1 )
935 x( j ) = zladiv( x( j ), tjjs )
954 x( j ) = zladiv( x( j ), tjjs ) - csumj
956 xmax = max( xmax, cabs1( x( j ) ) )
961 scale = scale / tscal
966 IF( tscal.NE.one )
THEN
967 CALL dscal( n, one / tscal, cnorm, 1 )
subroutine xerbla(srname, info)
subroutine zaxpy(n, za, zx, incx, zy, incy)
ZAXPY
subroutine zlatps(uplo, trans, diag, normin, n, ap, x, scale, cnorm, info)
ZLATPS solves a triangular system of equations with the matrix held in packed storage.
subroutine dscal(n, da, dx, incx)
DSCAL
subroutine zdscal(n, da, zx, incx)
ZDSCAL
subroutine ztpsv(uplo, trans, diag, n, ap, x, incx)
ZTPSV