1 SUBROUTINE zgetf2( M, N, A, LDA, IPIV, INFO )
2 INTEGER INFO, LDA, M, N
7 $ zero = ( 0.0q+0, 0.0q+0 ) )
16 ELSE IF( n.LT.0 )
THEN
18 ELSE IF( lda.LT.
max( 1, m ) )
THEN
22 CALL xerbla(
'ZGETF2', -info )
25 IF( m.EQ.0 .OR. n.EQ.0 )
27 DO 10 j = 1,
min( m, n )
28 jp = j - 1 + izamax( m-j+1, a( j, j ), 1 )
30 IF( a( jp, j ).NE.zero )
THEN
32 $
CALL zswap( n, a( j, 1 ), lda, a( jp, 1 ), lda )
34 $
CALL zscal( m-j, one / a( j, j ), a( j+1, j ), 1 )
35 ELSE IF( info.EQ.0 )
THEN
38 IF( j.LT.
min( m, n ) )
THEN
39 CALL zgeru( m-j, n-j, -one, a( j+1, j ), 1, a( j, j+1 ),
40 $ lda, a( j+1, j+1 ), lda )
46 SUBROUTINE zgetrf( M, N, A, LDA, IPIV, INFO )
47 INTEGER INFO, LDA, M, N
49 COMPLEX*32 A( LDA, * )
52 INTEGER I, IINFO, J, JB, NB
60 ELSE IF( n.LT.0 )
THEN
62 ELSE IF( lda.LT.
max( 1, m ) )
THEN
66 CALL xerbla(
'ZGETRF', -info )
69 IF( m.EQ.0 .OR. n.EQ.0 )
71 nb = ilaenv( 1,
'ZGETRF',
' ', m, n, -1, -1 )
72 IF( nb.LE.1 .OR. nb.GE.
min( m, n ) )
THEN
73 CALL zgetf2( m, n, a, lda, ipiv, info )
75 DO 20 j = 1,
min( m, n ), nb
76 jb =
min(
min( m, n )-j+1, nb )
77 CALL zgetf2( m-j+1, jb, a( j, j ), lda, ipiv( j ), iinfo )
78 IF( info.EQ.0 .AND. iinfo.GT.0 )
79 $ info = iinfo + j - 1
80 DO 10 i = j,
min( m, j+jb-1 )
81 ipiv( i ) = j - 1 + ipiv( i )
83 CALL zlaswp( j-1, a, lda, j, j+jb-1, ipiv, 1 )
85 CALL zlaswp( n-j-jb+1, a( 1, j+jb ), lda, j, j+jb-1,
87 CALL ztrsm(
'Left',
'Lower',
'No transpose',
'Unit', jb,
88 $ n-j-jb+1, one, a( j, j ), lda, a( j, j+jb ),
91 CALL zgemm(
'No transpose',
'No transpose', m-j-jb+1,
92 $ n-j-jb+1, jb, -one, a( j+jb, j ), lda,
93 $ a( j, j+jb ), lda, one, a( j+jb, j+jb ),
102 SUBROUTINE zlaswp( N, A, LDA, K1, K2, IPIV, INCX )
103 INTEGER INCX, K1, K2, LDA, N
105 COMPLEX*32 A( LDA, * )
106 INTEGER I, I1, I2, INC, IP, IX, IX0, J, K, N32
113 ELSE IF( incx.LT.0 )
THEN
114 ix0 = 1 + ( 1-k2 )*incx
125 DO 20 i = i1, i2, inc
130 a( i, k ) = a( ip, k )
141 DO 50 i = i1, i2, inc
146 a( i, k ) = a( ip, k )
156 INTEGER FUNCTION ieeeck( ISPEC, ZERO, ONE )
159 REAL nan1, nan2, nan3, nan4, nan5, nan6, neginf,
160 $ negzro, newzro, posinf
163 IF( posinf.LE.one )
THEN
168 IF( neginf.GE.zero )
THEN
172 negzro = one / ( neginf+one )
173 IF( negzro.NE.zero )
THEN
177 neginf = one / negzro
178 IF( neginf.GE.zero )
THEN
182 newzro = negzro + zero
183 IF( newzro.NE.zero )
THEN
187 posinf = one / newzro
188 IF( posinf.LE.one )
THEN
192 neginf = neginf*posinf
193 IF( neginf.GE.zero )
THEN
197 posinf = posinf*posinf
198 IF( posinf.LE.one )
THEN
204 nan1 = posinf + neginf
205 nan2 = posinf / neginf
206 nan3 = posinf / posinf
210 IF( nan1.EQ.nan1 )
THEN
214 IF( nan2.EQ.nan2 )
THEN
218 IF( nan3.EQ.nan3 )
THEN
222 IF( nan4.EQ.nan4 )
THEN
226 IF( nan5.EQ.nan5 )
THEN
230 IF( nan6.EQ.nan6 )
THEN
237 INTEGER FUNCTION ilaenv( ISPEC, NAME, OPTS, N1, N2, N3,
239 CHARACTER*( * ) name, opts
240 INTEGER ispec, n1, n2, n3, n4
246 INTEGER i, ic, iz, nb, nbmin, nx
247 INTRINSIC char, ichar, int,
min,
real
250 GO TO ( 100, 100, 100, 400, 500, 600, 700, 800, 900, 1000,
257 ic = ichar( subnam( 1:1 ) )
259 IF( iz.EQ.90 .OR. iz.EQ.122 )
THEN
260 IF( ic.GE.97 .AND. ic.LE.122 )
THEN
261 subnam( 1:1 ) = char( ic-32 )
263 ic = ichar( subnam( i:i ) )
264 IF( ic.GE.97 .AND. ic.LE.122 )
265 $ subnam( i:i ) = char( ic-32 )
268 ELSE IF( iz.EQ.233 .OR. iz.EQ.169 )
THEN
269 IF( ( ic.GE.129 .AND. ic.LE.137 ) .OR.
270 $ ( ic.GE.145 .AND. ic.LE.153 ) .OR.
271 $ ( ic.GE.162 .AND. ic.LE.169 ) )
THEN
272 subnam( 1:1 ) = char( ic+64 )
274 ic = ichar( subnam( i:i ) )
275 IF( ( ic.GE.129 .AND. ic.LE.137 ) .OR.
276 $ ( ic.GE.145 .AND. ic.LE.153 ) .OR.
277 $ ( ic.GE.162 .AND. ic.LE.169 ) )
278 $ subnam( i:i ) = char( ic+64 )
281 ELSE IF( iz.EQ.218 .OR. iz.EQ.250 )
THEN
282 IF( ic.GE.225 .AND. ic.LE.250 )
THEN
283 subnam( 1:1 ) = char( ic-32 )
285 ic = ichar( subnam( i:i ) )
286 IF( ic.GE.225 .AND. ic.LE.250 )
287 $ subnam( i:i ) = char( ic-32 )
292 sname = c1.EQ.
'S' .OR. c1.EQ.
'D'
293 cname = c1.EQ.
'C' .OR. c1.EQ.
'Z'
294 IF( .NOT.( cname .OR. sname ) )
299 GO TO ( 110, 200, 300 ) ispec
302 IF( c2.EQ.
'GE' )
THEN
303 IF( c3.EQ.
'TRF' )
THEN
309 ELSE IF( c3.EQ.
'QRF' .OR. c3.EQ.
'RQF' .OR. c3.EQ.
'LQF' .OR.
316 ELSE IF( c3.EQ.
'HRD' )
THEN
322 ELSE IF( c3.EQ.
'BRD' )
THEN
328 ELSE IF( c3.EQ.
'TRI' )
THEN
335 ELSE IF( c2.EQ.
'PO' )
THEN
336 IF( c3.EQ.
'TRF' )
THEN
343 ELSE IF( c2.EQ.
'SY' )
THEN
344 IF( c3.EQ.
'TRF' )
THEN
350 ELSE IF( sname .AND. c3.EQ.
'TRD' )
THEN
352 ELSE IF( sname .AND. c3.EQ.
'GST' )
THEN
355 ELSE IF( cname .AND. c2.EQ.
'HE' )
THEN
356 IF( c3.EQ.
'TRF' )
THEN
358 ELSE IF( c3.EQ.
'TRD' )
THEN
360 ELSE IF( c3.EQ.
'GST' )
THEN
363 ELSE IF( sname .AND. c2.EQ.
'OR' )
THEN
364 IF( c3( 1:1 ).EQ.
'G' )
THEN
365 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
366 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
370 ELSE IF( c3( 1:1 ).EQ.
'M' )
THEN
371 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
372 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
377 ELSE IF( cname .AND. c2.EQ.
'UN' )
THEN
378 IF( c3( 1:1 ).EQ.
'G' )
THEN
379 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
380 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
384 ELSE IF( c3( 1:1 ).EQ.
'M' )
THEN
385 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
386 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
391 ELSE IF( c2.EQ.
'GB' )
THEN
392 IF( c3.EQ.
'TRF' )
THEN
407 ELSE IF( c2.EQ.
'PB' )
THEN
408 IF( c3.EQ.
'TRF' )
THEN
423 ELSE IF( c2.EQ.
'TR' )
THEN
424 IF( c3.EQ.
'TRI' )
THEN
431 ELSE IF( c2.EQ.
'LA' )
THEN
432 IF( c3.EQ.
'UUM' )
THEN
439 ELSE IF( sname .AND. c2.EQ.
'ST' )
THEN
440 IF( c3.EQ.
'EBZ' )
THEN
448 IF( c2.EQ.
'GE' )
THEN
449 IF( c3.EQ.
'QRF' .OR. c3.EQ.
'RQF' .OR. c3.EQ.
'LQF' .OR.
456 ELSE IF( c3.EQ.
'HRD' )
THEN
462 ELSE IF( c3.EQ.
'BRD' )
THEN
468 ELSE IF( c3.EQ.
'TRI' )
THEN
475 ELSE IF( c2.EQ.
'SY' )
THEN
476 IF( c3.EQ.
'TRF' )
THEN
482 ELSE IF( sname .AND. c3.EQ.
'TRD' )
THEN
485 ELSE IF( cname .AND. c2.EQ.
'HE' )
THEN
486 IF( c3.EQ.
'TRD' )
THEN
489 ELSE IF( sname .AND. c2.EQ.
'OR' )
THEN
490 IF( c3( 1:1 ).EQ.
'G' )
THEN
491 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
492 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
496 ELSE IF( c3( 1:1 ).EQ.
'M' )
THEN
497 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
498 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
503 ELSE IF( cname .AND. c2.EQ.
'UN' )
THEN
504 IF( c3( 1:1 ).EQ.
'G' )
THEN
505 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
506 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
510 ELSE IF( c3( 1:1 ).EQ.
'M' )
THEN
511 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
512 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
522 IF( c2.EQ.
'GE' )
THEN
523 IF( c3.EQ.
'QRF' .OR. c3.EQ.
'RQF' .OR. c3.EQ.
'LQF' .OR.
530 ELSE IF( c3.EQ.
'HRD' )
THEN
536 ELSE IF( c3.EQ.
'BRD' )
THEN
543 ELSE IF( c2.EQ.
'SY' )
THEN
544 IF( sname .AND. c3.EQ.
'TRD' )
THEN
547 ELSE IF( cname .AND. c2.EQ.
'HE' )
THEN
548 IF( c3.EQ.
'TRD' )
THEN
551 ELSE IF( sname .AND. c2.EQ.
'OR' )
THEN
552 IF( c3( 1:1 ).EQ.
'G' )
THEN
553 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
554 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
559 ELSE IF( cname .AND. c2.EQ.
'UN' )
THEN
560 IF( c3( 1:1 ).EQ.
'G' )
THEN
561 IF( c4.EQ.
'QR' .OR. c4.EQ.
'RQ' .OR. c4.EQ.
'LQ' .OR.
562 $ c4.EQ.
'QL' .OR. c4.EQ.
'HR' .OR. c4.EQ.
'TR' .OR.
602 SUBROUTINE xerbla( SRNAME, INFO )
605 WRITE( *, fmt = 9999 )srname, info
607 9999
FORMAT(
' ** On entry to ', a6,
' parameter number ', i2,
' had ',
608 $
'an illegal value' )
611 SUBROUTINE zgetri( N, A, LDA, IPIV, WORK, LWORK, INFO )
612 INTEGER INFO, LDA, LWORK, N
614 COMPLEX*32 A( LDA, * ), WORK( * )
617 $ one = ( 1.0q+0, 0.0q+0 ) )
619 INTEGER I, IWS, J, JB, JJ, JP, LDWORK, LWKOPT, NB,
626 nb = ilaenv( 1,
'ZGETRI',
' ', n, -1, -1, -1 )
629 lquery = ( lwork.EQ.-1 )
632 ELSE IF( lda.LT.
max( 1, n ) )
THEN
634 ELSE IF( lwork.LT.
max( 1, n ) .AND. .NOT.lquery )
THEN
638 CALL xerbla(
'ZGETRI', -info )
640 ELSE IF( lquery )
THEN
645 CALL ztrtri(
'Upper',
'Non-unit', n, a, lda, info )
650 IF( nb.GT.1 .AND. nb.LT.n )
THEN
651 iws =
max( ldwork*nb, 1 )
652 IF( lwork.LT.iws )
THEN
654 nbmin =
max( 2, ilaenv( 2,
'ZGETRI',
' ', n, -1, -1, -1 ) )
659 IF( nb.LT.nbmin .OR. nb.GE.n )
THEN
662 work( i ) = a( i, j )
666 $
CALL zgemv(
'No transpose', n, n-j, -one, a( 1, j+1 ),
667 $ lda, work( j+1 ), 1, one, a( 1, j ), 1 )
670 nn = ( ( n-1 ) / nb )*nb + 1
672 jb =
min( nb, n-j+1 )
673 DO 40 jj = j, j + jb - 1
675 work( i+( jj-j )*ldwork ) = a( i, jj )
680 $
CALL zgemm(
'No transpose',
'No transpose', n, jb,
681 $ n-j-jb+1, -one, a( 1, j+jb ), lda,
682 $ work( j+jb ), ldwork, one, a( 1, j ), lda )
683 CALL ztrsm(
'Right',
'Lower',
'No transpose',
'Unit', n, jb,
684 $ one, work( j ), ldwork, a( 1, j ), lda )
687 DO 60 j = n - 1, 1, -1
690 $
CALL zswap( n, a( 1, j ), 1, a( 1, jp ), 1 )
696 SUBROUTINE ztrti2( UPLO, DIAG, N, A, LDA, INFO )
699 COMPLEX*32 A( LDA, * )
702 LOGICAL NOUNIT, UPPER
710 upper = lsame( uplo,
'U' )
711 nounit = lsame( diag,
'N' )
712 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
714 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag,
'U' ) )
THEN
716 ELSE IF( n.LT.0 )
THEN
718 ELSE IF( lda.LT.
max( 1, n ) )
THEN
722 CALL xerbla(
'ZTRTI2', -info )
728 a( j, j ) = one / a( j, j )
733 CALL ztrmv(
'Upper',
'No transpose', diag, j-1, a, lda,
735 CALL zscal( j-1, ajj, a( 1, j ), 1 )
740 a( j, j ) = one / a( j, j )
746 CALL ztrmv(
'Lower',
'No transpose', diag, n-j,
747 $ a( j+1, j+1 ), lda, a( j+1, j ), 1 )
748 CALL zscal( n-j, ajj, a( j+1, j ), 1 )
755 SUBROUTINE ztrtri( UPLO, DIAG, N, A, LDA, INFO )
758 COMPLEX*32 A( LDA, * )
761 $ zero = ( 0.0q+0, 0.0q+0 ) )
762 LOGICAL NOUNIT, UPPER
763 INTEGER J, JB, NB, NN
766 EXTERNAL lsame, ilaenv
770 upper = lsame( uplo,
'U' )
771 nounit = lsame( diag,
'N' )
772 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
774 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag,
'U' ) )
THEN
776 ELSE IF( n.LT.0 )
THEN
778 ELSE IF( lda.LT.
max( 1, n ) )
THEN
782 CALL xerbla(
'ZTRTRI', -info )
789 IF( a( info, info ).EQ.zero )
794 nb = ilaenv( 1,
'ZTRTRI', uplo // diag, n, -1, -1, -1 )
795 IF( nb.LE.1 .OR. nb.GE.n )
THEN
796 CALL ztrti2( uplo, diag, n, a, lda, info )
800 jb =
min( nb, n-j+1 )
801 CALL ztrmm(
'Left',
'Upper',
'No transpose', diag, j-1,
802 $ jb, one, a, lda, a( 1, j ), lda )
803 CALL ztrsm(
'Right',
'Upper',
'No transpose', diag, j-1,
804 $ jb, -one, a( j, j ), lda, a( 1, j ), lda )
805 CALL ztrti2(
'Upper', diag, jb, a( j, j ), lda, info )
808 nn = ( ( n-1 ) / nb )*nb + 1
810 jb =
min( nb, n-j+1 )
812 CALL ztrmm(
'Left',
'Lower',
'No transpose', diag,
813 $ n-j-jb+1, jb, one, a( j+jb, j+jb ), lda,
814 $ a( j+jb, j ), lda )
815 CALL ztrsm(
'Right',
'Lower',
'No transpose', diag,
816 $ n-j-jb+1, jb, -one, a( j, j ), lda,
817 $ a( j+jb, j ), lda )
819 CALL ztrti2(
'Lower', diag, jb, a( j, j ), lda, info )
826 LOGICAL FUNCTION lsame( CA, CB )
829 INTEGER inta, intb, zcode
836 IF( zcode.EQ.90 .OR. zcode.EQ.122 )
THEN
837 IF( inta.GE.97 .AND. inta.LE.122 ) inta = inta - 32
838 IF( intb.GE.97 .AND. intb.LE.122 ) intb = intb - 32
839 ELSE IF( zcode.EQ.233 .OR. zcode.EQ.169 )
THEN
840 IF( inta.GE.129 .AND. inta.LE.137 .OR.
841 $ inta.GE.145 .AND. inta.LE.153 .OR.
842 $ inta.GE.162 .AND. inta.LE.169 ) inta = inta + 64
843 IF( intb.GE.129 .AND. intb.LE.137 .OR.
844 $ intb.GE.145 .AND. intb.LE.153 .OR.
845 $ intb.GE.162 .AND. intb.LE.169 ) intb = intb + 64
846 ELSE IF( zcode.EQ.218 .OR. zcode.EQ.250 )
THEN
847 IF( inta.GE.225 .AND. inta.LE.250 ) inta = inta - 32
848 IF( intb.GE.225 .AND. intb.LE.250 ) intb = intb - 32
853 integer function izamax(n,zx,incx)
859 if( n.lt.1 .or. incx.le.0 )
return
862 if(incx.eq.1)
go to 20
867 if(
dcabs1(zx(ix)).le.smax)
go to 5
875 if(
dcabs1(zx(i)).le.smax)
go to 30
882 real*16 function dcabs1(z)
887 dcabs1 = qabs(t(1)) + qabs(t(2))
891 subroutine zswap (n,zx,incx,zy,incy)
892 complex*32 zx(*),zy(*),ztemp
893 integer i,incx,incy,ix,iy,n
895 if(incx.eq.1.and.incy.eq.1)
go to 20
898 if(incx.lt.0)ix = (-n+1)*incx + 1
899 if(incy.lt.0)iy = (-n+1)*incy + 1
916 subroutine zscal(n,za,zx,incx)
919 if( n.le.0 .or. incx.le.0 )
return
920 if(incx.eq.1)
go to 20
933 SUBROUTINE zgeru ( M, N, ALPHA, X, INCX, Y, INCY, A, LDA )
935 INTEGER INCX, INCY, LDA, M, N
936 COMPLEX*32 A( LDA, * ), X( * ), Y( * )
940 INTEGER I, INFO, IX, J, JY, KX
946 ELSE IF( n.LT.0 )
THEN
948 ELSE IF( incx.EQ.0 )
THEN
950 ELSE IF( incy.EQ.0 )
THEN
952 ELSE IF( lda.LT.
max( 1, m ) )
THEN
956 CALL xerbla(
'ZGERU ', info )
959 IF( ( m.EQ.0 ).OR.( n.EQ.0 ).OR.( alpha.EQ.zero ) )
964 jy = 1 - ( n - 1 )*incy
968 IF( y( jy ).NE.zero )
THEN
971 a( i, j ) = a( i, j ) + x( i )*temp
980 kx = 1 - ( m - 1 )*incx
983 IF( y( jy ).NE.zero )
THEN
987 a( i, j ) = a( i, j ) + x( ix )*temp
997 SUBROUTINE ztrsm ( SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA,
999 CHARACTER*1 SIDE, UPLO, TRANSA, DIAG
1000 INTEGER M, N, LDA, LDB
1002 COMPLEX*32 A( LDA, * ), B( LDB, * )
1006 INTRINSIC qconjg,
max
1007 LOGICAL LSIDE, NOCONJ, NOUNIT, UPPER
1008 INTEGER I, INFO, J, K, NROWA
1014 lside = lsame( side ,
'L' )
1020 noconj = lsame( transa,
'T' )
1021 nounit = lsame( diag ,
'N' )
1022 upper = lsame( uplo ,
'U' )
1024 IF( ( .NOT.lside ).AND.
1025 $ ( .NOT.lsame( side ,
'R' ) ) )
THEN
1027 ELSE IF( ( .NOT.upper ).AND.
1028 $ ( .NOT.lsame( uplo ,
'L' ) ) )
THEN
1030 ELSE IF( ( .NOT.lsame( transa,
'N' ) ).AND.
1031 $ ( .NOT.lsame( transa,
'T' ) ).AND.
1032 $ ( .NOT.lsame( transa,
'C' ) ) )
THEN
1034 ELSE IF( ( .NOT.lsame( diag ,
'U' ) ).AND.
1035 $ ( .NOT.lsame( diag ,
'N' ) ) )
THEN
1037 ELSE IF( m .LT.0 )
THEN
1039 ELSE IF( n .LT.0 )
THEN
1041 ELSE IF( lda.LT.
max( 1, nrowa ) )
THEN
1043 ELSE IF( ldb.LT.
max( 1, m ) )
THEN
1047 CALL xerbla(
'ZTRSM ', info )
1052 IF( alpha.EQ.zero )
THEN
1061 IF( lsame( transa,
'N' ) )
THEN
1064 IF( alpha.NE.one )
THEN
1066 b( i, j ) = alpha*b( i, j )
1070 IF( b( k, j ).NE.zero )
THEN
1072 $ b( k, j ) = b( k, j )/a( k, k )
1074 b( i, j ) = b( i, j ) - b( k, j )*a( i, k )
1081 IF( alpha.NE.one )
THEN
1083 b( i, j ) = alpha*b( i, j )
1087 IF( b( k, j ).NE.zero )
THEN
1089 $ b( k, j ) = b( k, j )/a( k, k )
1091 b( i, j ) = b( i, j ) - b( k, j )*a( i, k )
1101 temp = alpha*b( i, j )
1103 DO 110, k = 1, i - 1
1104 temp = temp - a( k, i )*b( k, j )
1107 $ temp = temp/a( i, i )
1109 DO 120, k = 1, i - 1
1110 temp = temp - qconjg( a( k, i ) )*b( k, j )
1113 $ temp = temp/qconjg( a( i, i ) )
1120 DO 170, i = m, 1, -1
1121 temp = alpha*b( i, j )
1123 DO 150, k = i + 1, m
1124 temp = temp - a( k, i )*b( k, j )
1127 $ temp = temp/a( i, i )
1129 DO 160, k = i + 1, m
1130 temp = temp - qconjg( a( k, i ) )*b( k, j )
1133 $ temp = temp/qconjg( a( i, i ) )
1141 IF( lsame( transa,
'N' ) )
THEN
1144 IF( alpha.NE.one )
THEN
1146 b( i, j ) = alpha*b( i, j )
1149 DO 210, k = 1, j - 1
1150 IF( a( k, j ).NE.zero )
THEN
1152 b( i, j ) = b( i, j ) - a( k, j )*b( i, k )
1157 temp = one/a( j, j )
1159 b( i, j ) = temp*b( i, j )
1164 DO 280, j = n, 1, -1
1165 IF( alpha.NE.one )
THEN
1167 b( i, j ) = alpha*b( i, j )
1170 DO 260, k = j + 1, n
1171 IF( a( k, j ).NE.zero )
THEN
1173 b( i, j ) = b( i, j ) - a( k, j )*b( i, k )
1178 temp = one/a( j, j )
1180 b( i, j ) = temp*b( i, j )
1187 DO 330, k = n, 1, -1
1190 temp = one/a( k, k )
1192 temp = one/qconjg( a( k, k ) )
1195 b( i, k ) = temp*b( i, k )
1198 DO 310, j = 1, k - 1
1199 IF( a( j, k ).NE.zero )
THEN
1203 temp = qconjg( a( j, k ) )
1206 b( i, j ) = b( i, j ) - temp*b( i, k )
1210 IF( alpha.NE.one )
THEN
1212 b( i, k ) = alpha*b( i, k )
1220 temp = one/a( k, k )
1222 temp = one/qconjg( a( k, k ) )
1225 b( i, k ) = temp*b( i, k )
1228 DO 360, j = k + 1, n
1229 IF( a( j, k ).NE.zero )
THEN
1233 temp = qconjg( a( j, k ) )
1236 b( i, j ) = b( i, j ) - temp*b( i, k )
1240 IF( alpha.NE.one )
THEN
1242 b( i, k ) = alpha*b( i, k )
1252 SUBROUTINE zgemm ( TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB,
1254 CHARACTER*1 TRANSA, TRANSB
1255 INTEGER M, N, K, LDA, LDB, LDC
1256 COMPLEX*32 ALPHA, BETA
1257 COMPLEX*32 A( LDA, * ), B( LDB, * ), C( LDC, * )
1261 INTRINSIC qconjg,
max
1262 LOGICAL CONJA, CONJB, NOTA, NOTB
1263 INTEGER I, INFO, J, L, NCOLA, NROWA, NROWB
1269 nota = lsame( transa,
'N' )
1270 notb = lsame( transb,
'N' )
1271 conja = lsame( transa,
'C' )
1272 conjb = lsame( transb,
'C' )
1286 IF( ( .NOT.nota ).AND.
1287 $ ( .NOT.conja ).AND.
1288 $ ( .NOT.lsame( transa,
'T' ) ) )
THEN
1290 ELSE IF( ( .NOT.notb ).AND.
1291 $ ( .NOT.conjb ).AND.
1292 $ ( .NOT.lsame( transb,
'T' ) ) )
THEN
1294 ELSE IF( m .LT.0 )
THEN
1296 ELSE IF( n .LT.0 )
THEN
1298 ELSE IF( k .LT.0 )
THEN
1300 ELSE IF( lda.LT.
max( 1, nrowa ) )
THEN
1302 ELSE IF( ldb.LT.
max( 1, nrowb ) )
THEN
1304 ELSE IF( ldc.LT.
max( 1, m ) )
THEN
1308 CALL xerbla(
'ZGEMM ', info )
1311 IF( ( m.EQ.0 ).OR.( n.EQ.0 ).OR.
1312 $ ( ( ( alpha.EQ.zero ).OR.( k.EQ.0 ) ).AND.( beta.EQ.one ) ) )
1314 IF( alpha.EQ.zero )
THEN
1315 IF( beta.EQ.zero )
THEN
1324 c( i, j ) = beta*c( i, j )
1333 IF( beta.EQ.zero )
THEN
1337 ELSE IF( beta.NE.one )
THEN
1339 c( i, j ) = beta*c( i, j )
1343 IF( b( l, j ).NE.zero )
THEN
1344 temp = alpha*b( l, j )
1346 c( i, j ) = c( i, j ) + temp*a( i, l )
1351 ELSE IF( conja )
THEN
1356 temp = temp + qconjg( a( l, i ) )*b( l, j )
1358 IF( beta.EQ.zero )
THEN
1359 c( i, j ) = alpha*temp
1361 c( i, j ) = alpha*temp + beta*c( i, j )
1370 temp = temp + a( l, i )*b( l, j )
1372 IF( beta.EQ.zero )
THEN
1373 c( i, j ) = alpha*temp
1375 c( i, j ) = alpha*temp + beta*c( i, j )
1383 IF( beta.EQ.zero )
THEN
1387 ELSE IF( beta.NE.one )
THEN
1389 c( i, j ) = beta*c( i, j )
1393 IF( b( j, l ).NE.zero )
THEN
1394 temp = alpha*qconjg( b( j, l ) )
1396 c( i, j ) = c( i, j ) + temp*a( i, l )
1403 IF( beta.EQ.zero )
THEN
1407 ELSE IF( beta.NE.one )
THEN
1409 c( i, j ) = beta*c( i, j )
1413 IF( b( j, l ).NE.zero )
THEN
1414 temp = alpha*b( j, l )
1416 c( i, j ) = c( i, j ) + temp*a( i, l )
1422 ELSE IF( conja )
THEN
1429 $ qconjg( a( l, i ) )*qconjg( b( j, l ) )
1431 IF( beta.EQ.zero )
THEN
1432 c( i, j ) = alpha*temp
1434 c( i, j ) = alpha*temp + beta*c( i, j )
1443 temp = temp + qconjg( a( l, i ) )*b( j, l )
1445 IF( beta.EQ.zero )
THEN
1446 c( i, j ) = alpha*temp
1448 c( i, j ) = alpha*temp + beta*c( i, j )
1459 temp = temp + a( l, i )*qconjg( b( j, l ) )
1461 IF( beta.EQ.zero )
THEN
1462 c( i, j ) = alpha*temp
1464 c( i, j ) = alpha*temp + beta*c( i, j )
1473 temp = temp + a( l, i )*b( j, l )
1475 IF( beta.EQ.zero )
THEN
1476 c( i, j ) = alpha*temp
1478 c( i, j ) = alpha*temp + beta*c( i, j )
1487 SUBROUTINE ztrmv ( UPLO, TRANS, DIAG, N, A, LDA, X, INCX )
1488 INTEGER INCX, LDA, N
1489 CHARACTER*1 DIAG, TRANS, UPLO
1490 COMPLEX*32 A( LDA, * ), X( * )
1494 INTEGER I, INFO, IX, J, JX, KX
1495 LOGICAL NOCONJ, NOUNIT
1499 INTRINSIC qconjg,
max
1501 IF ( .NOT.lsame( uplo ,
'U' ).AND.
1502 $ .NOT.lsame( uplo ,
'L' ) )
THEN
1504 ELSE IF( .NOT.lsame( trans,
'N' ).AND.
1505 $ .NOT.lsame( trans,
'T' ).AND.
1506 $ .NOT.lsame( trans,
'C' ) )
THEN
1508 ELSE IF( .NOT.lsame( diag ,
'U' ).AND.
1509 $ .NOT.lsame( diag ,
'N' ) )
THEN
1511 ELSE IF( n.LT.0 )
THEN
1513 ELSE IF( lda.LT.
max( 1, n ) )
THEN
1515 ELSE IF( incx.EQ.0 )
THEN
1519 CALL xerbla(
'ZTRMV ', info )
1524 noconj = lsame( trans,
'T' )
1525 nounit = lsame( diag ,
'N' )
1527 kx = 1 - ( n - 1 )*incx
1528 ELSE IF( incx.NE.1 )
THEN
1531 IF( lsame( trans,
'N' ) )
THEN
1532 IF( lsame( uplo,
'U' ) )
THEN
1535 IF( x( j ).NE.zero )
THEN
1538 x( i ) = x( i ) + temp*a( i, j )
1541 $ x( j ) = x( j )*a( j, j )
1547 IF( x( jx ).NE.zero )
THEN
1551 x( ix ) = x( ix ) + temp*a( i, j )
1555 $ x( jx ) = x( jx )*a( j, j )
1563 IF( x( j ).NE.zero )
THEN
1565 DO 50, i = n, j + 1, -1
1566 x( i ) = x( i ) + temp*a( i, j )
1569 $ x( j ) = x( j )*a( j, j )
1573 kx = kx + ( n - 1 )*incx
1576 IF( x( jx ).NE.zero )
THEN
1579 DO 70, i = n, j + 1, -1
1580 x( ix ) = x( ix ) + temp*a( i, j )
1584 $ x( jx ) = x( jx )*a( j, j )
1591 IF( lsame( uplo,
'U' ) )
THEN
1593 DO 110, j = n, 1, -1
1597 $ temp = temp*a( j, j )
1598 DO 90, i = j - 1, 1, -1
1599 temp = temp + a( i, j )*x( i )
1603 $ temp = temp*qconjg( a( j, j ) )
1604 DO 100, i = j - 1, 1, -1
1605 temp = temp + qconjg( a( i, j ) )*x( i )
1611 jx = kx + ( n - 1 )*incx
1612 DO 140, j = n, 1, -1
1617 $ temp = temp*a( j, j )
1618 DO 120, i = j - 1, 1, -1
1620 temp = temp + a( i, j )*x( ix )
1624 $ temp = temp*qconjg( a( j, j ) )
1625 DO 130, i = j - 1, 1, -1
1627 temp = temp + qconjg( a( i, j ) )*x( ix )
1640 $ temp = temp*a( j, j )
1641 DO 150, i = j + 1, n
1642 temp = temp + a( i, j )*x( i )
1646 $ temp = temp*qconjg( a( j, j ) )
1647 DO 160, i = j + 1, n
1648 temp = temp + qconjg( a( i, j ) )*x( i )
1660 $ temp = temp*a( j, j )
1661 DO 180, i = j + 1, n
1663 temp = temp + a( i, j )*x( ix )
1667 $ temp = temp*qconjg( a( j, j ) )
1668 DO 190, i = j + 1, n
1670 temp = temp + qconjg( a( i, j ) )*x( ix )
1682 SUBROUTINE ztrmm ( SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA,
1684 CHARACTER*1 SIDE, UPLO, TRANSA, DIAG
1685 INTEGER M, N, LDA, LDB
1687 COMPLEX*32 A( LDA, * ), B( LDB, * )
1691 INTRINSIC qconjg,
max
1692 LOGICAL LSIDE, NOCONJ, NOUNIT, UPPER
1693 INTEGER I, INFO, J, K, NROWA
1699 lside = lsame( side ,
'L' )
1705 noconj = lsame( transa,
'T' )
1706 nounit = lsame( diag ,
'N' )
1707 upper = lsame( uplo ,
'U' )
1709 IF( ( .NOT.lside ).AND.
1710 $ ( .NOT.lsame( side ,
'R' ) ) )
THEN
1712 ELSE IF( ( .NOT.upper ).AND.
1713 $ ( .NOT.lsame( uplo ,
'L' ) ) )
THEN
1715 ELSE IF( ( .NOT.lsame( transa,
'N' ) ).AND.
1716 $ ( .NOT.lsame( transa,
'T' ) ).AND.
1717 $ ( .NOT.lsame( transa,
'C' ) ) )
THEN
1719 ELSE IF( ( .NOT.lsame( diag ,
'U' ) ).AND.
1720 $ ( .NOT.lsame( diag ,
'N' ) ) )
THEN
1722 ELSE IF( m .LT.0 )
THEN
1724 ELSE IF( n .LT.0 )
THEN
1726 ELSE IF( lda.LT.
max( 1, nrowa ) )
THEN
1728 ELSE IF( ldb.LT.
max( 1, m ) )
THEN
1732 CALL xerbla(
'ZTRMM ', info )
1737 IF( alpha.EQ.zero )
THEN
1746 IF( lsame( transa,
'N' ) )
THEN
1750 IF( b( k, j ).NE.zero )
THEN
1751 temp = alpha*b( k, j )
1753 b( i, j ) = b( i, j ) + temp*a( i, k )
1756 $ temp = temp*a( k, k )
1764 IF( b( k, j ).NE.zero )
THEN
1765 temp = alpha*b( k, j )
1768 $ b( k, j ) = b( k, j )*a( k, k )
1770 b( i, j ) = b( i, j ) + temp*a( i, k )
1779 DO 110, i = m, 1, -1
1783 $ temp = temp*a( i, i )
1785 temp = temp + a( k, i )*b( k, j )
1789 $ temp = temp*qconjg( a( i, i ) )
1790 DO 100, k = 1, i - 1
1791 temp = temp + qconjg( a( k, i ) )*b( k, j )
1794 b( i, j ) = alpha*temp
1803 $ temp = temp*a( i, i )
1804 DO 130, k = i + 1, m
1805 temp = temp + a( k, i )*b( k, j )
1809 $ temp = temp*qconjg( a( i, i ) )
1810 DO 140, k = i + 1, m
1811 temp = temp + qconjg( a( k, i ) )*b( k, j )
1814 b( i, j ) = alpha*temp
1820 IF( lsame( transa,
'N' ) )
THEN
1822 DO 200, j = n, 1, -1
1825 $ temp = temp*a( j, j )
1827 b( i, j ) = temp*b( i, j )
1829 DO 190, k = 1, j - 1
1830 IF( a( k, j ).NE.zero )
THEN
1831 temp = alpha*a( k, j )
1833 b( i, j ) = b( i, j ) + temp*b( i, k )
1842 $ temp = temp*a( j, j )
1844 b( i, j ) = temp*b( i, j )
1846 DO 230, k = j + 1, n
1847 IF( a( k, j ).NE.zero )
THEN
1848 temp = alpha*a( k, j )
1850 b( i, j ) = b( i, j ) + temp*b( i, k )
1859 DO 260, j = 1, k - 1
1860 IF( a( j, k ).NE.zero )
THEN
1862 temp = alpha*a( j, k )
1864 temp = alpha*qconjg( a( j, k ) )
1867 b( i, j ) = b( i, j ) + temp*b( i, k )
1874 temp = temp*a( k, k )
1876 temp = temp*qconjg( a( k, k ) )
1879 IF( temp.NE.one )
THEN
1881 b( i, k ) = temp*b( i, k )
1886 DO 320, k = n, 1, -1
1887 DO 300, j = k + 1, n
1888 IF( a( j, k ).NE.zero )
THEN
1890 temp = alpha*a( j, k )
1892 temp = alpha*qconjg( a( j, k ) )
1895 b( i, j ) = b( i, j ) + temp*b( i, k )
1902 temp = temp*a( k, k )
1904 temp = temp*qconjg( a( k, k ) )
1907 IF( temp.NE.one )
THEN
1909 b( i, k ) = temp*b( i, k )
1919 SUBROUTINE zgemv ( TRANS, M, N, ALPHA, A, LDA, X, INCX,
1921 COMPLEX*32 ALPHA, BETA
1922 INTEGER INCX, INCY, LDA, M, N
1924 COMPLEX*32 A( LDA, * ), X( * ), Y( * )
1930 INTEGER I, INFO, IX, IY, J, JX, JY, KX, KY, LENX, LENY
1935 INTRINSIC qconjg,
max
1937 IF ( .NOT.lsame( trans,
'N' ).AND.
1938 $ .NOT.lsame( trans,
'T' ).AND.
1939 $ .NOT.lsame( trans,
'C' ) )
THEN
1941 ELSE IF( m.LT.0 )
THEN
1943 ELSE IF( n.LT.0 )
THEN
1945 ELSE IF( lda.LT.
max( 1, m ) )
THEN
1947 ELSE IF( incx.EQ.0 )
THEN
1949 ELSE IF( incy.EQ.0 )
THEN
1953 CALL xerbla(
'ZGEMV ', info )
1956 IF( ( m.EQ.0 ).OR.( n.EQ.0 ).OR.
1957 $ ( ( alpha.EQ.zero ).AND.( beta.EQ.one ) ) )
1959 noconj = lsame( trans,
'T' )
1960 IF( lsame( trans,
'N' ) )
THEN
1970 kx = 1 - ( lenx - 1 )*incx
1975 ky = 1 - ( leny - 1 )*incy
1977 IF( beta.NE.one )
THEN
1979 IF( beta.EQ.zero )
THEN
1985 y( i ) = beta*y( i )
1990 IF( beta.EQ.zero )
THEN
1997 y( iy ) = beta*y( iy )
2005 IF( lsame( trans,
'N' ) )
THEN
2009 IF( x( jx ).NE.zero )
THEN
2010 temp = alpha*x( jx )
2012 y( i ) = y( i ) + temp*a( i, j )
2019 IF( x( jx ).NE.zero )
THEN
2020 temp = alpha*x( jx )
2023 y( iy ) = y( iy ) + temp*a( i, j )
2037 temp = temp + a( i, j )*x( i )
2041 temp = temp + qconjg( a( i, j ) )*x( i )
2044 y( jy ) = y( jy ) + alpha*temp
2053 temp = temp + a( i, j )*x( ix )
2058 temp = temp + qconjg( a( i, j ) )*x( ix )
2062 y( jy ) = y( jy ) + alpha*temp