1 SUBROUTINE zgetf2( M, N, A, LDA, IPIV, INFO )
9 INTEGER INFO, LDA, M, N
13 COMPLEX*16 A( LDA, * )
64 $ zero = ( 0.0d+0, 0.0d+0 ) )
86 ELSE IF( n.LT.0 )
THEN
88 ELSE IF( lda.LT.
max( 1, m ) )
THEN
92 CALL xerbla(
'ZGETF2', -info )
98 IF( m.EQ.0 .OR. n.EQ.0 )
101 DO 10 j = 1,
min( m, n )
105 jp = j - 1 + izamax( m-j+1, a( j, j ), 1 )
107 IF( a( jp, j ).NE.zero )
THEN
112 $
CALL zswap( n, a( j, 1 ), lda, a( jp, 1 ), lda )
117 $
CALL zscal( m-j, one / a( j, j ), a( j+1, j ), 1 )
119 ELSE IF( info.EQ.0 )
THEN
124 IF( j.LT.
min( m, n ) )
THEN
128 CALL zgeru( m-j, n-j, -one, a( j+1, j ), 1, a( j, j+1 ),
129 $ lda, a( j+1, j+1 ), lda )
137 SUBROUTINE zgetrf( M, N, A, LDA, IPIV, INFO )
145 INTEGER INFO, LDA, M, N
149 COMPLEX*16 A( LDA, * )
202 INTEGER I, IINFO, J, JB, NB
221 ELSE IF( n.LT.0 )
THEN
223 ELSE IF( lda.LT.
max( 1, m ) )
THEN
227 CALL xerbla(
'ZGETRF', -info )
233 IF( m.EQ.0 .OR. n.EQ.0 )
238 nb = ilaenv( 1,
'ZGETRF',
' ', m, n, -1, -1 )
239 IF( nb.LE.1 .OR. nb.GE.
min( m, n ) )
THEN
243 CALL zgetf2( m, n, a, lda, ipiv, info )
248 DO 20 j = 1,
min( m, n ), nb
249 jb =
min(
min( m, n )-j+1, nb )
254 CALL zgetf2( m-j+1, jb, a( j, j ), lda, ipiv( j ), iinfo )
258 IF( info.EQ.0 .AND. iinfo.GT.0 )
259 $ info = iinfo + j - 1
260 DO 10 i = j,
min( m, j+jb-1 )
261 ipiv( i ) = j - 1 + ipiv( i )
266 CALL zlaswp( j-1, a, lda, j, j+jb-1, ipiv, 1 )
272 CALL zlaswp( n-j-jb+1, a( 1, j+jb ), lda, j, j+jb-1,
277 CALL ztrsm(
'Left',
'Lower',
'No transpose',
'Unit', jb,
278 $ n-j-jb+1, one, a( j, j ), lda, a( j, j+jb ),
284 CALL zgemm(
'No transpose',
'No transpose', m-j-jb+1,
285 $ n-j-jb+1, jb, -one, a( j+jb, j ), lda,
286 $ a( j, j+jb ), lda, one, a( j+jb, j+jb ),
297 SUBROUTINE zlaswp( N, A, LDA, K1, K2, IPIV, INCX )
305 INTEGER INCX, K1, K2, LDA, N
309 COMPLEX*16 A( LDA, * )
358 INTEGER I, I1, I2, INC, IP, IX, IX0, J, K, N32
370 ELSE IF( incx.LT.0 )
THEN
371 ix0 = 1 + ( 1-k2 )*incx
383 DO 20 i = i1, i2, inc
388 a( i, k ) = a( ip, k )
399 DO 50 i = i1, i2, inc
404 a( i, k ) = a( ip, k )
417 INTEGER FUNCTION ieeeck( ISPEC, ZERO, ONE )
459 REAL nan1, nan2, nan3, nan4, nan5, nan6, neginf,
460 $ negzro, newzro, posinf
466 IF( posinf.LE.one )
THEN
472 IF( neginf.GE.zero )
THEN
477 negzro = one / ( neginf+one )
478 IF( negzro.NE.zero )
THEN
483 neginf = one / negzro
484 IF( neginf.GE.zero )
THEN
489 newzro = negzro + zero
490 IF( newzro.NE.zero )
THEN
495 posinf = one / newzro
496 IF( posinf.LE.one )
THEN
501 neginf = neginf*posinf
502 IF( neginf.GE.zero )
THEN
507 posinf = posinf*posinf
508 IF( posinf.LE.one )
THEN
521 nan1 = posinf + neginf
523 nan2 = posinf / neginf
525 nan3 = posinf / posinf
533 IF( nan1.EQ.nan1 )
THEN
538 IF( nan2.EQ.nan2 )
THEN
543 IF( nan3.EQ.nan3 )
THEN
548 IF( nan4.EQ.nan4 )
THEN
553 IF( nan5.EQ.nan5 )
THEN
558 IF( nan6.EQ.nan6 )
THEN
565 INTEGER FUNCTION ilaenv( ISPEC, NAME, OPTS, N1, N2, N3,
574 CHARACTER*( * ) name, opts
575 INTEGER ispec, n1, n2, n3, n4
674 INTEGER i, ic, iz, nb, nbmin, nx
677 INTRINSIC char, ichar, int,
min,
real
685 GO TO ( 100, 100, 100, 400, 500, 600, 700, 800, 900, 1000,
699 ic = ichar( subnam( 1:1 ) )
701 IF( iz.EQ.90 .OR. iz.EQ.122 )
THEN
705 IF( ic.GE.97 .AND. ic.LE.122 )
THEN
706 subnam( 1:1 ) = char( ic-32 )
708 ic = ichar( subnam( i:i ) )
709 IF( ic.GE.97 .AND. ic.LE.122 )
710 $ subnam( i:i ) = char( ic-32 )
714 ELSE IF( iz.EQ.233 .OR. iz.EQ.169 )
THEN
718 IF( ( ic.GE.129 .AND. ic.LE.137 ) .OR.
719 $ ( ic.GE.145 .AND. ic.LE.153 ) .OR.
720 $ ( ic.GE.162 .AND. ic.LE.169 ) )
THEN
721 subnam( 1:1 ) = char( ic+64 )
723 ic = ichar( subnam( i:i ) )
724 IF( ( ic.GE.129 .AND. ic.LE.137 ) .OR.
725 $ ( ic.GE.145 .AND. ic.LE.153 ) .OR.
726 $ ( ic.GE.162 .AND. ic.LE.169 ) )
727 $ subnam( i:i ) = char( ic+64 )
731 ELSE IF( iz.EQ.218 .OR. iz.EQ.250 )
THEN
735 IF( ic.GE.225 .AND. ic.LE.250 )
THEN
736 subnam( 1:1 ) = char( ic-32 )
738 ic = ichar( subnam( i:i ) )
739 IF( ic.GE.225 .AND. ic.LE.250 )
740 $ subnam( i:i ) = char( ic-32 )
746 sname = c1.EQ.
'S' .OR. c1.EQ.
'D'
747 cname = c1.EQ.
'C' .OR. c1.EQ.
'Z'
748 IF( .NOT.( cname .OR. sname ) )
754 GO TO ( 110, 200, 300 ) ispec
766 IF( c2.EQ.
'GE' )
THEN
767 IF( c3.EQ.
'TRF' )
THEN
773 ELSE IF( c3.EQ.
'QRF' .OR. c3.EQ.
'RQF' .OR. c3.EQ.
'LQF' .OR.
780 ELSE IF( c3.EQ.
'HRD' )
THEN
786 ELSE IF( c3.EQ.
'BRD' )
THEN
792 ELSE IF( c3.EQ.
'TRI' )
THEN
799 ELSE IF( c2.EQ.
'PO' )
THEN
800 IF( c3.EQ.
'TRF' )
THEN
807 ELSE IF( c2.EQ.
'SY' )
THEN
808 IF( c3.EQ.
'TRF' )
THEN
814 ELSE IF( sname .AND. c3.EQ.
'TRD' )
THEN
816 ELSE IF( sname .AND. c3.EQ.
'GST' )
THEN
819 ELSE IF( cname .AND. c2.EQ.
'HE' )
THEN
820 IF( c3.EQ.
'TRF' )
THEN
822 ELSE IF( c3.EQ.
'TRD' )
THEN
824 ELSE IF( c3.EQ.
'GST' )
THEN
827 ELSE IF( sname .AND. c2.EQ.
'OR' )
THEN
828 IF( c3( 1:1 ).EQ.
'G' )
THEN
829 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
830 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
834 ELSE IF( c3( 1:1 ).EQ.
'M' )
THEN
835 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
836 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
841 ELSE IF( cname .AND. c2.EQ.
'UN' )
THEN
842 IF( c3( 1:1 ).EQ.
'G' )
THEN
843 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
844 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
848 ELSE IF( c3( 1:1 ).EQ.
'M' )
THEN
849 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
850 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
855 ELSE IF( c2.EQ.
'GB' )
THEN
856 IF( c3.EQ.
'TRF' )
THEN
871 ELSE IF( c2.EQ.
'PB' )
THEN
872 IF( c3.EQ.
'TRF' )
THEN
887 ELSE IF( c2.EQ.
'TR' )
THEN
888 IF( c3.EQ.
'TRI' )
THEN
895 ELSE IF( c2.EQ.
'LA' )
THEN
896 IF( c3.EQ.
'UUM' )
THEN
903 ELSE IF( sname .AND. c2.EQ.
'ST' )
THEN
904 IF( c3.EQ.
'EBZ' )
THEN
916 IF( c2.EQ.
'GE' )
THEN
917 IF( c3.EQ.
'QRF' .OR. c3.EQ.
'RQF' .OR. c3.EQ.
'LQF' .OR.
924 ELSE IF( c3.EQ.
'HRD' )
THEN
930 ELSE IF( c3.EQ.
'BRD' )
THEN
936 ELSE IF( c3.EQ.
'TRI' )
THEN
943 ELSE IF( c2.EQ.
'SY' )
THEN
944 IF( c3.EQ.
'TRF' )
THEN
950 ELSE IF( sname .AND. c3.EQ.
'TRD' )
THEN
953 ELSE IF( cname .AND. c2.EQ.
'HE' )
THEN
954 IF( c3.EQ.
'TRD' )
THEN
957 ELSE IF( sname .AND. c2.EQ.
'OR' )
THEN
958 IF( c3( 1:1 ).EQ.
'G' )
THEN
959 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
960 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
964 ELSE IF( c3( 1:1 ).EQ.
'M' )
THEN
965 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
966 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
971 ELSE IF( cname .AND. c2.EQ.
'UN' )
THEN
972 IF( c3( 1:1 ).EQ.
'G' )
THEN
973 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
974 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
978 ELSE IF( c3( 1:1 ).EQ.
'M' )
THEN
979 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
980 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
994 IF( c2.EQ.
'GE' )
THEN
995 IF( c3.EQ.
'QRF' .OR. c3.EQ.
'RQF' .OR. c3.EQ.
'LQF' .OR.
1002 ELSE IF( c3.EQ.
'HRD' )
THEN
1008 ELSE IF( c3.EQ.
'BRD' )
THEN
1015 ELSE IF( c2.EQ.
'SY' )
THEN
1016 IF( sname .AND. c3.EQ.
'TRD' )
THEN
1019 ELSE IF( cname .AND. c2.EQ.
'HE' )
THEN
1020 IF( c3.EQ.
'TRD' )
THEN
1023 ELSE IF( sname .AND. c2.EQ.
'OR' )
THEN
1024 IF( c3( 1:1 ).EQ.
'G' )
THEN
1025 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
1026 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
1031 ELSE IF( cname .AND. c2.EQ.
'UN' )
THEN
1032 IF( c3( 1:1 ).EQ.
'G' )
THEN
1033 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
1034 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
1112 SUBROUTINE xerbla( SRNAME, INFO )
1148 WRITE( *, fmt = 9999 )srname, info
1152 9999
FORMAT(
' ** On entry to ', a6,
' parameter number ', i2,
' had ',
1153 $
'an illegal value' )
1159 SUBROUTINE zgetri( N, A, LDA, IPIV, WORK, LWORK, INFO )
1167 INTEGER INFO, LDA, LWORK, N
1171 COMPLEX*16 A( LDA, * ), WORK( * )
1223 COMPLEX*16 ZERO, ONE
1225 $ one = ( 1.0d+0, 0.0d+0 ) )
1229 INTEGER I, IWS, J, JB, JJ, JP, LDWORK, LWKOPT, NB,
1247 nb = ilaenv( 1,
'ZGETRI',
' ', n, -1, -1, -1 )
1250 lquery = ( lwork.EQ.-1 )
1253 ELSE IF( lda.LT.
max( 1, n ) )
THEN
1255 ELSE IF( lwork.LT.
max( 1, n ) .AND. .NOT.lquery )
THEN
1258 IF( info.NE.0 )
THEN
1259 CALL xerbla(
'ZGETRI', -info )
1261 ELSE IF( lquery )
THEN
1273 CALL ztrtri(
'Upper',
'Non-unit', n, a, lda, info )
1279 IF( nb.GT.1 .AND. nb.LT.n )
THEN
1280 iws =
max( ldwork*nb, 1 )
1281 IF( lwork.LT.iws )
THEN
1283 nbmin =
max( 2, ilaenv( 2,
'ZGETRI',
' ', n, -1, -1, -1 ) )
1291 IF( nb.LT.nbmin .OR. nb.GE.n )
THEN
1300 work( i ) = a( i, j )
1307 $
CALL zgemv(
'No transpose', n, n-j, -one, a( 1, j+1 ),
1308 $ lda, work( j+1 ), 1, one, a( 1, j ), 1 )
1314 nn = ( ( n-1 ) / nb )*nb + 1
1315 DO 50 j = nn, 1, -nb
1316 jb =
min( nb, n-j+1 )
1321 DO 40 jj = j, j + jb - 1
1323 work( i+( jj-j )*ldwork ) = a( i, jj )
1331 $
CALL zgemm(
'No transpose',
'No transpose', n, jb,
1332 $ n-j-jb+1, -one, a( 1, j+jb ), lda,
1333 $ work( j+jb ), ldwork, one, a( 1, j ), lda )
1334 CALL ztrsm(
'Right',
'Lower',
'No transpose',
'Unit', n, jb,
1335 $ one, work( j ), ldwork, a( 1, j ), lda )
1341 DO 60 j = n - 1, 1, -1
1344 $
CALL zswap( n, a( 1, j ), 1, a( 1, jp ), 1 )
1353 SUBROUTINE ztrti2( UPLO, DIAG, N, A, LDA, INFO )
1361 CHARACTER DIAG, UPLO
1362 INTEGER INFO, LDA, N
1365 COMPLEX*16 A( LDA, * )
1420 LOGICAL NOUNIT, UPPER
1439 upper = lsame( uplo,
'U' )
1440 nounit = lsame( diag,
'N' )
1441 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
1443 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag,
'U' ) )
THEN
1445 ELSE IF( n.LT.0 )
THEN
1447 ELSE IF( lda.LT.
max( 1, n ) )
THEN
1450 IF( info.NE.0 )
THEN
1451 CALL xerbla(
'ZTRTI2', -info )
1461 a( j, j ) = one / a( j, j )
1469 CALL ztrmv(
'Upper',
'No transpose', diag, j-1, a, lda,
1471 CALL zscal( j-1, ajj, a( 1, j ), 1 )
1479 a( j, j ) = one / a( j, j )
1488 CALL ztrmv(
'Lower',
'No transpose', diag, n-j,
1489 $ a( j+1, j+1 ), lda, a( j+1, j ), 1 )
1490 CALL zscal( n-j, ajj, a( j+1, j ), 1 )
1500 SUBROUTINE ztrtri( UPLO, DIAG, N, A, LDA, INFO )
1508 CHARACTER DIAG, UPLO
1509 INTEGER INFO, LDA, N
1512 COMPLEX*16 A( LDA, * )
1562 COMPLEX*16 ONE, ZERO
1564 $ zero = ( 0.0d+0, 0.0d+0 ) )
1567 LOGICAL NOUNIT, UPPER
1568 INTEGER J, JB, NB, NN
1573 EXTERNAL lsame, ilaenv
1586 upper = lsame( uplo,
'U' )
1587 nounit = lsame( diag,
'N' )
1588 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
1590 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag,
'U' ) )
THEN
1592 ELSE IF( n.LT.0 )
THEN
1594 ELSE IF( lda.LT.
max( 1, n ) )
THEN
1597 IF( info.NE.0 )
THEN
1598 CALL xerbla(
'ZTRTRI', -info )
1611 IF( a( info, info ).EQ.zero )
1619 nb = ilaenv( 1,
'ZTRTRI', uplo // diag, n, -1, -1, -1 )
1620 IF( nb.LE.1 .OR. nb.GE.n )
THEN
1624 CALL ztrti2( uplo, diag, n, a, lda, info )
1634 jb =
min( nb, n-j+1 )
1638 CALL ztrmm(
'Left',
'Upper',
'No transpose', diag, j-1,
1639 $ jb, one, a, lda, a( 1, j ), lda )
1640 CALL ztrsm(
'Right',
'Upper',
'No transpose', diag, j-1,
1641 $ jb, -one, a( j, j ), lda, a( 1, j ), lda )
1645 CALL ztrti2(
'Upper', diag, jb, a( j, j ), lda, info )
1651 nn = ( ( n-1 ) / nb )*nb + 1
1652 DO 30 j = nn, 1, -nb
1653 jb =
min( nb, n-j+1 )
1654 IF( j+jb.LE.n )
THEN
1658 CALL ztrmm(
'Left',
'Lower',
'No transpose', diag,
1659 $ n-j-jb+1, jb, one, a( j+jb, j+jb ), lda,
1660 $ a( j+jb, j ), lda )
1661 CALL ztrsm(
'Right',
'Lower',
'No transpose', diag,
1662 $ n-j-jb+1, jb, -one, a( j, j ), lda,
1663 $ a( j+jb, j ), lda )
1668 CALL ztrti2(
'Lower', diag, jb, a( j, j ), lda, info )
1679 LOGICAL FUNCTION lsame( CA, CB )
1709 INTEGER inta, intb, zcode
1721 zcode = ichar(
'Z' )
1731 IF( zcode.EQ.90 .OR. zcode.EQ.122 )
THEN
1736 IF( inta.GE.97 .AND. inta.LE.122 ) inta = inta - 32
1737 IF( intb.GE.97 .AND. intb.LE.122 ) intb = intb - 32
1739 ELSE IF( zcode.EQ.233 .OR. zcode.EQ.169 )
THEN
1744 IF( inta.GE.129 .AND. inta.LE.137 .OR.
1745 $ inta.GE.145 .AND. inta.LE.153 .OR.
1746 $ inta.GE.162 .AND. inta.LE.169 ) inta = inta + 64
1747 IF( intb.GE.129 .AND. intb.LE.137 .OR.
1748 $ intb.GE.145 .AND. intb.LE.153 .OR.
1749 $ intb.GE.162 .AND. intb.LE.169 ) intb = intb + 64
1751 ELSE IF( zcode.EQ.218 .OR. zcode.EQ.250 )
THEN
1756 IF( inta.GE.225 .AND. inta.LE.250 ) inta = inta - 32
1757 IF( intb.GE.225 .AND. intb.LE.250 ) intb = intb - 32
1759 lsame = inta.EQ.intb
1772 integer function izamax(n,zx,incx)
1779 double complex zx(*)
1780 double precision smax
1785 if( n.lt.1 .or. incx.le.0 )
return
1788 if(incx.eq.1)
go to 20
1796 if(
dcabs1(zx(ix)).le.smax)
go to 5
1807 if(
dcabs1(zx(i)).le.smax)
go to 30
1814 double precision function dcabs1(z)
1816 double precision t(2)
1817 equivalence(zz,t(1))
1819 dcabs1 = dabs(t(1)) + dabs(t(2))
1823 subroutine zswap (n,zx,incx,zy,incy)
1829 double complex zx(*),zy(*),ztemp
1830 integer i,incx,incy,ix,iy,n
1833 if(incx.eq.1.and.incy.eq.1)
go to 20
1840 if(incx.lt.0)ix = (-n+1)*incx + 1
1841 if(incy.lt.0)iy = (-n+1)*incy + 1
1860 subroutine zscal(n,za,zx,incx)
1867 double complex za,zx(*)
1870 if( n.le.0 .or. incx.le.0 )
return
1871 if(incx.eq.1)
go to 20
1890 SUBROUTINE zgeru ( M, N, ALPHA, X, INCX, Y, INCY, A, LDA )
1893 INTEGER INCX, INCY, LDA, M, N
1895 COMPLEX*16 A( LDA, * ), X( * ), Y( * )
1973 INTEGER I, INFO, IX, J, JY, KX
1986 ELSE IF( n.LT.0 )
THEN
1988 ELSE IF( incx.EQ.0 )
THEN
1990 ELSE IF( incy.EQ.0 )
THEN
1992 ELSE IF( lda.LT.
max( 1, m ) )
THEN
1996 CALL xerbla(
'ZGERU ', info )
2002 IF( ( m.EQ.0 ).OR.( n.EQ.0 ).OR.( alpha.EQ.zero ) )
2011 jy = 1 - ( n - 1 )*incy
2015 IF( y( jy ).NE.zero )
THEN
2016 temp = alpha*y( jy )
2018 a( i, j ) = a( i, j ) + x( i )*temp
2027 kx = 1 - ( m - 1 )*incx
2030 IF( y( jy ).NE.zero )
THEN
2031 temp = alpha*y( jy )
2034 a( i, j ) = a( i, j ) + x( ix )*temp
2048 SUBROUTINE ztrsm ( SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA,
2051 CHARACTER*1 SIDE, UPLO, TRANSA, DIAG
2052 INTEGER M, N, LDA, LDB
2055 COMPLEX*16 A( LDA, * ), B( LDB, * )
2182 INTRINSIC dconjg,
max
2184 LOGICAL LSIDE, NOCONJ, NOUNIT, UPPER
2185 INTEGER I, INFO, J, K, NROWA
2189 PARAMETER ( ONE = ( 1.0d+0, 0.0d+0 ) )
2197 lside = lsame( side ,
'L' )
2203 noconj = lsame( transa,
'T' )
2204 nounit = lsame( diag ,
'N' )
2205 upper = lsame( uplo ,
'U' )
2208 IF( ( .NOT.lside ).AND.
2209 $ ( .NOT.lsame( side ,
'R' ) ) )
THEN
2211 ELSE IF( ( .NOT.upper ).AND.
2212 $ ( .NOT.lsame( uplo ,
'L' ) ) )
THEN
2214 ELSE IF( ( .NOT.lsame( transa,
'N' ) ).AND.
2215 $ ( .NOT.lsame( transa,
'T' ) ).AND.
2216 $ ( .NOT.lsame( transa,
'C' ) ) )
THEN
2218 ELSE IF( ( .NOT.lsame( diag ,
'U' ) ).AND.
2219 $ ( .NOT.lsame( diag ,
'N' ) ) )
THEN
2221 ELSE IF( m .LT.0 )
THEN
2223 ELSE IF( n .LT.0 )
THEN
2225 ELSE IF( lda.LT.
max( 1, nrowa ) )
THEN
2227 ELSE IF( ldb.LT.
max( 1, m ) )
THEN
2231 CALL xerbla(
'ZTRSM ', info )
2242 IF( alpha.EQ.zero )
THEN
2254 IF( lsame( transa,
'N' ) )
THEN
2260 IF( alpha.NE.one )
THEN
2262 b( i, j ) = alpha*b( i, j )
2266 IF( b( k, j ).NE.zero )
THEN
2268 $ b( k, j ) = b( k, j )/a( k, k )
2270 b( i, j ) = b( i, j ) - b( k, j )*a( i, k )
2277 IF( alpha.NE.one )
THEN
2279 b( i, j ) = alpha*b( i, j )
2283 IF( b( k, j ).NE.zero )
THEN
2285 $ b( k, j ) = b( k, j )/a( k, k )
2287 b( i, j ) = b( i, j ) - b( k, j )*a( i, k )
2301 temp = alpha*b( i, j )
2303 DO 110, k = 1, i - 1
2304 temp = temp - a( k, i )*b( k, j )
2307 $ temp = temp/a( i, i )
2309 DO 120, k = 1, i - 1
2310 temp = temp - dconjg( a( k, i ) )*b( k, j )
2313 $ temp = temp/dconjg( a( i, i ) )
2320 DO 170, i = m, 1, -1
2321 temp = alpha*b( i, j )
2323 DO 150, k = i + 1, m
2324 temp = temp - a( k, i )*b( k, j )
2327 $ temp = temp/a( i, i )
2329 DO 160, k = i + 1, m
2330 temp = temp - dconjg( a( k, i ) )*b( k, j )
2333 $ temp = temp/dconjg( a( i, i ) )
2341 IF( lsame( transa,
'N' ) )
THEN
2347 IF( alpha.NE.one )
THEN
2349 b( i, j ) = alpha*b( i, j )
2352 DO 210, k = 1, j - 1
2353 IF( a( k, j ).NE.zero )
THEN
2355 b( i, j ) = b( i, j ) - a( k, j )*b( i, k )
2360 temp = one/a( j, j )
2362 b( i, j ) = temp*b( i, j )
2367 DO 280, j = n, 1, -1
2368 IF( alpha.NE.one )
THEN
2370 b( i, j ) = alpha*b( i, j )
2373 DO 260, k = j + 1, n
2374 IF( a( k, j ).NE.zero )
THEN
2376 b( i, j ) = b( i, j ) - a( k, j )*b( i, k )
2381 temp = one/a( j, j )
2383 b( i, j ) = temp*b( i, j )
2394 DO 330, k = n, 1, -1
2397 temp = one/a( k, k )
2399 temp = one/dconjg( a( k, k ) )
2402 b( i, k ) = temp*b( i, k )
2405 DO 310, j = 1, k - 1
2406 IF( a( j, k ).NE.zero )
THEN
2410 temp = dconjg( a( j, k ) )
2413 b( i, j ) = b( i, j ) - temp*b( i, k )
2417 IF( alpha.NE.one )
THEN
2419 b( i, k ) = alpha*b( i, k )
2427 temp = one/a( k, k )
2429 temp = one/dconjg( a( k, k ) )
2432 b( i, k ) = temp*b( i, k )
2435 DO 360, j = k + 1, n
2436 IF( a( j, k ).NE.zero )
THEN
2440 temp = dconjg( a( j, k ) )
2443 b( i, j ) = b( i, j ) - temp*b( i, k )
2447 IF( alpha.NE.one )
THEN
2449 b( i, k ) = alpha*b( i, k )
2463 SUBROUTINE zgemm ( TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB,
2466 CHARACTER*1 TRANSA, TRANSB
2467 INTEGER M, N, K, LDA, LDB, LDC
2468 COMPLEX*16 ALPHA, BETA
2470 COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * )
2599 INTRINSIC dconjg,
max
2601 LOGICAL CONJA, CONJB, NOTA, NOTB
2602 INTEGER I, INFO, J, L, NCOLA, NROWA, NROWB
2618 nota = lsame( transa,
'N' )
2619 notb = lsame( transb,
'N' )
2620 conja = lsame( transa,
'C' )
2621 conjb = lsame( transb,
'C' )
2638 IF( ( .NOT.nota ).AND.
2639 $ ( .NOT.conja ).AND.
2640 $ ( .NOT.lsame( transa,
'T' ) ) )
THEN
2642 ELSE IF( ( .NOT.notb ).AND.
2643 $ ( .NOT.conjb ).AND.
2644 $ ( .NOT.lsame( transb,
'T' ) ) )
THEN
2646 ELSE IF( m .LT.0 )
THEN
2648 ELSE IF( n .LT.0 )
THEN
2650 ELSE IF( k .LT.0 )
THEN
2652 ELSE IF( lda.LT.
max( 1, nrowa ) )
THEN
2654 ELSE IF( ldb.LT.
max( 1, nrowb ) )
THEN
2656 ELSE IF( ldc.LT.
max( 1, m ) )
THEN
2660 CALL xerbla(
'ZGEMM ', info )
2666 IF( ( m.EQ.0 ).OR.( n.EQ.0 ).OR.
2667 $ ( ( ( alpha.EQ.zero ).OR.( k.EQ.0 ) ).AND.( beta.EQ.one ) ) )
2672 IF( alpha.EQ.zero )
THEN
2673 IF( beta.EQ.zero )
THEN
2682 c( i, j ) = beta*c( i, j )
2697 IF( beta.EQ.zero )
THEN
2701 ELSE IF( beta.NE.one )
THEN
2703 c( i, j ) = beta*c( i, j )
2707 IF( b( l, j ).NE.zero )
THEN
2708 temp = alpha*b( l, j )
2710 c( i, j ) = c( i, j ) + temp*a( i, l )
2715 ELSE IF( conja )
THEN
2723 temp = temp + dconjg( a( l, i ) )*b( l, j )
2725 IF( beta.EQ.zero )
THEN
2726 c( i, j ) = alpha*temp
2728 c( i, j ) = alpha*temp + beta*c( i, j )
2740 temp = temp + a( l, i )*b( l, j )
2742 IF( beta.EQ.zero )
THEN
2743 c( i, j ) = alpha*temp
2745 c( i, j ) = alpha*temp + beta*c( i, j )
2756 IF( beta.EQ.zero )
THEN
2760 ELSE IF( beta.NE.one )
THEN
2762 c( i, j ) = beta*c( i, j )
2766 IF( b( j, l ).NE.zero )
THEN
2767 temp = alpha*dconjg( b( j, l ) )
2769 c( i, j ) = c( i, j ) + temp*a( i, l )
2779 IF( beta.EQ.zero )
THEN
2783 ELSE IF( beta.NE.one )
THEN
2785 c( i, j ) = beta*c( i, j )
2789 IF( b( j, l ).NE.zero )
THEN
2790 temp = alpha*b( j, l )
2792 c( i, j ) = c( i, j ) + temp*a( i, l )
2798 ELSE IF( conja )
THEN
2808 $ dconjg( a( l, i ) )*dconjg( b( j, l ) )
2810 IF( beta.EQ.zero )
THEN
2811 c( i, j ) = alpha*temp
2813 c( i, j ) = alpha*temp + beta*c( i, j )
2825 temp = temp + dconjg( a( l, i ) )*b( j, l )
2827 IF( beta.EQ.zero )
THEN
2828 c( i, j ) = alpha*temp
2830 c( i, j ) = alpha*temp + beta*c( i, j )
2844 temp = temp + a( l, i )*dconjg( b( j, l ) )
2846 IF( beta.EQ.zero )
THEN
2847 c( i, j ) = alpha*temp
2849 c( i, j ) = alpha*temp + beta*c( i, j )
2861 temp = temp + a( l, i )*b( j, l )
2863 IF( beta.EQ.zero )
THEN
2864 c( i, j ) = alpha*temp
2866 c( i, j ) = alpha*temp + beta*c( i, j )
2879 SUBROUTINE ztrmv ( UPLO, TRANS, DIAG, N, A, LDA, X, INCX )
2881 INTEGER INCX, LDA, N
2882 CHARACTER*1 DIAG, TRANS, UPLO
2884 COMPLEX*16 A( LDA, * ), X( * )
2980 PARAMETER ( ZERO = ( 0.0d+0, 0.0d+0 ) )
2983 INTEGER I, INFO, IX, J, JX, KX
2984 LOGICAL NOCONJ, NOUNIT
2991 INTRINSIC dconjg,
max
2998 IF ( .NOT.lsame( uplo ,
'U' ).AND.
2999 $ .NOT.lsame( uplo ,
'L' ) )
THEN
3001 ELSE IF( .NOT.lsame( trans,
'N' ).AND.
3002 $ .NOT.lsame( trans,
'T' ).AND.
3003 $ .NOT.lsame( trans,
'C' ) )
THEN
3005 ELSE IF( .NOT.lsame( diag ,
'U' ).AND.
3006 $ .NOT.lsame( diag ,
'N' ) )
THEN
3008 ELSE IF( n.LT.0 )
THEN
3010 ELSE IF( lda.LT.
max( 1, n ) )
THEN
3012 ELSE IF( incx.EQ.0 )
THEN
3016 CALL xerbla(
'ZTRMV ', info )
3025 noconj = lsame( trans,
'T' )
3026 nounit = lsame( diag ,
'N' )
3032 kx = 1 - ( n - 1 )*incx
3033 ELSE IF( incx.NE.1 )
THEN
3040 IF( lsame( trans,
'N' ) )
THEN
3044 IF( lsame( uplo,
'U' ) )
THEN
3047 IF( x( j ).NE.zero )
THEN
3050 x( i ) = x( i ) + temp*a( i, j )
3053 $ x( j ) = x( j )*a( j, j )
3059 IF( x( jx ).NE.zero )
THEN
3063 x( ix ) = x( ix ) + temp*a( i, j )
3067 $ x( jx ) = x( jx )*a( j, j )
3075 IF( x( j ).NE.zero )
THEN
3077 DO 50, i = n, j + 1, -1
3078 x( i ) = x( i ) + temp*a( i, j )
3081 $ x( j ) = x( j )*a( j, j )
3085 kx = kx + ( n - 1 )*incx
3088 IF( x( jx ).NE.zero )
THEN
3091 DO 70, i = n, j + 1, -1
3092 x( ix ) = x( ix ) + temp*a( i, j )
3096 $ x( jx ) = x( jx )*a( j, j )
3106 IF( lsame( uplo,
'U' ) )
THEN
3108 DO 110, j = n, 1, -1
3112 $ temp = temp*a( j, j )
3113 DO 90, i = j - 1, 1, -1
3114 temp = temp + a( i, j )*x( i )
3118 $ temp = temp*dconjg( a( j, j ) )
3119 DO 100, i = j - 1, 1, -1
3120 temp = temp + dconjg( a( i, j ) )*x( i )
3126 jx = kx + ( n - 1 )*incx
3127 DO 140, j = n, 1, -1
3132 $ temp = temp*a( j, j )
3133 DO 120, i = j - 1, 1, -1
3135 temp = temp + a( i, j )*x( ix )
3139 $ temp = temp*dconjg( a( j, j ) )
3140 DO 130, i = j - 1, 1, -1
3142 temp = temp + dconjg( a( i, j ) )*x( ix )
3155 $ temp = temp*a( j, j )
3156 DO 150, i = j + 1, n
3157 temp = temp + a( i, j )*x( i )
3161 $ temp = temp*dconjg( a( j, j ) )
3162 DO 160, i = j + 1, n
3163 temp = temp + dconjg( a( i, j ) )*x( i )
3175 $ temp = temp*a( j, j )
3176 DO 180, i = j + 1, n
3178 temp = temp + a( i, j )*x( ix )
3182 $ temp = temp*dconjg( a( j, j ) )
3183 DO 190, i = j + 1, n
3185 temp = temp + dconjg( a( i, j ) )*x( ix )
3201 SUBROUTINE ztrmm ( SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA,
3204 CHARACTER*1 SIDE, UPLO, TRANSA, DIAG
3205 INTEGER M, N, LDA, LDB
3208 COMPLEX*16 A( LDA, * ), B( LDB, * )
3333 INTRINSIC dconjg,
max
3335 LOGICAL LSIDE, NOCONJ, NOUNIT, UPPER
3336 INTEGER I, INFO, J, K, NROWA
3342 PARAMETER ( ZERO = ( 0.0d+0, 0.0d+0 ) )
3348 lside = lsame( side ,
'L' )
3354 noconj = lsame( transa,
'T' )
3355 nounit = lsame( diag ,
'N' )
3356 upper = lsame( uplo ,
'U' )
3359 IF( ( .NOT.lside ).AND.
3360 $ ( .NOT.lsame( side ,
'R' ) ) )
THEN
3362 ELSE IF( ( .NOT.upper ).AND.
3363 $ ( .NOT.lsame( uplo ,
'L' ) ) )
THEN
3365 ELSE IF( ( .NOT.lsame( transa,
'N' ) ).AND.
3366 $ ( .NOT.lsame( transa,
'T' ) ).AND.
3367 $ ( .NOT.lsame( transa,
'C' ) ) )
THEN
3369 ELSE IF( ( .NOT.lsame( diag ,
'U' ) ).AND.
3370 $ ( .NOT.lsame( diag ,
'N' ) ) )
THEN
3372 ELSE IF( m .LT.0 )
THEN
3374 ELSE IF( n .LT.0 )
THEN
3376 ELSE IF( lda.LT.
max( 1, nrowa ) )
THEN
3378 ELSE IF( ldb.LT.
max( 1, m ) )
THEN
3382 CALL xerbla(
'ZTRMM ', info )
3393 IF( alpha.EQ.zero )
THEN
3405 IF( lsame( transa,
'N' ) )
THEN
3412 IF( b( k, j ).NE.zero )
THEN
3413 temp = alpha*b( k, j )
3415 b( i, j ) = b( i, j ) + temp*a( i, k )
3418 $ temp = temp*a( k, k )
3426 IF( b( k, j ).NE.zero )
THEN
3427 temp = alpha*b( k, j )
3430 $ b( k, j ) = b( k, j )*a( k, k )
3432 b( i, j ) = b( i, j ) + temp*a( i, k )
3444 DO 110, i = m, 1, -1
3448 $ temp = temp*a( i, i )
3450 temp = temp + a( k, i )*b( k, j )
3454 $ temp = temp*dconjg( a( i, i ) )
3455 DO 100, k = 1, i - 1
3456 temp = temp + dconjg( a( k, i ) )*b( k, j )
3459 b( i, j ) = alpha*temp
3468 $ temp = temp*a( i, i )
3469 DO 130, k = i + 1, m
3470 temp = temp + a( k, i )*b( k, j )
3474 $ temp = temp*dconjg( a( i, i ) )
3475 DO 140, k = i + 1, m
3476 temp = temp + dconjg( a( k, i ) )*b( k, j )
3479 b( i, j ) = alpha*temp
3485 IF( lsame( transa,
'N' ) )
THEN
3490 DO 200, j = n, 1, -1
3493 $ temp = temp*a( j, j )
3495 b( i, j ) = temp*b( i, j )
3497 DO 190, k = 1, j - 1
3498 IF( a( k, j ).NE.zero )
THEN
3499 temp = alpha*a( k, j )
3501 b( i, j ) = b( i, j ) + temp*b( i, k )
3510 $ temp = temp*a( j, j )
3512 b( i, j ) = temp*b( i, j )
3514 DO 230, k = j + 1, n
3515 IF( a( k, j ).NE.zero )
THEN
3516 temp = alpha*a( k, j )
3518 b( i, j ) = b( i, j ) + temp*b( i, k )
3530 DO 260, j = 1, k - 1
3531 IF( a( j, k ).NE.zero )
THEN
3533 temp = alpha*a( j, k )
3535 temp = alpha*dconjg( a( j, k ) )
3538 b( i, j ) = b( i, j ) + temp*b( i, k )
3545 temp = temp*a( k, k )
3547 temp = temp*dconjg( a( k, k ) )
3550 IF( temp.NE.one )
THEN
3552 b( i, k ) = temp*b( i, k )
3557 DO 320, k = n, 1, -1
3558 DO 300, j = k + 1, n
3559 IF( a( j, k ).NE.zero )
THEN
3561 temp = alpha*a( j, k )
3563 temp = alpha*dconjg( a( j, k ) )
3566 b( i, j ) = b( i, j ) + temp*b( i, k )
3573 temp = temp*a( k, k )
3575 temp = temp*dconjg( a( k, k ) )
3578 IF( temp.NE.one )
THEN
3580 b( i, k ) = temp*b( i, k )
3594 SUBROUTINE zgemv ( TRANS, M, N, ALPHA, A, LDA, X, INCX,
3597 COMPLEX*16 ALPHA, BETA
3598 INTEGER INCX, INCY, LDA, M, N
3601 COMPLEX*16 A( LDA, * ), X( * ), Y( * )
3699 PARAMETER ( ONE = ( 1.0d+0, 0.0d+0 ) )
3701 PARAMETER ( ZERO = ( 0.0d+0, 0.0d+0 ) )
3704 INTEGER I, INFO, IX, IY, J, JX, JY, KX, KY, LENX, LENY
3712 INTRINSIC dconjg,
max
3719 IF ( .NOT.lsame( trans,
'N' ).AND.
3720 $ .NOT.lsame( trans,
'T' ).AND.
3721 $ .NOT.lsame( trans,
'C' ) )
THEN
3723 ELSE IF( m.LT.0 )
THEN
3725 ELSE IF( n.LT.0 )
THEN
3727 ELSE IF( lda.LT.
max( 1, m ) )
THEN
3729 ELSE IF( incx.EQ.0 )
THEN
3731 ELSE IF( incy.EQ.0 )
THEN
3735 CALL xerbla(
'ZGEMV ', info )
3741 IF( ( m.EQ.0 ).OR.( n.EQ.0 ).OR.
3742 $ ( ( alpha.EQ.zero ).AND.( beta.EQ.one ) ) )
3745 noconj = lsame( trans,
'T' )
3750 IF( lsame( trans,
'N' ) )
THEN
3760 kx = 1 - ( lenx - 1 )*incx
3765 ky = 1 - ( leny - 1 )*incy
3773 IF( beta.NE.one )
THEN
3775 IF( beta.EQ.zero )
THEN
3781 y( i ) = beta*y( i )
3786 IF( beta.EQ.zero )
THEN
3793 y( iy ) = beta*y( iy )
3801 IF( lsame( trans,
'N' ) )
THEN
3808 IF( x( jx ).NE.zero )
THEN
3809 temp = alpha*x( jx )
3811 y( i ) = y( i ) + temp*a( i, j )
3818 IF( x( jx ).NE.zero )
THEN
3819 temp = alpha*x( jx )
3822 y( iy ) = y( iy ) + temp*a( i, j )
3839 temp = temp + a( i, j )*x( i )
3843 temp = temp + dconjg( a( i, j ) )*x( i )
3846 y( jy ) = y( jy ) + alpha*temp
3855 temp = temp + a( i, j )*x( ix )
3860 temp = temp + dconjg( a( i, j ) )*x( ix )
3864 y( jy ) = y( jy ) + alpha*temp