Rev 62981 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
double precision function dcabs1(z)double complex z,zzdouble precision t(2)equivalence (zz,t(1))zz = zdcabs1 = dabs(t(1)) + dabs(t(2))returnenddouble precision function dzasum(n,zx,incx)cc takes the sum of the absolute values.c jack dongarra, 3/11/78.c modified 3/93 to return if incx .le. 0.c modified 12/3/93, array(1) declarations changed to array(*)cdouble complex zx(*)double precision stemp,dcabs1integer i,incx,ix,ncdzasum = 0.0d0stemp = 0.0d0if( n.le.0 .or. incx.le.0 )returnif(incx.eq.1)go to 20cc code for increment not equal to 1cix = 1do 10 i = 1,nstemp = stemp + dcabs1(zx(ix))ix = ix + incx10 continuedzasum = stempreturncc code for increment equal to 1c20 do 30 i = 1,nstemp = stemp + dcabs1(zx(i))30 continuedzasum = stempreturnendDOUBLE PRECISION FUNCTION DZNRM2( N, X, INCX )* .. Scalar Arguments ..INTEGER INCX, N* .. Array Arguments ..COMPLEX*16 X( * )* ..** DZNRM2 returns the euclidean norm of a vector via the function* name, so that** DZNRM2 := sqrt( conjg( x' )*x )**** -- This version written on 25-October-1982.* Modified on 14-October-1993 to inline the call to ZLASSQ.* Sven Hammarling, Nag Ltd.*** .. Parameters ..DOUBLE PRECISION ONE , ZEROPARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )* .. Local Scalars ..INTEGER IXDOUBLE PRECISION NORM, SCALE, SSQ, TEMP* .. Intrinsic Functions ..INTRINSIC ABS, DIMAG, DBLE, SQRT* ..* .. Executable Statements ..IF( N.LT.1 .OR. INCX.LT.1 )THENNORM = ZEROELSESCALE = ZEROSSQ = ONE* The following loop is equivalent to this call to the LAPACK* auxiliary routine:* CALL ZLASSQ( N, X, INCX, SCALE, SSQ )*DO 10, IX = 1, 1 + ( N - 1 )*INCX, INCXIF( DBLE( X( IX ) ).NE.ZERO )THENTEMP = ABS( DBLE( X( IX ) ) )IF( SCALE.LT.TEMP )THENSSQ = ONE + SSQ*( SCALE/TEMP )**2SCALE = TEMPELSESSQ = SSQ + ( TEMP/SCALE )**2END IFEND IFIF( DIMAG( X( IX ) ).NE.ZERO )THENTEMP = ABS( DIMAG( X( IX ) ) )IF( SCALE.LT.TEMP )THENSSQ = ONE + SSQ*( SCALE/TEMP )**2SCALE = TEMPELSESSQ = SSQ + ( TEMP/SCALE )**2END IFEND IF10 CONTINUENORM = SCALE * SQRT( SSQ )END IF*DZNRM2 = NORMRETURN** End of DZNRM2.*ENDinteger function izamax(n,zx,incx)cc finds the index of element having max. absolute value.c jack dongarra, 1/15/85.c modified 3/93 to return if incx .le. 0.c modified 12/3/93, array(1) declarations changed to array(*)cdouble complex zx(*)double precision smaxinteger i,incx,ix,ndouble precision dcabs1cizamax = 0if( n.lt.1 .or. incx.le.0 )returnizamax = 1if(n.eq.1)returnif(incx.eq.1)go to 20cc code for increment not equal to 1cix = 1smax = dcabs1(zx(1))ix = ix + incxdo 10 i = 2,nif(dcabs1(zx(ix)).le.smax) go to 5izamax = ismax = dcabs1(zx(ix))5 ix = ix + incx10 continuereturncc code for increment equal to 1c20 smax = dcabs1(zx(1))do 30 i = 2,nif(dcabs1(zx(i)).le.smax) go to 30izamax = ismax = dcabs1(zx(i))30 continuereturnendsubroutine zaxpy(n,za,zx,incx,zy,incy)cc constant times a vector plus a vector.c jack dongarra, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)cdouble complex zx(*),zy(*),zainteger i,incx,incy,ix,iy,ndouble precision dcabs1if(n.le.0)returnif (dcabs1(za) .eq. 0.0d0) returnif (incx.eq.1.and.incy.eq.1)go to 20cc code for unequal increments or equal incrementsc not equal to 1cix = 1iy = 1if(incx.lt.0)ix = (-n+1)*incx + 1if(incy.lt.0)iy = (-n+1)*incy + 1do 10 i = 1,nzy(iy) = zy(iy) + za*zx(ix)ix = ix + incxiy = iy + incy10 continuereturncc code for both increments equal to 1c20 do 30 i = 1,nzy(i) = zy(i) + za*zx(i)30 continuereturnendsubroutine zcopy(n,zx,incx,zy,incy)cc copies a vector, x, to a vector, y.c jack dongarra, linpack, 4/11/78.c modified 12/3/93, array(1) declarations changed to array(*)cdouble complex zx(*),zy(*)integer i,incx,incy,ix,iy,ncif(n.le.0)returnif(incx.eq.1.and.incy.eq.1)go to 20cc code for unequal increments or equal incrementsc not equal to 1cix = 1iy = 1if(incx.lt.0)ix = (-n+1)*incx + 1if(incy.lt.0)iy = (-n+1)*incy + 1do 10 i = 1,nzy(iy) = zx(ix)ix = ix + incxiy = iy + incy10 continuereturncc code for both increments equal to 1c20 do 30 i = 1,nzy(i) = zx(i)30 continuereturnenddouble complex function zdotc(n,zx,incx,zy,incy)cc forms the dot product of a vector.c jack dongarra, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)cdouble complex zx(*),zy(*),ztempinteger i,incx,incy,ix,iy,nintrinsic dconjgztemp = (0.0d0,0.0d0)zdotc = (0.0d0,0.0d0)if(n.le.0)returnif(incx.eq.1.and.incy.eq.1)go to 20cc code for unequal increments or equal incrementsc not equal to 1cix = 1iy = 1if(incx.lt.0)ix = (-n+1)*incx + 1if(incy.lt.0)iy = (-n+1)*incy + 1do 10 i = 1,nztemp = ztemp + dconjg(zx(ix))*zy(iy)ix = ix + incxiy = iy + incy10 continuezdotc = ztempreturncc code for both increments equal to 1c20 do 30 i = 1,nztemp = ztemp + dconjg(zx(i))*zy(i)30 continuezdotc = ztempreturnenddouble complex function zdotu(n,zx,incx,zy,incy)cc forms the dot product of two vectors.c jack dongarra, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)cdouble complex zx(*),zy(*),ztempinteger i,incx,incy,ix,iy,nztemp = (0.0d0,0.0d0)zdotu = (0.0d0,0.0d0)if(n.le.0)returnif(incx.eq.1.and.incy.eq.1)go to 20cc code for unequal increments or equal incrementsc not equal to 1cix = 1iy = 1if(incx.lt.0)ix = (-n+1)*incx + 1if(incy.lt.0)iy = (-n+1)*incy + 1do 10 i = 1,nztemp = ztemp + zx(ix)*zy(iy)ix = ix + incxiy = iy + incy10 continuezdotu = ztempreturncc code for both increments equal to 1c20 do 30 i = 1,nztemp = ztemp + zx(i)*zy(i)30 continuezdotu = ztempreturnendsubroutine zdscal(n,da,zx,incx)cc scales a vector by a constant.c jack dongarra, 3/11/78.c modified 3/93 to return if incx .le. 0.c modified 12/3/93, array(1) declarations changed to array(*)cintrinsic dcmplxdouble complex zx(*)double precision dainteger i,incx,ix,ncif( n.le.0 .or. incx.le.0 )returnif(incx.eq.1)go to 20cc code for increment not equal to 1cix = 1do 10 i = 1,nzx(ix) = dcmplx(da,0.0d0)*zx(ix)ix = ix + incx10 continuereturncc code for increment equal to 1c20 do 30 i = 1,nzx(i) = dcmplx(da,0.0d0)*zx(i)30 continuereturnendSUBROUTINE ZGEMV ( TRANS, M, N, ALPHA, A, LDA, X, INCX,$ BETA, Y, INCY )* .. Scalar Arguments ..COMPLEX*16 ALPHA, BETAINTEGER INCX, INCY, LDA, M, NCHARACTER*1 TRANS* .. Array Arguments ..COMPLEX*16 A( LDA, * ), X( * ), Y( * )* ..** Purpose* =======** ZGEMV performs one of the matrix-vector operations** y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y, or** y := alpha*conjg( A' )*x + beta*y,** where alpha and beta are scalars, x and y are vectors and A is an* m by n matrix.** Parameters* ==========** TRANS - CHARACTER*1.* On entry, TRANS specifies the operation to be performed as* follows:** TRANS = 'N' or 'n' y := alpha*A*x + beta*y.** TRANS = 'T' or 't' y := alpha*A'*x + beta*y.** TRANS = 'C' or 'c' y := alpha*conjg( A' )*x + beta*y.** Unchanged on exit.** M - INTEGER.* On entry, M specifies the number of rows of the matrix A.* M must be at least zero.* Unchanged on exit.** N - INTEGER.* On entry, N specifies the number of columns of the matrix A.* N must be at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, n ).* Before entry, the leading m by n part of the array A must* contain the matrix of coefficients.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. LDA must be at least* max( 1, m ).* Unchanged on exit.** X - COMPLEX*16 array of DIMENSION at least* ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'* and at least* ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.* Before entry, the incremented array X must contain the* vector x.* Unchanged on exit.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.** BETA - COMPLEX*16 .* On entry, BETA specifies the scalar beta. When BETA is* supplied as zero then Y need not be set on input.* Unchanged on exit.** Y - COMPLEX*16 array of DIMENSION at least* ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'* and at least* ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.* Before entry with BETA non-zero, the incremented array Y* must contain the vector y. On exit, Y is overwritten by the* updated vector y.** INCY - INTEGER.* On entry, INCY specifies the increment for the elements of* Y. INCY must not be zero.* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ONEPARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMPINTEGER I, INFO, IX, IY, J, JX, JY, KX, KY, LENX, LENYLOGICAL NOCONJ* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( TRANS, 'N' ).AND.$ .NOT.LSAME( TRANS, 'T' ).AND.$ .NOT.LSAME( TRANS, 'C' ) )THENINFO = 1ELSE IF( M.LT.0 )THENINFO = 2ELSE IF( N.LT.0 )THENINFO = 3ELSE IF( LDA.LT.MAX( 1, M ) )THENINFO = 6ELSE IF( INCX.EQ.0 )THENINFO = 8ELSE IF( INCY.EQ.0 )THENINFO = 11END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZGEMV ', INFO )RETURNEND IF** Quick return if possible.*IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.$ ( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )$ RETURN*NOCONJ = LSAME( TRANS, 'T' )** Set LENX and LENY, the lengths of the vectors x and y, and set* up the start points in X and Y.*IF( LSAME( TRANS, 'N' ) )THENLENX = NLENY = MELSELENX = MLENY = NEND IFIF( INCX.GT.0 )THENKX = 1ELSEKX = 1 - ( LENX - 1 )*INCXEND IFIF( INCY.GT.0 )THENKY = 1ELSEKY = 1 - ( LENY - 1 )*INCYEND IF** Start the operations. In this version the elements of A are* accessed sequentially with one pass through A.** First form y := beta*y.*IF( BETA.NE.ONE )THENIF( INCY.EQ.1 )THENIF( BETA.EQ.ZERO )THENDO 10, I = 1, LENYY( I ) = ZERO10 CONTINUEELSEDO 20, I = 1, LENYY( I ) = BETA*Y( I )20 CONTINUEEND IFELSEIY = KYIF( BETA.EQ.ZERO )THENDO 30, I = 1, LENYY( IY ) = ZEROIY = IY + INCY30 CONTINUEELSEDO 40, I = 1, LENYY( IY ) = BETA*Y( IY )IY = IY + INCY40 CONTINUEEND IFEND IFEND IFIF( ALPHA.EQ.ZERO )$ RETURNIF( LSAME( TRANS, 'N' ) )THEN** Form y := alpha*A*x + y.*JX = KXIF( INCY.EQ.1 )THENDO 60, J = 1, Nc IF( X( JX ).NE.ZERO )THENTEMP = ALPHA*X( JX )DO 50, I = 1, MY( I ) = Y( I ) + TEMP*A( I, J )50 CONTINUEc END IFJX = JX + INCX60 CONTINUEELSEDO 80, J = 1, Nc IF( X( JX ).NE.ZERO )THENTEMP = ALPHA*X( JX )IY = KYDO 70, I = 1, MY( IY ) = Y( IY ) + TEMP*A( I, J )IY = IY + INCY70 CONTINUEc END IFJX = JX + INCX80 CONTINUEEND IFELSE** Form y := alpha*A'*x + y or y := alpha*conjg( A' )*x + y.*JY = KYIF( INCX.EQ.1 )THENDO 110, J = 1, NTEMP = ZEROIF( NOCONJ )THENDO 90, I = 1, MTEMP = TEMP + A( I, J )*X( I )90 CONTINUEELSEDO 100, I = 1, MTEMP = TEMP + DCONJG( A( I, J ) )*X( I )100 CONTINUEEND IFY( JY ) = Y( JY ) + ALPHA*TEMPJY = JY + INCY110 CONTINUEELSEDO 140, J = 1, NTEMP = ZEROIX = KXIF( NOCONJ )THENDO 120, I = 1, MTEMP = TEMP + A( I, J )*X( IX )IX = IX + INCX120 CONTINUEELSEDO 130, I = 1, MTEMP = TEMP + DCONJG( A( I, J ) )*X( IX )IX = IX + INCX130 CONTINUEEND IFY( JY ) = Y( JY ) + ALPHA*TEMPJY = JY + INCY140 CONTINUEEND IFEND IF*RETURN** End of ZGEMV .*ENDSUBROUTINE ZGERC ( M, N, ALPHA, X, INCX, Y, INCY, A, LDA )* .. Scalar Arguments ..COMPLEX*16 ALPHAINTEGER INCX, INCY, LDA, M, N* .. Array Arguments ..COMPLEX*16 A( LDA, * ), X( * ), Y( * )* ..** Purpose* =======** ZGERC performs the rank 1 operation** A := alpha*x*conjg( y' ) + A,** where alpha is a scalar, x is an m element vector, y is an n element* vector and A is an m by n matrix.** Parameters* ==========** M - INTEGER.* On entry, M specifies the number of rows of the matrix A.* M must be at least zero.* Unchanged on exit.** N - INTEGER.* On entry, N specifies the number of columns of the matrix A.* N must be at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( m - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the m* element vector x.* Unchanged on exit.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.** Y - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCY ) ).* Before entry, the incremented array Y must contain the n* element vector y.* Unchanged on exit.** INCY - INTEGER.* On entry, INCY specifies the increment for the elements of* Y. INCY must not be zero.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, n ).* Before entry, the leading m by n part of the array A must* contain the matrix of coefficients. On exit, A is* overwritten by the updated matrix.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. LDA must be at least* max( 1, m ).* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMPINTEGER I, INFO, IX, J, JY, KX* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( M.LT.0 )THENINFO = 1ELSE IF( N.LT.0 )THENINFO = 2ELSE IF( INCX.EQ.0 )THENINFO = 5ELSE IF( INCY.EQ.0 )THENINFO = 7ELSE IF( LDA.LT.MAX( 1, M ) )THENINFO = 9END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZGERC ', INFO )RETURNEND IF** Quick return if possible.*IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.( ALPHA.EQ.ZERO ) )$ RETURN** Start the operations. In this version the elements of A are* accessed sequentially with one pass through A.*IF( INCY.GT.0 )THENJY = 1ELSEJY = 1 - ( N - 1 )*INCYEND IFIF( INCX.EQ.1 )THENDO 20, J = 1, Nc IF( Y( JY ).NE.ZERO )THENTEMP = ALPHA*DCONJG( Y( JY ) )DO 10, I = 1, MA( I, J ) = A( I, J ) + X( I )*TEMP10 CONTINUEc END IFJY = JY + INCY20 CONTINUEELSEIF( INCX.GT.0 )THENKX = 1ELSEKX = 1 - ( M - 1 )*INCXEND IFDO 40, J = 1, Nc IF( Y( JY ).NE.ZERO )THENTEMP = ALPHA*DCONJG( Y( JY ) )IX = KXDO 30, I = 1, MA( I, J ) = A( I, J ) + X( IX )*TEMPIX = IX + INCX30 CONTINUEc END IFJY = JY + INCY40 CONTINUEEND IF*RETURN** End of ZGERC .*ENDSUBROUTINE ZHEMV ( UPLO, N, ALPHA, A, LDA, X, INCX,$ BETA, Y, INCY )* .. Scalar Arguments ..COMPLEX*16 ALPHA, BETAINTEGER INCX, INCY, LDA, NCHARACTER*1 UPLO* .. Array Arguments ..COMPLEX*16 A( LDA, * ), X( * ), Y( * )* ..** Purpose* =======** ZHEMV performs the matrix-vector operation** y := alpha*A*x + beta*y,** where alpha and beta are scalars, x and y are n element vectors and* A is an n by n hermitian matrix.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the upper or lower* triangular part of the array A is to be referenced as* follows:** UPLO = 'U' or 'u' Only the upper triangular part of A* is to be referenced.** UPLO = 'L' or 'l' Only the lower triangular part of A* is to be referenced.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix A.* N must be at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, n ).* Before entry with UPLO = 'U' or 'u', the leading n by n* upper triangular part of the array A must contain the upper* triangular part of the hermitian matrix and the strictly* lower triangular part of A is not referenced.* Before entry with UPLO = 'L' or 'l', the leading n by n* lower triangular part of the array A must contain the lower* triangular part of the hermitian matrix and the strictly* upper triangular part of A is not referenced.* Note that the imaginary parts of the diagonal elements need* not be set and are assumed to be zero.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. LDA must be at least* max( 1, n ).* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the n* element vector x.* Unchanged on exit.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.** BETA - COMPLEX*16 .* On entry, BETA specifies the scalar beta. When BETA is* supplied as zero then Y need not be set on input.* Unchanged on exit.** Y - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCY ) ).* Before entry, the incremented array Y must contain the n* element vector y. On exit, Y is overwritten by the updated* vector y.** INCY - INTEGER.* On entry, INCY specifies the increment for the elements of* Y. INCY must not be zero.* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ONEPARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMP1, TEMP2INTEGER I, INFO, IX, IY, J, JX, JY, KX, KY* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX, DBLE* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( UPLO, 'U' ).AND.$ .NOT.LSAME( UPLO, 'L' ) )THENINFO = 1ELSE IF( N.LT.0 )THENINFO = 2ELSE IF( LDA.LT.MAX( 1, N ) )THENINFO = 5ELSE IF( INCX.EQ.0 )THENINFO = 7ELSE IF( INCY.EQ.0 )THENINFO = 10END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZHEMV ', INFO )RETURNEND IF** Quick return if possible.*IF( ( N.EQ.0 ).OR.( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )$ RETURN** Set up the start points in X and Y.*IF( INCX.GT.0 )THENKX = 1ELSEKX = 1 - ( N - 1 )*INCXEND IFIF( INCY.GT.0 )THENKY = 1ELSEKY = 1 - ( N - 1 )*INCYEND IF** Start the operations. In this version the elements of A are* accessed sequentially with one pass through the triangular part* of A.** First form y := beta*y.*IF( BETA.NE.ONE )THENIF( INCY.EQ.1 )THENIF( BETA.EQ.ZERO )THENDO 10, I = 1, NY( I ) = ZERO10 CONTINUEELSEDO 20, I = 1, NY( I ) = BETA*Y( I )20 CONTINUEEND IFELSEIY = KYIF( BETA.EQ.ZERO )THENDO 30, I = 1, NY( IY ) = ZEROIY = IY + INCY30 CONTINUEELSEDO 40, I = 1, NY( IY ) = BETA*Y( IY )IY = IY + INCY40 CONTINUEEND IFEND IFEND IFIF( ALPHA.EQ.ZERO )$ RETURNIF( LSAME( UPLO, 'U' ) )THEN** Form y when A is stored in upper triangle.*IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THENDO 60, J = 1, NTEMP1 = ALPHA*X( J )TEMP2 = ZERODO 50, I = 1, J - 1Y( I ) = Y( I ) + TEMP1*A( I, J )TEMP2 = TEMP2 + DCONJG( A( I, J ) )*X( I )50 CONTINUEY( J ) = Y( J ) + TEMP1*DBLE( A( J, J ) ) + ALPHA*TEMP260 CONTINUEELSEJX = KXJY = KYDO 80, J = 1, NTEMP1 = ALPHA*X( JX )TEMP2 = ZEROIX = KXIY = KYDO 70, I = 1, J - 1Y( IY ) = Y( IY ) + TEMP1*A( I, J )TEMP2 = TEMP2 + DCONJG( A( I, J ) )*X( IX )IX = IX + INCXIY = IY + INCY70 CONTINUEY( JY ) = Y( JY ) + TEMP1*DBLE( A( J, J ) ) + ALPHA*TEMP2JX = JX + INCXJY = JY + INCY80 CONTINUEEND IFELSE** Form y when A is stored in lower triangle.*IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THENDO 100, J = 1, NTEMP1 = ALPHA*X( J )TEMP2 = ZEROY( J ) = Y( J ) + TEMP1*DBLE( A( J, J ) )DO 90, I = J + 1, NY( I ) = Y( I ) + TEMP1*A( I, J )TEMP2 = TEMP2 + DCONJG( A( I, J ) )*X( I )90 CONTINUEY( J ) = Y( J ) + ALPHA*TEMP2100 CONTINUEELSEJX = KXJY = KYDO 120, J = 1, NTEMP1 = ALPHA*X( JX )TEMP2 = ZEROY( JY ) = Y( JY ) + TEMP1*DBLE( A( J, J ) )IX = JXIY = JYDO 110, I = J + 1, NIX = IX + INCXIY = IY + INCYY( IY ) = Y( IY ) + TEMP1*A( I, J )TEMP2 = TEMP2 + DCONJG( A( I, J ) )*X( IX )110 CONTINUEY( JY ) = Y( JY ) + ALPHA*TEMP2JX = JX + INCXJY = JY + INCY120 CONTINUEEND IFEND IF*RETURN** End of ZHEMV .*ENDSUBROUTINE ZHER2 ( UPLO, N, ALPHA, X, INCX, Y, INCY, A, LDA )* .. Scalar Arguments ..COMPLEX*16 ALPHAINTEGER INCX, INCY, LDA, NCHARACTER*1 UPLO* .. Array Arguments ..COMPLEX*16 A( LDA, * ), X( * ), Y( * )* ..** Purpose* =======** ZHER2 performs the hermitian rank 2 operation** A := alpha*x*conjg( y' ) + conjg( alpha )*y*conjg( x' ) + A,** where alpha is a scalar, x and y are n element vectors and A is an n* by n hermitian matrix.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the upper or lower* triangular part of the array A is to be referenced as* follows:** UPLO = 'U' or 'u' Only the upper triangular part of A* is to be referenced.** UPLO = 'L' or 'l' Only the lower triangular part of A* is to be referenced.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix A.* N must be at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the n* element vector x.* Unchanged on exit.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.** Y - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCY ) ).* Before entry, the incremented array Y must contain the n* element vector y.* Unchanged on exit.** INCY - INTEGER.* On entry, INCY specifies the increment for the elements of* Y. INCY must not be zero.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, n ).* Before entry with UPLO = 'U' or 'u', the leading n by n* upper triangular part of the array A must contain the upper* triangular part of the hermitian matrix and the strictly* lower triangular part of A is not referenced. On exit, the* upper triangular part of the array A is overwritten by the* upper triangular part of the updated matrix.* Before entry with UPLO = 'L' or 'l', the leading n by n* lower triangular part of the array A must contain the lower* triangular part of the hermitian matrix and the strictly* upper triangular part of A is not referenced. On exit, the* lower triangular part of the array A is overwritten by the* lower triangular part of the updated matrix.* Note that the imaginary parts of the diagonal elements need* not be set, they are assumed to be zero, and on exit they* are set to zero.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. LDA must be at least* max( 1, n ).* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMP1, TEMP2INTEGER I, INFO, IX, IY, J, JX, JY, KX, KY* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX, DBLE* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( UPLO, 'U' ).AND.$ .NOT.LSAME( UPLO, 'L' ) )THENINFO = 1ELSE IF( N.LT.0 )THENINFO = 2ELSE IF( INCX.EQ.0 )THENINFO = 5ELSE IF( INCY.EQ.0 )THENINFO = 7ELSE IF( LDA.LT.MAX( 1, N ) )THENINFO = 9END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZHER2 ', INFO )RETURNEND IF** Quick return if possible.*IF( ( N.EQ.0 ).OR.( ALPHA.EQ.ZERO ) )$ RETURN** Set up the start points in X and Y if the increments are not both* unity.*IF( ( INCX.NE.1 ).OR.( INCY.NE.1 ) )THENIF( INCX.GT.0 )THENKX = 1ELSEKX = 1 - ( N - 1 )*INCXEND IFIF( INCY.GT.0 )THENKY = 1ELSEKY = 1 - ( N - 1 )*INCYEND IFJX = KXJY = KYEND IF** Start the operations. In this version the elements of A are* accessed sequentially with one pass through the triangular part* of A.*IF( LSAME( UPLO, 'U' ) )THEN** Form A when A is stored in the upper triangle.*IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THENDO 20, J = 1, Nc IF( ( X( J ).NE.ZERO ).OR.( Y( J ).NE.ZERO ) )THENTEMP1 = ALPHA*DCONJG( Y( J ) )TEMP2 = DCONJG( ALPHA*X( J ) )DO 10, I = 1, J - 1A( I, J ) = A( I, J ) + X( I )*TEMP1 + Y( I )*TEMP210 CONTINUEA( J, J ) = DBLE( A( J, J ) ) +$ DBLE( X( J )*TEMP1 + Y( J )*TEMP2 )c ELSEc A( J, J ) = DBLE( A( J, J ) )c END IF20 CONTINUEELSEDO 40, J = 1, Nc IF( ( X( JX ).NE.ZERO ).OR.( Y( JY ).NE.ZERO ) )THENTEMP1 = ALPHA*DCONJG( Y( JY ) )TEMP2 = DCONJG( ALPHA*X( JX ) )IX = KXIY = KYDO 30, I = 1, J - 1A( I, J ) = A( I, J ) + X( IX )*TEMP1$ + Y( IY )*TEMP2IX = IX + INCXIY = IY + INCY30 CONTINUEA( J, J ) = DBLE( A( J, J ) ) +$ DBLE( X( JX )*TEMP1 + Y( JY )*TEMP2 )c ELSEc A( J, J ) = DBLE( A( J, J ) )c END IFJX = JX + INCXJY = JY + INCY40 CONTINUEEND IFELSE** Form A when A is stored in the lower triangle.*IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THENDO 60, J = 1, Nc IF( ( X( J ).NE.ZERO ).OR.( Y( J ).NE.ZERO ) )THENTEMP1 = ALPHA*DCONJG( Y( J ) )TEMP2 = DCONJG( ALPHA*X( J ) )A( J, J ) = DBLE( A( J, J ) ) +$ DBLE( X( J )*TEMP1 + Y( J )*TEMP2 )DO 50, I = J + 1, NA( I, J ) = A( I, J ) + X( I )*TEMP1 + Y( I )*TEMP250 CONTINUEc ELSEc A( J, J ) = DBLE( A( J, J ) )c END IF60 CONTINUEELSEDO 80, J = 1, Nc IF( ( X( JX ).NE.ZERO ).OR.( Y( JY ).NE.ZERO ) )THENTEMP1 = ALPHA*DCONJG( Y( JY ) )TEMP2 = DCONJG( ALPHA*X( JX ) )A( J, J ) = DBLE( A( J, J ) ) +$ DBLE( X( JX )*TEMP1 + Y( JY )*TEMP2 )IX = JXIY = JYDO 70, I = J + 1, NIX = IX + INCXIY = IY + INCYA( I, J ) = A( I, J ) + X( IX )*TEMP1$ + Y( IY )*TEMP270 CONTINUEc ELSEc A( J, J ) = DBLE( A( J, J ) )c END IFJX = JX + INCXJY = JY + INCY80 CONTINUEEND IFEND IF*RETURN** End of ZHER2 .*ENDSUBROUTINE ZHER2K( UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB, BETA,$ C, LDC )* .. Scalar Arguments ..CHARACTER TRANS, UPLOINTEGER K, LDA, LDB, LDC, NDOUBLE PRECISION BETACOMPLEX*16 ALPHA* ..* .. Array Arguments ..COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * )* ..** Purpose* =======** ZHER2K performs one of the hermitian rank 2k operations** C := alpha*A*conjg( B' ) + conjg( alpha )*B*conjg( A' ) + beta*C,** or** C := alpha*conjg( A' )*B + conjg( alpha )*conjg( B' )*A + beta*C,** where alpha and beta are scalars with beta real, C is an n by n* hermitian matrix and A and B are n by k matrices in the first case* and k by n matrices in the second case.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the upper or lower* triangular part of the array C is to be referenced as* follows:** UPLO = 'U' or 'u' Only the upper triangular part of C* is to be referenced.** UPLO = 'L' or 'l' Only the lower triangular part of C* is to be referenced.** Unchanged on exit.** TRANS - CHARACTER*1.* On entry, TRANS specifies the operation to be performed as* follows:** TRANS = 'N' or 'n' C := alpha*A*conjg( B' ) +* conjg( alpha )*B*conjg( A' ) +* beta*C.** TRANS = 'C' or 'c' C := alpha*conjg( A' )*B +* conjg( alpha )*conjg( B' )*A +* beta*C.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix C. N must be* at least zero.* Unchanged on exit.** K - INTEGER.* On entry with TRANS = 'N' or 'n', K specifies the number* of columns of the matrices A and B, and on entry with* TRANS = 'C' or 'c', K specifies the number of rows of the* matrices A and B. K must be at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, ka ), where ka is* k when TRANS = 'N' or 'n', and is n otherwise.* Before entry with TRANS = 'N' or 'n', the leading n by k* part of the array A must contain the matrix A, otherwise* the leading k by n part of the array A must contain the* matrix A.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. When TRANS = 'N' or 'n'* then LDA must be at least max( 1, n ), otherwise LDA must* be at least max( 1, k ).* Unchanged on exit.** B - COMPLEX*16 array of DIMENSION ( LDB, kb ), where kb is* k when TRANS = 'N' or 'n', and is n otherwise.* Before entry with TRANS = 'N' or 'n', the leading n by k* part of the array B must contain the matrix B, otherwise* the leading k by n part of the array B must contain the* matrix B.* Unchanged on exit.** LDB - INTEGER.* On entry, LDB specifies the first dimension of B as declared* in the calling (sub) program. When TRANS = 'N' or 'n'* then LDB must be at least max( 1, n ), otherwise LDB must* be at least max( 1, k ).* Unchanged on exit.** BETA - DOUBLE PRECISION .* On entry, BETA specifies the scalar beta.* Unchanged on exit.** C - COMPLEX*16 array of DIMENSION ( LDC, n ).* Before entry with UPLO = 'U' or 'u', the leading n by n* upper triangular part of the array C must contain the upper* triangular part of the hermitian matrix and the strictly* lower triangular part of C is not referenced. On exit, the* upper triangular part of the array C is overwritten by the* upper triangular part of the updated matrix.* Before entry with UPLO = 'L' or 'l', the leading n by n* lower triangular part of the array C must contain the lower* triangular part of the hermitian matrix and the strictly* upper triangular part of C is not referenced. On exit, the* lower triangular part of the array C is overwritten by the* lower triangular part of the updated matrix.* Note that the imaginary parts of the diagonal elements need* not be set, they are assumed to be zero, and on exit they* are set to zero.** LDC - INTEGER.* On entry, LDC specifies the first dimension of C as declared* in the calling (sub) program. LDC must be at least* max( 1, n ).* Unchanged on exit.*** Level 3 Blas routine.** -- Written on 8-February-1989.* Jack Dongarra, Argonne National Laboratory.* Iain Duff, AERE Harwell.* Jeremy Du Croz, Numerical Algorithms Group Ltd.* Sven Hammarling, Numerical Algorithms Group Ltd.** -- Modified 8-Nov-93 to set C(J,J) to DBLE( C(J,J) ) when BETA = 1.* Ed Anderson, Cray Research Inc.*** .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* ..* .. External Subroutines ..EXTERNAL XERBLA* ..* .. Intrinsic Functions ..INTRINSIC DBLE, DCONJG, MAX* ..* .. Local Scalars ..LOGICAL UPPERINTEGER I, INFO, J, L, NROWACOMPLEX*16 TEMP1, TEMP2* ..* .. Parameters ..DOUBLE PRECISION ONEPARAMETER ( ONE = 1.0D+0 )COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* ..* .. Executable Statements ..** Test the input parameters.*IF( LSAME( TRANS, 'N' ) ) THENNROWA = NELSENROWA = KEND IFUPPER = LSAME( UPLO, 'U' )*INFO = 0IF( ( .NOT.UPPER ) .AND. ( .NOT.LSAME( UPLO, 'L' ) ) ) THENINFO = 1ELSE IF( ( .NOT.LSAME( TRANS, 'N' ) ) .AND.$ ( .NOT.LSAME( TRANS, 'C' ) ) ) THENINFO = 2ELSE IF( N.LT.0 ) THENINFO = 3ELSE IF( K.LT.0 ) THENINFO = 4ELSE IF( LDA.LT.MAX( 1, NROWA ) ) THENINFO = 7ELSE IF( LDB.LT.MAX( 1, NROWA ) ) THENINFO = 9ELSE IF( LDC.LT.MAX( 1, N ) ) THENINFO = 12END IFIF( INFO.NE.0 ) THENCALL XERBLA( 'ZHER2K', INFO )RETURNEND IF** Quick return if possible.*IF( ( N.EQ.0 ) .OR. ( ( ( ALPHA.EQ.ZERO ) .OR. ( K.EQ.0 ) ) .AND.$ ( BETA.EQ.ONE ) ) )RETURN** And when alpha.eq.zero.*IF( ALPHA.EQ.ZERO ) THENIF( UPPER ) THENIF( BETA.EQ.DBLE( ZERO ) ) THENDO 20 J = 1, NDO 10 I = 1, JC( I, J ) = ZERO10 CONTINUE20 CONTINUEELSEDO 40 J = 1, NDO 30 I = 1, J - 1C( I, J ) = BETA*C( I, J )30 CONTINUEC( J, J ) = BETA*DBLE( C( J, J ) )40 CONTINUEEND IFELSEIF( BETA.EQ.DBLE( ZERO ) ) THENDO 60 J = 1, NDO 50 I = J, NC( I, J ) = ZERO50 CONTINUE60 CONTINUEELSEDO 80 J = 1, NC( J, J ) = BETA*DBLE( C( J, J ) )DO 70 I = J + 1, NC( I, J ) = BETA*C( I, J )70 CONTINUE80 CONTINUEEND IFEND IFRETURNEND IF** Start the operations.*IF( LSAME( TRANS, 'N' ) ) THEN** Form C := alpha*A*conjg( B' ) + conjg( alpha )*B*conjg( A' ) +* C.*IF( UPPER ) THENDO 130 J = 1, NIF( BETA.EQ.DBLE( ZERO ) ) THENDO 90 I = 1, JC( I, J ) = ZERO90 CONTINUEELSE IF( BETA.NE.ONE ) THENDO 100 I = 1, J - 1C( I, J ) = BETA*C( I, J )100 CONTINUEC( J, J ) = BETA*DBLE( C( J, J ) )ELSEC( J, J ) = DBLE( C( J, J ) )END IFDO 120 L = 1, Kc IF( ( A( J, L ).NE.ZERO ) .OR. ( B( J, L ).NE.ZERO ) )c $ THENTEMP1 = ALPHA*DCONJG( B( J, L ) )TEMP2 = DCONJG( ALPHA*A( J, L ) )DO 110 I = 1, J - 1C( I, J ) = C( I, J ) + A( I, L )*TEMP1 +$ B( I, L )*TEMP2110 CONTINUEC( J, J ) = DBLE( C( J, J ) ) +$ DBLE( A( J, L )*TEMP1+B( J, L )*TEMP2 )c END IF120 CONTINUE130 CONTINUEELSEDO 180 J = 1, NIF( BETA.EQ.DBLE( ZERO ) ) THENDO 140 I = J, NC( I, J ) = ZERO140 CONTINUEELSE IF( BETA.NE.ONE ) THENDO 150 I = J + 1, NC( I, J ) = BETA*C( I, J )150 CONTINUEC( J, J ) = BETA*DBLE( C( J, J ) )ELSEC( J, J ) = DBLE( C( J, J ) )END IFDO 170 L = 1, Kc IF( ( A( J, L ).NE.ZERO ) .OR. ( B( J, L ).NE.ZERO ) )c $ THENTEMP1 = ALPHA*DCONJG( B( J, L ) )TEMP2 = DCONJG( ALPHA*A( J, L ) )DO 160 I = J + 1, NC( I, J ) = C( I, J ) + A( I, L )*TEMP1 +$ B( I, L )*TEMP2160 CONTINUEC( J, J ) = DBLE( C( J, J ) ) +$ DBLE( A( J, L )*TEMP1+B( J, L )*TEMP2 )c END IF170 CONTINUE180 CONTINUEEND IFELSE** Form C := alpha*conjg( A' )*B + conjg( alpha )*conjg( B' )*A +* C.*IF( UPPER ) THENDO 210 J = 1, NDO 200 I = 1, JTEMP1 = ZEROTEMP2 = ZERODO 190 L = 1, KTEMP1 = TEMP1 + DCONJG( A( L, I ) )*B( L, J )TEMP2 = TEMP2 + DCONJG( B( L, I ) )*A( L, J )190 CONTINUEIF( I.EQ.J ) THENIF( BETA.EQ.DBLE( ZERO ) ) THENC( J, J ) = DBLE( ALPHA*TEMP1+DCONJG( ALPHA )*$ TEMP2 )ELSEC( J, J ) = BETA*DBLE( C( J, J ) ) +$ DBLE( ALPHA*TEMP1+DCONJG( ALPHA )*$ TEMP2 )END IFELSEIF( BETA.EQ.DBLE( ZERO ) ) THENC( I, J ) = ALPHA*TEMP1 + DCONJG( ALPHA )*TEMP2ELSEC( I, J ) = BETA*C( I, J ) + ALPHA*TEMP1 +$ DCONJG( ALPHA )*TEMP2END IFEND IF200 CONTINUE210 CONTINUEELSEDO 240 J = 1, NDO 230 I = J, NTEMP1 = ZEROTEMP2 = ZERODO 220 L = 1, KTEMP1 = TEMP1 + DCONJG( A( L, I ) )*B( L, J )TEMP2 = TEMP2 + DCONJG( B( L, I ) )*A( L, J )220 CONTINUEIF( I.EQ.J ) THENIF( BETA.EQ.DBLE( ZERO ) ) THENC( J, J ) = DBLE( ALPHA*TEMP1+DCONJG( ALPHA )*$ TEMP2 )ELSEC( J, J ) = BETA*DBLE( C( J, J ) ) +$ DBLE( ALPHA*TEMP1+DCONJG( ALPHA )*$ TEMP2 )END IFELSEIF( BETA.EQ.DBLE( ZERO ) ) THENC( I, J ) = ALPHA*TEMP1 + DCONJG( ALPHA )*TEMP2ELSEC( I, J ) = BETA*C( I, J ) + ALPHA*TEMP1 +$ DCONJG( ALPHA )*TEMP2END IFEND IF230 CONTINUE240 CONTINUEEND IFEND IF*RETURN** End of ZHER2K.*ENDsubroutine zscal(n,za,zx,incx)cc scales a vector by a constant.c jack dongarra, 3/11/78.c modified 3/93 to return if incx .le. 0.c modified 12/3/93, array(1) declarations changed to array(*)cdouble complex za,zx(*)integer i,incx,ix,ncif( n.le.0 .or. incx.le.0 )returnif(incx.eq.1)go to 20cc code for increment not equal to 1cix = 1do 10 i = 1,nzx(ix) = za*zx(ix)ix = ix + incx10 continuereturncc code for increment equal to 1c20 do 30 i = 1,nzx(i) = za*zx(i)30 continuereturnendsubroutine zswap (n,zx,incx,zy,incy)cc interchanges two vectors.c jack dongarra, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)cdouble complex zx(*),zy(*),ztempinteger i,incx,incy,ix,iy,ncif(n.le.0)returnif(incx.eq.1.and.incy.eq.1)go to 20cc code for unequal increments or equal increments not equalc to 1cix = 1iy = 1if(incx.lt.0)ix = (-n+1)*incx + 1if(incy.lt.0)iy = (-n+1)*incy + 1do 10 i = 1,nztemp = zx(ix)zx(ix) = zy(iy)zy(iy) = ztempix = ix + incxiy = iy + incy10 continuereturncc code for both increments equal to 120 do 30 i = 1,nztemp = zx(i)zx(i) = zy(i)zy(i) = ztemp30 continuereturnendSUBROUTINE ZTRMM ( SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA,$ B, LDB )* .. Scalar Arguments ..CHARACTER*1 SIDE, UPLO, TRANSA, DIAGINTEGER M, N, LDA, LDBCOMPLEX*16 ALPHA* .. Array Arguments ..COMPLEX*16 A( LDA, * ), B( LDB, * )* ..** Purpose* =======** ZTRMM performs one of the matrix-matrix operations** B := alpha*op( A )*B, or B := alpha*B*op( A )** where alpha is a scalar, B is an m by n matrix, A is a unit, or* non-unit, upper or lower triangular matrix and op( A ) is one of** op( A ) = A or op( A ) = A' or op( A ) = conjg( A' ).** Parameters* ==========** SIDE - CHARACTER*1.* On entry, SIDE specifies whether op( A ) multiplies B from* the left or right as follows:** SIDE = 'L' or 'l' B := alpha*op( A )*B.** SIDE = 'R' or 'r' B := alpha*B*op( A ).** Unchanged on exit.** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the matrix A is an upper or* lower triangular matrix as follows:** UPLO = 'U' or 'u' A is an upper triangular matrix.** UPLO = 'L' or 'l' A is a lower triangular matrix.** Unchanged on exit.** TRANSA - CHARACTER*1.* On entry, TRANSA specifies the form of op( A ) to be used in* the matrix multiplication as follows:** TRANSA = 'N' or 'n' op( A ) = A.** TRANSA = 'T' or 't' op( A ) = A'.** TRANSA = 'C' or 'c' op( A ) = conjg( A' ).** Unchanged on exit.** DIAG - CHARACTER*1.* On entry, DIAG specifies whether or not A is unit triangular* as follows:** DIAG = 'U' or 'u' A is assumed to be unit triangular.** DIAG = 'N' or 'n' A is not assumed to be unit* triangular.** Unchanged on exit.** M - INTEGER.* On entry, M specifies the number of rows of B. M must be at* least zero.* Unchanged on exit.** N - INTEGER.* On entry, N specifies the number of columns of B. N must be* at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha. When alpha is* zero then A is not referenced and B need not be set before* entry.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, k ), where k is m* when SIDE = 'L' or 'l' and is n when SIDE = 'R' or 'r'.* Before entry with UPLO = 'U' or 'u', the leading k by k* upper triangular part of the array A must contain the upper* triangular matrix and the strictly lower triangular part of* A is not referenced.* Before entry with UPLO = 'L' or 'l', the leading k by k* lower triangular part of the array A must contain the lower* triangular matrix and the strictly upper triangular part of* A is not referenced.* Note that when DIAG = 'U' or 'u', the diagonal elements of* A are not referenced either, but are assumed to be unity.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. When SIDE = 'L' or 'l' then* LDA must be at least max( 1, m ), when SIDE = 'R' or 'r'* then LDA must be at least max( 1, n ).* Unchanged on exit.** B - COMPLEX*16 array of DIMENSION ( LDB, n ).* Before entry, the leading m by n part of the array B must* contain the matrix B, and on exit is overwritten by the* transformed matrix.** LDB - INTEGER.* On entry, LDB specifies the first dimension of B as declared* in the calling (sub) program. LDB must be at least* max( 1, m ).* Unchanged on exit.*** Level 3 Blas routine.** -- Written on 8-February-1989.* Jack Dongarra, Argonne National Laboratory.* Iain Duff, AERE Harwell.* Jeremy Du Croz, Numerical Algorithms Group Ltd.* Sven Hammarling, Numerical Algorithms Group Ltd.*** .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX* .. Local Scalars ..LOGICAL LSIDE, NOCONJ, NOUNIT, UPPERINTEGER I, INFO, J, K, NROWACOMPLEX*16 TEMP* .. Parameters ..COMPLEX*16 ONEPARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* ..* .. Executable Statements ..** Test the input parameters.*LSIDE = LSAME( SIDE , 'L' )IF( LSIDE )THENNROWA = MELSENROWA = NEND IFNOCONJ = LSAME( TRANSA, 'T' )NOUNIT = LSAME( DIAG , 'N' )UPPER = LSAME( UPLO , 'U' )*INFO = 0IF( ( .NOT.LSIDE ).AND.$ ( .NOT.LSAME( SIDE , 'R' ) ) )THENINFO = 1ELSE IF( ( .NOT.UPPER ).AND.$ ( .NOT.LSAME( UPLO , 'L' ) ) )THENINFO = 2ELSE IF( ( .NOT.LSAME( TRANSA, 'N' ) ).AND.$ ( .NOT.LSAME( TRANSA, 'T' ) ).AND.$ ( .NOT.LSAME( TRANSA, 'C' ) ) )THENINFO = 3ELSE IF( ( .NOT.LSAME( DIAG , 'U' ) ).AND.$ ( .NOT.LSAME( DIAG , 'N' ) ) )THENINFO = 4ELSE IF( M .LT.0 )THENINFO = 5ELSE IF( N .LT.0 )THENINFO = 6ELSE IF( LDA.LT.MAX( 1, NROWA ) )THENINFO = 9ELSE IF( LDB.LT.MAX( 1, M ) )THENINFO = 11END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZTRMM ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN** And when alpha.eq.zero.*IF( ALPHA.EQ.ZERO )THENDO 20, J = 1, NDO 10, I = 1, MB( I, J ) = ZERO10 CONTINUE20 CONTINUERETURNEND IF** Start the operations.*IF( LSIDE )THENIF( LSAME( TRANSA, 'N' ) )THEN** Form B := alpha*A*B.*IF( UPPER )THENDO 50, J = 1, NDO 40, K = 1, Mc IF( B( K, J ).NE.ZERO )THENTEMP = ALPHA*B( K, J )DO 30, I = 1, K - 1B( I, J ) = B( I, J ) + TEMP*A( I, K )30 CONTINUEIF( NOUNIT )$ TEMP = TEMP*A( K, K )B( K, J ) = TEMPc END IF40 CONTINUE50 CONTINUEELSEDO 80, J = 1, NDO 70 K = M, 1, -1c IF( B( K, J ).NE.ZERO )THENTEMP = ALPHA*B( K, J )B( K, J ) = TEMPIF( NOUNIT )$ B( K, J ) = B( K, J )*A( K, K )DO 60, I = K + 1, MB( I, J ) = B( I, J ) + TEMP*A( I, K )60 CONTINUEc END IF70 CONTINUE80 CONTINUEEND IFELSE** Form B := alpha*A'*B or B := alpha*conjg( A' )*B.*IF( UPPER )THENDO 120, J = 1, NDO 110, I = M, 1, -1TEMP = B( I, J )IF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*A( I, I )DO 90, K = 1, I - 1TEMP = TEMP + A( K, I )*B( K, J )90 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( A( I, I ) )DO 100, K = 1, I - 1TEMP = TEMP + DCONJG( A( K, I ) )*B( K, J )100 CONTINUEEND IFB( I, J ) = ALPHA*TEMP110 CONTINUE120 CONTINUEELSEDO 160, J = 1, NDO 150, I = 1, MTEMP = B( I, J )IF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*A( I, I )DO 130, K = I + 1, MTEMP = TEMP + A( K, I )*B( K, J )130 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( A( I, I ) )DO 140, K = I + 1, MTEMP = TEMP + DCONJG( A( K, I ) )*B( K, J )140 CONTINUEEND IFB( I, J ) = ALPHA*TEMP150 CONTINUE160 CONTINUEEND IFEND IFELSEIF( LSAME( TRANSA, 'N' ) )THEN** Form B := alpha*B*A.*IF( UPPER )THENDO 200, J = N, 1, -1TEMP = ALPHAIF( NOUNIT )$ TEMP = TEMP*A( J, J )DO 170, I = 1, MB( I, J ) = TEMP*B( I, J )170 CONTINUEDO 190, K = 1, J - 1c IF( A( K, J ).NE.ZERO )THENTEMP = ALPHA*A( K, J )DO 180, I = 1, MB( I, J ) = B( I, J ) + TEMP*B( I, K )180 CONTINUEc END IF190 CONTINUE200 CONTINUEELSEDO 240, J = 1, NTEMP = ALPHAIF( NOUNIT )$ TEMP = TEMP*A( J, J )DO 210, I = 1, MB( I, J ) = TEMP*B( I, J )210 CONTINUEDO 230, K = J + 1, Nc IF( A( K, J ).NE.ZERO )THENTEMP = ALPHA*A( K, J )DO 220, I = 1, MB( I, J ) = B( I, J ) + TEMP*B( I, K )220 CONTINUEc END IF230 CONTINUE240 CONTINUEEND IFELSE** Form B := alpha*B*A' or B := alpha*B*conjg( A' ).*IF( UPPER )THENDO 280, K = 1, NDO 260, J = 1, K - 1IF( A( J, K ).NE.ZERO )THENIF( NOCONJ )THENTEMP = ALPHA*A( J, K )ELSETEMP = ALPHA*DCONJG( A( J, K ) )END IFDO 250, I = 1, MB( I, J ) = B( I, J ) + TEMP*B( I, K )250 CONTINUEEND IF260 CONTINUETEMP = ALPHAIF( NOUNIT )THENIF( NOCONJ )THENTEMP = TEMP*A( K, K )ELSETEMP = TEMP*DCONJG( A( K, K ) )END IFEND IFIF( TEMP.NE.ONE )THENDO 270, I = 1, MB( I, K ) = TEMP*B( I, K )270 CONTINUEEND IF280 CONTINUEELSEDO 320, K = N, 1, -1DO 300, J = K + 1, Nc IF( A( J, K ).NE.ZERO )THENIF( NOCONJ )THENTEMP = ALPHA*A( J, K )ELSETEMP = ALPHA*DCONJG( A( J, K ) )END IFDO 290, I = 1, MB( I, J ) = B( I, J ) + TEMP*B( I, K )290 CONTINUEc END IF300 CONTINUETEMP = ALPHAIF( NOUNIT )THENIF( NOCONJ )THENTEMP = TEMP*A( K, K )ELSETEMP = TEMP*DCONJG( A( K, K ) )END IFEND IFIF( TEMP.NE.ONE )THENDO 310, I = 1, MB( I, K ) = TEMP*B( I, K )310 CONTINUEEND IF320 CONTINUEEND IFEND IFEND IF*RETURN** End of ZTRMM .*ENDSUBROUTINE ZTRMV ( UPLO, TRANS, DIAG, N, A, LDA, X, INCX )* .. Scalar Arguments ..INTEGER INCX, LDA, NCHARACTER*1 DIAG, TRANS, UPLO* .. Array Arguments ..COMPLEX*16 A( LDA, * ), X( * )* ..** Purpose* =======** ZTRMV performs one of the matrix-vector operations** x := A*x, or x := A'*x, or x := conjg( A' )*x,** where x is an n element vector and A is an n by n unit, or non-unit,* upper or lower triangular matrix.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the matrix is an upper or* lower triangular matrix as follows:** UPLO = 'U' or 'u' A is an upper triangular matrix.** UPLO = 'L' or 'l' A is a lower triangular matrix.** Unchanged on exit.** TRANS - CHARACTER*1.* On entry, TRANS specifies the operation to be performed as* follows:** TRANS = 'N' or 'n' x := A*x.** TRANS = 'T' or 't' x := A'*x.** TRANS = 'C' or 'c' x := conjg( A' )*x.** Unchanged on exit.** DIAG - CHARACTER*1.* On entry, DIAG specifies whether or not A is unit* triangular as follows:** DIAG = 'U' or 'u' A is assumed to be unit triangular.** DIAG = 'N' or 'n' A is not assumed to be unit* triangular.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix A.* N must be at least zero.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, n ).* Before entry with UPLO = 'U' or 'u', the leading n by n* upper triangular part of the array A must contain the upper* triangular matrix and the strictly lower triangular part of* A is not referenced.* Before entry with UPLO = 'L' or 'l', the leading n by n* lower triangular part of the array A must contain the lower* triangular matrix and the strictly upper triangular part of* A is not referenced.* Note that when DIAG = 'U' or 'u', the diagonal elements of* A are not referenced either, but are assumed to be unity.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. LDA must be at least* max( 1, n ).* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the n* element vector x. On exit, X is overwritten with the* tranformed vector x.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMPINTEGER I, INFO, IX, J, JX, KXLOGICAL NOCONJ, NOUNIT* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( UPLO , 'U' ).AND.$ .NOT.LSAME( UPLO , 'L' ) )THENINFO = 1ELSE IF( .NOT.LSAME( TRANS, 'N' ).AND.$ .NOT.LSAME( TRANS, 'T' ).AND.$ .NOT.LSAME( TRANS, 'C' ) )THENINFO = 2ELSE IF( .NOT.LSAME( DIAG , 'U' ).AND.$ .NOT.LSAME( DIAG , 'N' ) )THENINFO = 3ELSE IF( N.LT.0 )THENINFO = 4ELSE IF( LDA.LT.MAX( 1, N ) )THENINFO = 6ELSE IF( INCX.EQ.0 )THENINFO = 8END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZTRMV ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN*NOCONJ = LSAME( TRANS, 'T' )NOUNIT = LSAME( DIAG , 'N' )** Set up the start point in X if the increment is not unity. This* will be ( N - 1 )*INCX too small for descending loops.*IF( INCX.LE.0 )THENKX = 1 - ( N - 1 )*INCXELSE IF( INCX.NE.1 )THENKX = 1END IF** Start the operations. In this version the elements of A are* accessed sequentially with one pass through A.*IF( LSAME( TRANS, 'N' ) )THEN** Form x := A*x.*IF( LSAME( UPLO, 'U' ) )THENIF( INCX.EQ.1 )THENDO 20, J = 1, Nc IF( X( J ).NE.ZERO )THENTEMP = X( J )DO 10, I = 1, J - 1X( I ) = X( I ) + TEMP*A( I, J )10 CONTINUEIF( NOUNIT )$ X( J ) = X( J )*A( J, J )c END IF20 CONTINUEELSEJX = KXDO 40, J = 1, Nc IF( X( JX ).NE.ZERO )THENTEMP = X( JX )IX = KXDO 30, I = 1, J - 1X( IX ) = X( IX ) + TEMP*A( I, J )IX = IX + INCX30 CONTINUEIF( NOUNIT )$ X( JX ) = X( JX )*A( J, J )c END IFJX = JX + INCX40 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 60, J = N, 1, -1c IF( X( J ).NE.ZERO )THENTEMP = X( J )DO 50, I = N, J + 1, -1X( I ) = X( I ) + TEMP*A( I, J )50 CONTINUEIF( NOUNIT )$ X( J ) = X( J )*A( J, J )c END IF60 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 80, J = N, 1, -1c IF( X( JX ).NE.ZERO )THENTEMP = X( JX )IX = KXDO 70, I = N, J + 1, -1X( IX ) = X( IX ) + TEMP*A( I, J )IX = IX - INCX70 CONTINUEIF( NOUNIT )$ X( JX ) = X( JX )*A( J, J )c END IFJX = JX - INCX80 CONTINUEEND IFEND IFELSE** Form x := A'*x or x := conjg( A' )*x.*IF( LSAME( UPLO, 'U' ) )THENIF( INCX.EQ.1 )THENDO 110, J = N, 1, -1TEMP = X( J )IF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*A( J, J )DO 90, I = J - 1, 1, -1TEMP = TEMP + A( I, J )*X( I )90 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( A( J, J ) )DO 100, I = J - 1, 1, -1TEMP = TEMP + DCONJG( A( I, J ) )*X( I )100 CONTINUEEND IFX( J ) = TEMP110 CONTINUEELSEJX = KX + ( N - 1 )*INCXDO 140, J = N, 1, -1TEMP = X( JX )IX = JXIF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*A( J, J )DO 120, I = J - 1, 1, -1IX = IX - INCXTEMP = TEMP + A( I, J )*X( IX )120 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( A( J, J ) )DO 130, I = J - 1, 1, -1IX = IX - INCXTEMP = TEMP + DCONJG( A( I, J ) )*X( IX )130 CONTINUEEND IFX( JX ) = TEMPJX = JX - INCX140 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 170, J = 1, NTEMP = X( J )IF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*A( J, J )DO 150, I = J + 1, NTEMP = TEMP + A( I, J )*X( I )150 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( A( J, J ) )DO 160, I = J + 1, NTEMP = TEMP + DCONJG( A( I, J ) )*X( I )160 CONTINUEEND IFX( J ) = TEMP170 CONTINUEELSEJX = KXDO 200, J = 1, NTEMP = X( JX )IX = JXIF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*A( J, J )DO 180, I = J + 1, NIX = IX + INCXTEMP = TEMP + A( I, J )*X( IX )180 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( A( J, J ) )DO 190, I = J + 1, NIX = IX + INCXTEMP = TEMP + DCONJG( A( I, J ) )*X( IX )190 CONTINUEEND IFX( JX ) = TEMPJX = JX + INCX200 CONTINUEEND IFEND IFEND IF*RETURN** End of ZTRMV .*ENDSUBROUTINE ZTRSM ( SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA,$ B, LDB )* .. Scalar Arguments ..CHARACTER*1 SIDE, UPLO, TRANSA, DIAGINTEGER M, N, LDA, LDBCOMPLEX*16 ALPHA* .. Array Arguments ..COMPLEX*16 A( LDA, * ), B( LDB, * )* ..** Purpose* =======** ZTRSM solves one of the matrix equations** op( A )*X = alpha*B, or X*op( A ) = alpha*B,** where alpha is a scalar, X and B are m by n matrices, A is a unit, or* non-unit, upper or lower triangular matrix and op( A ) is one of** op( A ) = A or op( A ) = A' or op( A ) = conjg( A' ).** The matrix X is overwritten on B.** Parameters* ==========** SIDE - CHARACTER*1.* On entry, SIDE specifies whether op( A ) appears on the left* or right of X as follows:** SIDE = 'L' or 'l' op( A )*X = alpha*B.** SIDE = 'R' or 'r' X*op( A ) = alpha*B.** Unchanged on exit.** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the matrix A is an upper or* lower triangular matrix as follows:** UPLO = 'U' or 'u' A is an upper triangular matrix.** UPLO = 'L' or 'l' A is a lower triangular matrix.** Unchanged on exit.** TRANSA - CHARACTER*1.* On entry, TRANSA specifies the form of op( A ) to be used in* the matrix multiplication as follows:** TRANSA = 'N' or 'n' op( A ) = A.** TRANSA = 'T' or 't' op( A ) = A'.** TRANSA = 'C' or 'c' op( A ) = conjg( A' ).** Unchanged on exit.** DIAG - CHARACTER*1.* On entry, DIAG specifies whether or not A is unit triangular* as follows:** DIAG = 'U' or 'u' A is assumed to be unit triangular.** DIAG = 'N' or 'n' A is not assumed to be unit* triangular.** Unchanged on exit.** M - INTEGER.* On entry, M specifies the number of rows of B. M must be at* least zero.* Unchanged on exit.** N - INTEGER.* On entry, N specifies the number of columns of B. N must be* at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha. When alpha is* zero then A is not referenced and B need not be set before* entry.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, k ), where k is m* when SIDE = 'L' or 'l' and is n when SIDE = 'R' or 'r'.* Before entry with UPLO = 'U' or 'u', the leading k by k* upper triangular part of the array A must contain the upper* triangular matrix and the strictly lower triangular part of* A is not referenced.* Before entry with UPLO = 'L' or 'l', the leading k by k* lower triangular part of the array A must contain the lower* triangular matrix and the strictly upper triangular part of* A is not referenced.* Note that when DIAG = 'U' or 'u', the diagonal elements of* A are not referenced either, but are assumed to be unity.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. When SIDE = 'L' or 'l' then* LDA must be at least max( 1, m ), when SIDE = 'R' or 'r'* then LDA must be at least max( 1, n ).* Unchanged on exit.** B - COMPLEX*16 array of DIMENSION ( LDB, n ).* Before entry, the leading m by n part of the array B must* contain the right-hand side matrix B, and on exit is* overwritten by the solution matrix X.** LDB - INTEGER.* On entry, LDB specifies the first dimension of B as declared* in the calling (sub) program. LDB must be at least* max( 1, m ).* Unchanged on exit.*** Level 3 Blas routine.** -- Written on 8-February-1989.* Jack Dongarra, Argonne National Laboratory.* Iain Duff, AERE Harwell.* Jeremy Du Croz, Numerical Algorithms Group Ltd.* Sven Hammarling, Numerical Algorithms Group Ltd.*** .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX* .. Local Scalars ..LOGICAL LSIDE, NOCONJ, NOUNIT, UPPERINTEGER I, INFO, J, K, NROWACOMPLEX*16 TEMP* .. Parameters ..COMPLEX*16 ONEPARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* ..* .. Executable Statements ..** Test the input parameters.*LSIDE = LSAME( SIDE , 'L' )IF( LSIDE )THENNROWA = MELSENROWA = NEND IFNOCONJ = LSAME( TRANSA, 'T' )NOUNIT = LSAME( DIAG , 'N' )UPPER = LSAME( UPLO , 'U' )*INFO = 0IF( ( .NOT.LSIDE ).AND.$ ( .NOT.LSAME( SIDE , 'R' ) ) )THENINFO = 1ELSE IF( ( .NOT.UPPER ).AND.$ ( .NOT.LSAME( UPLO , 'L' ) ) )THENINFO = 2ELSE IF( ( .NOT.LSAME( TRANSA, 'N' ) ).AND.$ ( .NOT.LSAME( TRANSA, 'T' ) ).AND.$ ( .NOT.LSAME( TRANSA, 'C' ) ) )THENINFO = 3ELSE IF( ( .NOT.LSAME( DIAG , 'U' ) ).AND.$ ( .NOT.LSAME( DIAG , 'N' ) ) )THENINFO = 4ELSE IF( M .LT.0 )THENINFO = 5ELSE IF( N .LT.0 )THENINFO = 6ELSE IF( LDA.LT.MAX( 1, NROWA ) )THENINFO = 9ELSE IF( LDB.LT.MAX( 1, M ) )THENINFO = 11END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZTRSM ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN** And when alpha.eq.zero.*IF( ALPHA.EQ.ZERO )THENDO 20, J = 1, NDO 10, I = 1, MB( I, J ) = ZERO10 CONTINUE20 CONTINUERETURNEND IF** Start the operations.*IF( LSIDE )THENIF( LSAME( TRANSA, 'N' ) )THEN** Form B := alpha*inv( A )*B.*IF( UPPER )THENDO 60, J = 1, NIF( ALPHA.NE.ONE )THENDO 30, I = 1, MB( I, J ) = ALPHA*B( I, J )30 CONTINUEEND IFDO 50, K = M, 1, -1c IF( B( K, J ).NE.ZERO )THENIF( NOUNIT )$ B( K, J ) = B( K, J )/A( K, K )DO 40, I = 1, K - 1B( I, J ) = B( I, J ) - B( K, J )*A( I, K )40 CONTINUEc END IF50 CONTINUE60 CONTINUEELSEDO 100, J = 1, NIF( ALPHA.NE.ONE )THENDO 70, I = 1, MB( I, J ) = ALPHA*B( I, J )70 CONTINUEEND IFDO 90 K = 1, Mc IF( B( K, J ).NE.ZERO )THENIF( NOUNIT )$ B( K, J ) = B( K, J )/A( K, K )DO 80, I = K + 1, MB( I, J ) = B( I, J ) - B( K, J )*A( I, K )80 CONTINUEc END IF90 CONTINUE100 CONTINUEEND IFELSE** Form B := alpha*inv( A' )*B* or B := alpha*inv( conjg( A' ) )*B.*IF( UPPER )THENDO 140, J = 1, NDO 130, I = 1, MTEMP = ALPHA*B( I, J )IF( NOCONJ )THENDO 110, K = 1, I - 1TEMP = TEMP - A( K, I )*B( K, J )110 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( I, I )ELSEDO 120, K = 1, I - 1TEMP = TEMP - DCONJG( A( K, I ) )*B( K, J )120 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( A( I, I ) )END IFB( I, J ) = TEMP130 CONTINUE140 CONTINUEELSEDO 180, J = 1, NDO 170, I = M, 1, -1TEMP = ALPHA*B( I, J )IF( NOCONJ )THENDO 150, K = I + 1, MTEMP = TEMP - A( K, I )*B( K, J )150 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( I, I )ELSEDO 160, K = I + 1, MTEMP = TEMP - DCONJG( A( K, I ) )*B( K, J )160 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( A( I, I ) )END IFB( I, J ) = TEMP170 CONTINUE180 CONTINUEEND IFEND IFELSEIF( LSAME( TRANSA, 'N' ) )THEN** Form B := alpha*B*inv( A ).*IF( UPPER )THENDO 230, J = 1, NIF( ALPHA.NE.ONE )THENDO 190, I = 1, MB( I, J ) = ALPHA*B( I, J )190 CONTINUEEND IFDO 210, K = 1, J - 1c IF( A( K, J ).NE.ZERO )THENDO 200, I = 1, MB( I, J ) = B( I, J ) - A( K, J )*B( I, K )200 CONTINUEc END IF210 CONTINUEIF( NOUNIT )THENTEMP = ONE/A( J, J )DO 220, I = 1, MB( I, J ) = TEMP*B( I, J )220 CONTINUEEND IF230 CONTINUEELSEDO 280, J = N, 1, -1IF( ALPHA.NE.ONE )THENDO 240, I = 1, MB( I, J ) = ALPHA*B( I, J )240 CONTINUEEND IFDO 260, K = J + 1, Nc IF( A( K, J ).NE.ZERO )THENDO 250, I = 1, MB( I, J ) = B( I, J ) - A( K, J )*B( I, K )250 CONTINUEc END IF260 CONTINUEIF( NOUNIT )THENTEMP = ONE/A( J, J )DO 270, I = 1, MB( I, J ) = TEMP*B( I, J )270 CONTINUEEND IF280 CONTINUEEND IFELSE** Form B := alpha*B*inv( A' )* or B := alpha*B*inv( conjg( A' ) ).*IF( UPPER )THENDO 330, K = N, 1, -1IF( NOUNIT )THENIF( NOCONJ )THENTEMP = ONE/A( K, K )ELSETEMP = ONE/DCONJG( A( K, K ) )END IFDO 290, I = 1, MB( I, K ) = TEMP*B( I, K )290 CONTINUEEND IFDO 310, J = 1, K - 1c IF( A( J, K ).NE.ZERO )THENIF( NOCONJ )THENTEMP = A( J, K )ELSETEMP = DCONJG( A( J, K ) )c END IFDO 300, I = 1, MB( I, J ) = B( I, J ) - TEMP*B( I, K )300 CONTINUEEND IF310 CONTINUEIF( ALPHA.NE.ONE )THENDO 320, I = 1, MB( I, K ) = ALPHA*B( I, K )320 CONTINUEEND IF330 CONTINUEELSEDO 380, K = 1, NIF( NOUNIT )THENIF( NOCONJ )THENTEMP = ONE/A( K, K )ELSETEMP = ONE/DCONJG( A( K, K ) )END IFDO 340, I = 1, MB( I, K ) = TEMP*B( I, K )340 CONTINUEEND IFDO 360, J = K + 1, Nc IF( A( J, K ).NE.ZERO )THENIF( NOCONJ )THENTEMP = A( J, K )ELSETEMP = DCONJG( A( J, K ) )END IFDO 350, I = 1, MB( I, J ) = B( I, J ) - TEMP*B( I, K )350 CONTINUEc END IF360 CONTINUEIF( ALPHA.NE.ONE )THENDO 370, I = 1, MB( I, K ) = ALPHA*B( I, K )370 CONTINUEEND IF380 CONTINUEEND IFEND IFEND IF*RETURN** End of ZTRSM .*ENDSUBROUTINE ZTRSV ( UPLO, TRANS, DIAG, N, A, LDA, X, INCX )* .. Scalar Arguments ..INTEGER INCX, LDA, NCHARACTER*1 DIAG, TRANS, UPLO* .. Array Arguments ..COMPLEX*16 A( LDA, * ), X( * )* ..** Purpose* =======** ZTRSV solves one of the systems of equations** A*x = b, or A'*x = b, or conjg( A' )*x = b,** where b and x are n element vectors and A is an n by n unit, or* non-unit, upper or lower triangular matrix.** No test for singularity or near-singularity is included in this* routine. Such tests must be performed before calling this routine.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the matrix is an upper or* lower triangular matrix as follows:** UPLO = 'U' or 'u' A is an upper triangular matrix.** UPLO = 'L' or 'l' A is a lower triangular matrix.** Unchanged on exit.** TRANS - CHARACTER*1.* On entry, TRANS specifies the equations to be solved as* follows:** TRANS = 'N' or 'n' A*x = b.** TRANS = 'T' or 't' A'*x = b.** TRANS = 'C' or 'c' conjg( A' )*x = b.** Unchanged on exit.** DIAG - CHARACTER*1.* On entry, DIAG specifies whether or not A is unit* triangular as follows:** DIAG = 'U' or 'u' A is assumed to be unit triangular.** DIAG = 'N' or 'n' A is not assumed to be unit* triangular.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix A.* N must be at least zero.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, n ).* Before entry with UPLO = 'U' or 'u', the leading n by n* upper triangular part of the array A must contain the upper* triangular matrix and the strictly lower triangular part of* A is not referenced.* Before entry with UPLO = 'L' or 'l', the leading n by n* lower triangular part of the array A must contain the lower* triangular matrix and the strictly upper triangular part of* A is not referenced.* Note that when DIAG = 'U' or 'u', the diagonal elements of* A are not referenced either, but are assumed to be unity.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. LDA must be at least* max( 1, n ).* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the n* element right-hand side vector b. On exit, X is overwritten* with the solution vector x.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMPINTEGER I, INFO, IX, J, JX, KXLOGICAL NOCONJ, NOUNIT* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( UPLO , 'U' ).AND.$ .NOT.LSAME( UPLO , 'L' ) )THENINFO = 1ELSE IF( .NOT.LSAME( TRANS, 'N' ).AND.$ .NOT.LSAME( TRANS, 'T' ).AND.$ .NOT.LSAME( TRANS, 'C' ) )THENINFO = 2ELSE IF( .NOT.LSAME( DIAG , 'U' ).AND.$ .NOT.LSAME( DIAG , 'N' ) )THENINFO = 3ELSE IF( N.LT.0 )THENINFO = 4ELSE IF( LDA.LT.MAX( 1, N ) )THENINFO = 6ELSE IF( INCX.EQ.0 )THENINFO = 8END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZTRSV ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN*NOCONJ = LSAME( TRANS, 'T' )NOUNIT = LSAME( DIAG , 'N' )** Set up the start point in X if the increment is not unity. This* will be ( N - 1 )*INCX too small for descending loops.*IF( INCX.LE.0 )THENKX = 1 - ( N - 1 )*INCXELSE IF( INCX.NE.1 )THENKX = 1END IF** Start the operations. In this version the elements of A are* accessed sequentially with one pass through A.*IF( LSAME( TRANS, 'N' ) )THEN** Form x := inv( A )*x.*IF( LSAME( UPLO, 'U' ) )THENIF( INCX.EQ.1 )THENDO 20, J = N, 1, -1c IF( X( J ).NE.ZERO )THENIF( NOUNIT )$ X( J ) = X( J )/A( J, J )TEMP = X( J )DO 10, I = J - 1, 1, -1X( I ) = X( I ) - TEMP*A( I, J )10 CONTINUEc END IF20 CONTINUEELSEJX = KX + ( N - 1 )*INCXDO 40, J = N, 1, -1c IF( X( JX ).NE.ZERO )THENIF( NOUNIT )$ X( JX ) = X( JX )/A( J, J )TEMP = X( JX )IX = JXDO 30, I = J - 1, 1, -1IX = IX - INCXX( IX ) = X( IX ) - TEMP*A( I, J )30 CONTINUEc END IFJX = JX - INCX40 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 60, J = 1, Nc IF( X( J ).NE.ZERO )THENIF( NOUNIT )$ X( J ) = X( J )/A( J, J )TEMP = X( J )DO 50, I = J + 1, NX( I ) = X( I ) - TEMP*A( I, J )50 CONTINUEc END IF60 CONTINUEELSEJX = KXDO 80, J = 1, Nc IF( X( JX ).NE.ZERO )THENIF( NOUNIT )$ X( JX ) = X( JX )/A( J, J )TEMP = X( JX )IX = JXDO 70, I = J + 1, NIX = IX + INCXX( IX ) = X( IX ) - TEMP*A( I, J )70 CONTINUEc END IFJX = JX + INCX80 CONTINUEEND IFEND IFELSE** Form x := inv( A' )*x or x := inv( conjg( A' ) )*x.*IF( LSAME( UPLO, 'U' ) )THENIF( INCX.EQ.1 )THENDO 110, J = 1, NTEMP = X( J )IF( NOCONJ )THENDO 90, I = 1, J - 1TEMP = TEMP - A( I, J )*X( I )90 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( J, J )ELSEDO 100, I = 1, J - 1TEMP = TEMP - DCONJG( A( I, J ) )*X( I )100 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( A( J, J ) )END IFX( J ) = TEMP110 CONTINUEELSEJX = KXDO 140, J = 1, NIX = KXTEMP = X( JX )IF( NOCONJ )THENDO 120, I = 1, J - 1TEMP = TEMP - A( I, J )*X( IX )IX = IX + INCX120 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( J, J )ELSEDO 130, I = 1, J - 1TEMP = TEMP - DCONJG( A( I, J ) )*X( IX )IX = IX + INCX130 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( A( J, J ) )END IFX( JX ) = TEMPJX = JX + INCX140 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 170, J = N, 1, -1TEMP = X( J )IF( NOCONJ )THENDO 150, I = N, J + 1, -1TEMP = TEMP - A( I, J )*X( I )150 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( J, J )ELSEDO 160, I = N, J + 1, -1TEMP = TEMP - DCONJG( A( I, J ) )*X( I )160 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( A( J, J ) )END IFX( J ) = TEMP170 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 200, J = N, 1, -1IX = KXTEMP = X( JX )IF( NOCONJ )THENDO 180, I = N, J + 1, -1TEMP = TEMP - A( I, J )*X( IX )IX = IX - INCX180 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( J, J )ELSEDO 190, I = N, J + 1, -1TEMP = TEMP - DCONJG( A( I, J ) )*X( IX )IX = IX - INCX190 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( A( J, J ) )END IFX( JX ) = TEMPJX = JX - INCX200 CONTINUEEND IFEND IFEND IF*RETURN** End of ZTRSV .*ENDsubroutine zdrot (n,zx,incx,zy,incy,c,s)cc applies a plane rotation, where the cos and sin (c and s) arec double precision and the vectors zx and zy are double complex.c jack dongarra, linpack, 3/11/78.cdouble complex zx(1),zy(1),ztempdouble precision c,sinteger i,incx,incy,ix,iy,ncif(n.le.0)returnif(incx.eq.1.and.incy.eq.1)go to 20cc code for unequal increments or equal increments not equalc to 1cix = 1iy = 1if(incx.lt.0)ix = (-n+1)*incx + 1if(incy.lt.0)iy = (-n+1)*incy + 1do 10 i = 1,nztemp = c*zx(ix) + s*zy(iy)zy(iy) = c*zy(iy) - s*zx(ix)zx(ix) = ztempix = ix + incxiy = iy + incy10 continuereturncc code for both increments equal to 1c20 do 30 i = 1,nztemp = c*zx(i) + s*zy(i)zy(i) = c*zy(i) - s*zx(i)zx(i) = ztemp30 continuereturnendSUBROUTINE ZGBMV ( TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX,$ BETA, Y, INCY )* .. Scalar Arguments ..COMPLEX*16 ALPHA, BETAINTEGER INCX, INCY, KL, KU, LDA, M, NCHARACTER*1 TRANS* .. Array Arguments ..COMPLEX*16 A( LDA, * ), X( * ), Y( * )* ..** Purpose* =======** ZGBMV performs one of the matrix-vector operations** y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y, or** y := alpha*conjg( A' )*x + beta*y,** where alpha and beta are scalars, x and y are vectors and A is an* m by n band matrix, with kl sub-diagonals and ku super-diagonals.** Parameters* ==========** TRANS - CHARACTER*1.* On entry, TRANS specifies the operation to be performed as* follows:** TRANS = 'N' or 'n' y := alpha*A*x + beta*y.** TRANS = 'T' or 't' y := alpha*A'*x + beta*y.** TRANS = 'C' or 'c' y := alpha*conjg( A' )*x + beta*y.** Unchanged on exit.** M - INTEGER.* On entry, M specifies the number of rows of the matrix A.* M must be at least zero.* Unchanged on exit.** N - INTEGER.* On entry, N specifies the number of columns of the matrix A.* N must be at least zero.* Unchanged on exit.** KL - INTEGER.* On entry, KL specifies the number of sub-diagonals of the* matrix A. KL must satisfy 0 .le. KL.* Unchanged on exit.** KU - INTEGER.* On entry, KU specifies the number of super-diagonals of the* matrix A. KU must satisfy 0 .le. KU.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, n ).* Before entry, the leading ( kl + ku + 1 ) by n part of the* array A must contain the matrix of coefficients, supplied* column by column, with the leading diagonal of the matrix in* row ( ku + 1 ) of the array, the first super-diagonal* starting at position 2 in row ku, the first sub-diagonal* starting at position 1 in row ( ku + 2 ), and so on.* Elements in the array A that do not correspond to elements* in the band matrix (such as the top left ku by ku triangle)* are not referenced.* The following program segment will transfer a band matrix* from conventional full matrix storage to band storage:** DO 20, J = 1, N* K = KU + 1 - J* DO 10, I = MAX( 1, J - KU ), MIN( M, J + KL )* A( K + I, J ) = matrix( I, J )* 10 CONTINUE* 20 CONTINUE** Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. LDA must be at least* ( kl + ku + 1 ).* Unchanged on exit.** X - COMPLEX*16 array of DIMENSION at least* ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'* and at least* ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.* Before entry, the incremented array X must contain the* vector x.* Unchanged on exit.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.** BETA - COMPLEX*16 .* On entry, BETA specifies the scalar beta. When BETA is* supplied as zero then Y need not be set on input.* Unchanged on exit.** Y - COMPLEX*16 array of DIMENSION at least* ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'* and at least* ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.* Before entry, the incremented array Y must contain the* vector y. On exit, Y is overwritten by the updated vector y.*** INCY - INTEGER.* On entry, INCY specifies the increment for the elements of* Y. INCY must not be zero.* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ONEPARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMPINTEGER I, INFO, IX, IY, J, JX, JY, K, KUP1, KX, KY,$ LENX, LENYLOGICAL NOCONJ* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX, MIN* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( TRANS, 'N' ).AND.$ .NOT.LSAME( TRANS, 'T' ).AND.$ .NOT.LSAME( TRANS, 'C' ) )THENINFO = 1ELSE IF( M.LT.0 )THENINFO = 2ELSE IF( N.LT.0 )THENINFO = 3ELSE IF( KL.LT.0 )THENINFO = 4ELSE IF( KU.LT.0 )THENINFO = 5ELSE IF( LDA.LT.( KL + KU + 1 ) )THENINFO = 8ELSE IF( INCX.EQ.0 )THENINFO = 10ELSE IF( INCY.EQ.0 )THENINFO = 13END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZGBMV ', INFO )RETURNEND IF** Quick return if possible.*IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.$ ( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )$ RETURN*NOCONJ = LSAME( TRANS, 'T' )** Set LENX and LENY, the lengths of the vectors x and y, and set* up the start points in X and Y.*IF( LSAME( TRANS, 'N' ) )THENLENX = NLENY = MELSELENX = MLENY = NEND IFIF( INCX.GT.0 )THENKX = 1ELSEKX = 1 - ( LENX - 1 )*INCXEND IFIF( INCY.GT.0 )THENKY = 1ELSEKY = 1 - ( LENY - 1 )*INCYEND IF** Start the operations. In this version the elements of A are* accessed sequentially with one pass through the band part of A.** First form y := beta*y.*IF( BETA.NE.ONE )THENIF( INCY.EQ.1 )THENIF( BETA.EQ.ZERO )THENDO 10, I = 1, LENYY( I ) = ZERO10 CONTINUEELSEDO 20, I = 1, LENYY( I ) = BETA*Y( I )20 CONTINUEEND IFELSEIY = KYIF( BETA.EQ.ZERO )THENDO 30, I = 1, LENYY( IY ) = ZEROIY = IY + INCY30 CONTINUEELSEDO 40, I = 1, LENYY( IY ) = BETA*Y( IY )IY = IY + INCY40 CONTINUEEND IFEND IFEND IFIF( ALPHA.EQ.ZERO )$ RETURNKUP1 = KU + 1IF( LSAME( TRANS, 'N' ) )THEN** Form y := alpha*A*x + y.*JX = KXIF( INCY.EQ.1 )THENDO 60, J = 1, Nc IF( X( JX ).NE.ZERO )THENTEMP = ALPHA*X( JX )K = KUP1 - JDO 50, I = MAX( 1, J - KU ), MIN( M, J + KL )Y( I ) = Y( I ) + TEMP*A( K + I, J )50 CONTINUEc END IFJX = JX + INCX60 CONTINUEELSEDO 80, J = 1, Nc IF( X( JX ).NE.ZERO )THENTEMP = ALPHA*X( JX )IY = KYK = KUP1 - JDO 70, I = MAX( 1, J - KU ), MIN( M, J + KL )Y( IY ) = Y( IY ) + TEMP*A( K + I, J )IY = IY + INCY70 CONTINUEc END IFJX = JX + INCXIF( J.GT.KU )$ KY = KY + INCY80 CONTINUEEND IFELSE** Form y := alpha*A'*x + y or y := alpha*conjg( A' )*x + y.*JY = KYIF( INCX.EQ.1 )THENDO 110, J = 1, NTEMP = ZEROK = KUP1 - JIF( NOCONJ )THENDO 90, I = MAX( 1, J - KU ), MIN( M, J + KL )TEMP = TEMP + A( K + I, J )*X( I )90 CONTINUEELSEDO 100, I = MAX( 1, J - KU ), MIN( M, J + KL )TEMP = TEMP + DCONJG( A( K + I, J ) )*X( I )100 CONTINUEEND IFY( JY ) = Y( JY ) + ALPHA*TEMPJY = JY + INCY110 CONTINUEELSEDO 140, J = 1, NTEMP = ZEROIX = KXK = KUP1 - JIF( NOCONJ )THENDO 120, I = MAX( 1, J - KU ), MIN( M, J + KL )TEMP = TEMP + A( K + I, J )*X( IX )IX = IX + INCX120 CONTINUEELSEDO 130, I = MAX( 1, J - KU ), MIN( M, J + KL )TEMP = TEMP + DCONJG( A( K + I, J ) )*X( IX )IX = IX + INCX130 CONTINUEEND IFY( JY ) = Y( JY ) + ALPHA*TEMPJY = JY + INCYIF( J.GT.KU )$ KX = KX + INCX140 CONTINUEEND IFEND IF*RETURN** End of ZGBMV .*ENDSUBROUTINE ZGERU ( M, N, ALPHA, X, INCX, Y, INCY, A, LDA )* .. Scalar Arguments ..COMPLEX*16 ALPHAINTEGER INCX, INCY, LDA, M, N* .. Array Arguments ..COMPLEX*16 A( LDA, * ), X( * ), Y( * )* ..** Purpose* =======** ZGERU performs the rank 1 operation** A := alpha*x*y' + A,** where alpha is a scalar, x is an m element vector, y is an n element* vector and A is an m by n matrix.** Parameters* ==========** M - INTEGER.* On entry, M specifies the number of rows of the matrix A.* M must be at least zero.* Unchanged on exit.** N - INTEGER.* On entry, N specifies the number of columns of the matrix A.* N must be at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( m - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the m* element vector x.* Unchanged on exit.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.** Y - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCY ) ).* Before entry, the incremented array Y must contain the n* element vector y.* Unchanged on exit.** INCY - INTEGER.* On entry, INCY specifies the increment for the elements of* Y. INCY must not be zero.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, n ).* Before entry, the leading m by n part of the array A must* contain the matrix of coefficients. On exit, A is* overwritten by the updated matrix.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. LDA must be at least* max( 1, m ).* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMPINTEGER I, INFO, IX, J, JY, KX* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC MAX* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( M.LT.0 )THENINFO = 1ELSE IF( N.LT.0 )THENINFO = 2ELSE IF( INCX.EQ.0 )THENINFO = 5ELSE IF( INCY.EQ.0 )THENINFO = 7ELSE IF( LDA.LT.MAX( 1, M ) )THENINFO = 9END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZGERU ', INFO )RETURNEND IF** Quick return if possible.*IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.( ALPHA.EQ.ZERO ) )$ RETURN** Start the operations. In this version the elements of A are* accessed sequentially with one pass through A.*IF( INCY.GT.0 )THENJY = 1ELSEJY = 1 - ( N - 1 )*INCYEND IFIF( INCX.EQ.1 )THENDO 20, J = 1, Nc IF( Y( JY ).NE.ZERO )THENTEMP = ALPHA*Y( JY )DO 10, I = 1, MA( I, J ) = A( I, J ) + X( I )*TEMP10 CONTINUEc END IFJY = JY + INCY20 CONTINUEELSEIF( INCX.GT.0 )THENKX = 1ELSEKX = 1 - ( M - 1 )*INCXEND IFDO 40, J = 1, Nc IF( Y( JY ).NE.ZERO )THENTEMP = ALPHA*Y( JY )IX = KXDO 30, I = 1, MA( I, J ) = A( I, J ) + X( IX )*TEMPIX = IX + INCX30 CONTINUEc END IFJY = JY + INCY40 CONTINUEEND IF*RETURN** End of ZGERU .*ENDSUBROUTINE ZHBMV ( UPLO, N, K, ALPHA, A, LDA, X, INCX,$ BETA, Y, INCY )* .. Scalar Arguments ..COMPLEX*16 ALPHA, BETAINTEGER INCX, INCY, K, LDA, NCHARACTER*1 UPLO* .. Array Arguments ..COMPLEX*16 A( LDA, * ), X( * ), Y( * )* ..** Purpose* =======** ZHBMV performs the matrix-vector operation** y := alpha*A*x + beta*y,** where alpha and beta are scalars, x and y are n element vectors and* A is an n by n hermitian band matrix, with k super-diagonals.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the upper or lower* triangular part of the band matrix A is being supplied as* follows:** UPLO = 'U' or 'u' The upper triangular part of A is* being supplied.** UPLO = 'L' or 'l' The lower triangular part of A is* being supplied.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix A.* N must be at least zero.* Unchanged on exit.** K - INTEGER.* On entry, K specifies the number of super-diagonals of the* matrix A. K must satisfy 0 .le. K.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, n ).* Before entry with UPLO = 'U' or 'u', the leading ( k + 1 )* by n part of the array A must contain the upper triangular* band part of the hermitian matrix, supplied column by* column, with the leading diagonal of the matrix in row* ( k + 1 ) of the array, the first super-diagonal starting at* position 2 in row k, and so on. The top left k by k triangle* of the array A is not referenced.* The following program segment will transfer the upper* triangular part of a hermitian band matrix from conventional* full matrix storage to band storage:** DO 20, J = 1, N* M = K + 1 - J* DO 10, I = MAX( 1, J - K ), J* A( M + I, J ) = matrix( I, J )* 10 CONTINUE* 20 CONTINUE** Before entry with UPLO = 'L' or 'l', the leading ( k + 1 )* by n part of the array A must contain the lower triangular* band part of the hermitian matrix, supplied column by* column, with the leading diagonal of the matrix in row 1 of* the array, the first sub-diagonal starting at position 1 in* row 2, and so on. The bottom right k by k triangle of the* array A is not referenced.* The following program segment will transfer the lower* triangular part of a hermitian band matrix from conventional* full matrix storage to band storage:** DO 20, J = 1, N* M = 1 - J* DO 10, I = J, MIN( N, J + K )* A( M + I, J ) = matrix( I, J )* 10 CONTINUE* 20 CONTINUE** Note that the imaginary parts of the diagonal elements need* not be set and are assumed to be zero.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. LDA must be at least* ( k + 1 ).* Unchanged on exit.** X - COMPLEX*16 array of DIMENSION at least* ( 1 + ( n - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the* vector x.* Unchanged on exit.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.** BETA - COMPLEX*16 .* On entry, BETA specifies the scalar beta.* Unchanged on exit.** Y - COMPLEX*16 array of DIMENSION at least* ( 1 + ( n - 1 )*abs( INCY ) ).* Before entry, the incremented array Y must contain the* vector y. On exit, Y is overwritten by the updated vector y.** INCY - INTEGER.* On entry, INCY specifies the increment for the elements of* Y. INCY must not be zero.* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ONEPARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMP1, TEMP2INTEGER I, INFO, IX, IY, J, JX, JY, KPLUS1, KX, KY, L* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX, MIN, DBLE* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( UPLO, 'U' ).AND.$ .NOT.LSAME( UPLO, 'L' ) )THENINFO = 1ELSE IF( N.LT.0 )THENINFO = 2ELSE IF( K.LT.0 )THENINFO = 3ELSE IF( LDA.LT.( K + 1 ) )THENINFO = 6ELSE IF( INCX.EQ.0 )THENINFO = 8ELSE IF( INCY.EQ.0 )THENINFO = 11END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZHBMV ', INFO )RETURNEND IF** Quick return if possible.*IF( ( N.EQ.0 ).OR.( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )$ RETURN** Set up the start points in X and Y.*IF( INCX.GT.0 )THENKX = 1ELSEKX = 1 - ( N - 1 )*INCXEND IFIF( INCY.GT.0 )THENKY = 1ELSEKY = 1 - ( N - 1 )*INCYEND IF** Start the operations. In this version the elements of the array A* are accessed sequentially with one pass through A.** First form y := beta*y.*IF( BETA.NE.ONE )THENIF( INCY.EQ.1 )THENIF( BETA.EQ.ZERO )THENDO 10, I = 1, NY( I ) = ZERO10 CONTINUEELSEDO 20, I = 1, NY( I ) = BETA*Y( I )20 CONTINUEEND IFELSEIY = KYIF( BETA.EQ.ZERO )THENDO 30, I = 1, NY( IY ) = ZEROIY = IY + INCY30 CONTINUEELSEDO 40, I = 1, NY( IY ) = BETA*Y( IY )IY = IY + INCY40 CONTINUEEND IFEND IFEND IFIF( ALPHA.EQ.ZERO )$ RETURNIF( LSAME( UPLO, 'U' ) )THEN** Form y when upper triangle of A is stored.*KPLUS1 = K + 1IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THENDO 60, J = 1, NTEMP1 = ALPHA*X( J )TEMP2 = ZEROL = KPLUS1 - JDO 50, I = MAX( 1, J - K ), J - 1Y( I ) = Y( I ) + TEMP1*A( L + I, J )TEMP2 = TEMP2 + DCONJG( A( L + I, J ) )*X( I )50 CONTINUEY( J ) = Y( J ) + TEMP1*DBLE( A( KPLUS1, J ) )$ + ALPHA*TEMP260 CONTINUEELSEJX = KXJY = KYDO 80, J = 1, NTEMP1 = ALPHA*X( JX )TEMP2 = ZEROIX = KXIY = KYL = KPLUS1 - JDO 70, I = MAX( 1, J - K ), J - 1Y( IY ) = Y( IY ) + TEMP1*A( L + I, J )TEMP2 = TEMP2 + DCONJG( A( L + I, J ) )*X( IX )IX = IX + INCXIY = IY + INCY70 CONTINUEY( JY ) = Y( JY ) + TEMP1*DBLE( A( KPLUS1, J ) )$ + ALPHA*TEMP2JX = JX + INCXJY = JY + INCYIF( J.GT.K )THENKX = KX + INCXKY = KY + INCYEND IF80 CONTINUEEND IFELSE** Form y when lower triangle of A is stored.*IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THENDO 100, J = 1, NTEMP1 = ALPHA*X( J )TEMP2 = ZEROY( J ) = Y( J ) + TEMP1*DBLE( A( 1, J ) )L = 1 - JDO 90, I = J + 1, MIN( N, J + K )Y( I ) = Y( I ) + TEMP1*A( L + I, J )TEMP2 = TEMP2 + DCONJG( A( L + I, J ) )*X( I )90 CONTINUEY( J ) = Y( J ) + ALPHA*TEMP2100 CONTINUEELSEJX = KXJY = KYDO 120, J = 1, NTEMP1 = ALPHA*X( JX )TEMP2 = ZEROY( JY ) = Y( JY ) + TEMP1*DBLE( A( 1, J ) )L = 1 - JIX = JXIY = JYDO 110, I = J + 1, MIN( N, J + K )IX = IX + INCXIY = IY + INCYY( IY ) = Y( IY ) + TEMP1*A( L + I, J )TEMP2 = TEMP2 + DCONJG( A( L + I, J ) )*X( IX )110 CONTINUEY( JY ) = Y( JY ) + ALPHA*TEMP2JX = JX + INCXJY = JY + INCY120 CONTINUEEND IFEND IF*RETURN** End of ZHBMV .*ENDSUBROUTINE ZHEMM ( SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB,$ BETA, C, LDC )* .. Scalar Arguments ..CHARACTER*1 SIDE, UPLOINTEGER M, N, LDA, LDB, LDCCOMPLEX*16 ALPHA, BETA* .. Array Arguments ..COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * )* ..** Purpose* =======** ZHEMM performs one of the matrix-matrix operations** C := alpha*A*B + beta*C,** or** C := alpha*B*A + beta*C,** where alpha and beta are scalars, A is an hermitian matrix and B and* C are m by n matrices.** Parameters* ==========** SIDE - CHARACTER*1.* On entry, SIDE specifies whether the hermitian matrix A* appears on the left or right in the operation as follows:** SIDE = 'L' or 'l' C := alpha*A*B + beta*C,** SIDE = 'R' or 'r' C := alpha*B*A + beta*C,** Unchanged on exit.** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the upper or lower* triangular part of the hermitian matrix A is to be* referenced as follows:** UPLO = 'U' or 'u' Only the upper triangular part of the* hermitian matrix is to be referenced.** UPLO = 'L' or 'l' Only the lower triangular part of the* hermitian matrix is to be referenced.** Unchanged on exit.** M - INTEGER.* On entry, M specifies the number of rows of the matrix C.* M must be at least zero.* Unchanged on exit.** N - INTEGER.* On entry, N specifies the number of columns of the matrix C.* N must be at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, ka ), where ka is* m when SIDE = 'L' or 'l' and is n otherwise.* Before entry with SIDE = 'L' or 'l', the m by m part of* the array A must contain the hermitian matrix, such that* when UPLO = 'U' or 'u', the leading m by m upper triangular* part of the array A must contain the upper triangular part* of the hermitian matrix and the strictly lower triangular* part of A is not referenced, and when UPLO = 'L' or 'l',* the leading m by m lower triangular part of the array A* must contain the lower triangular part of the hermitian* matrix and the strictly upper triangular part of A is not* referenced.* Before entry with SIDE = 'R' or 'r', the n by n part of* the array A must contain the hermitian matrix, such that* when UPLO = 'U' or 'u', the leading n by n upper triangular* part of the array A must contain the upper triangular part* of the hermitian matrix and the strictly lower triangular* part of A is not referenced, and when UPLO = 'L' or 'l',* the leading n by n lower triangular part of the array A* must contain the lower triangular part of the hermitian* matrix and the strictly upper triangular part of A is not* referenced.* Note that the imaginary parts of the diagonal elements need* not be set, they are assumed to be zero.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. When SIDE = 'L' or 'l' then* LDA must be at least max( 1, m ), otherwise LDA must be at* least max( 1, n ).* Unchanged on exit.** B - COMPLEX*16 array of DIMENSION ( LDB, n ).* Before entry, the leading m by n part of the array B must* contain the matrix B.* Unchanged on exit.** LDB - INTEGER.* On entry, LDB specifies the first dimension of B as declared* in the calling (sub) program. LDB must be at least* max( 1, m ).* Unchanged on exit.** BETA - COMPLEX*16 .* On entry, BETA specifies the scalar beta. When BETA is* supplied as zero then C need not be set on input.* Unchanged on exit.** C - COMPLEX*16 array of DIMENSION ( LDC, n ).* Before entry, the leading m by n part of the array C must* contain the matrix C, except when beta is zero, in which* case C need not be set on entry.* On exit, the array C is overwritten by the m by n updated* matrix.** LDC - INTEGER.* On entry, LDC specifies the first dimension of C as declared* in the calling (sub) program. LDC must be at least* max( 1, m ).* Unchanged on exit.*** Level 3 Blas routine.** -- Written on 8-February-1989.* Jack Dongarra, Argonne National Laboratory.* Iain Duff, AERE Harwell.* Jeremy Du Croz, Numerical Algorithms Group Ltd.* Sven Hammarling, Numerical Algorithms Group Ltd.*** .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX, DBLE* .. Local Scalars ..LOGICAL UPPERINTEGER I, INFO, J, K, NROWACOMPLEX*16 TEMP1, TEMP2* .. Parameters ..COMPLEX*16 ONEPARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* ..* .. Executable Statements ..** Set NROWA as the number of rows of A.*IF( LSAME( SIDE, 'L' ) )THENNROWA = MELSENROWA = NEND IFUPPER = LSAME( UPLO, 'U' )** Test the input parameters.*INFO = 0IF( ( .NOT.LSAME( SIDE, 'L' ) ).AND.$ ( .NOT.LSAME( SIDE, 'R' ) ) )THENINFO = 1ELSE IF( ( .NOT.UPPER ).AND.$ ( .NOT.LSAME( UPLO, 'L' ) ) )THENINFO = 2ELSE IF( M .LT.0 )THENINFO = 3ELSE IF( N .LT.0 )THENINFO = 4ELSE IF( LDA.LT.MAX( 1, NROWA ) )THENINFO = 7ELSE IF( LDB.LT.MAX( 1, M ) )THENINFO = 9ELSE IF( LDC.LT.MAX( 1, M ) )THENINFO = 12END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZHEMM ', INFO )RETURNEND IF** Quick return if possible.*IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.$ ( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )$ RETURN** And when alpha.eq.zero.*IF( ALPHA.EQ.ZERO )THENIF( BETA.EQ.ZERO )THENDO 20, J = 1, NDO 10, I = 1, MC( I, J ) = ZERO10 CONTINUE20 CONTINUEELSEDO 40, J = 1, NDO 30, I = 1, MC( I, J ) = BETA*C( I, J )30 CONTINUE40 CONTINUEEND IFRETURNEND IF** Start the operations.*IF( LSAME( SIDE, 'L' ) )THEN** Form C := alpha*A*B + beta*C.*IF( UPPER )THENDO 70, J = 1, NDO 60, I = 1, MTEMP1 = ALPHA*B( I, J )TEMP2 = ZERODO 50, K = 1, I - 1C( K, J ) = C( K, J ) + TEMP1*A( K, I )TEMP2 = TEMP2 +$ B( K, J )*DCONJG( A( K, I ) )50 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = TEMP1*DBLE( A( I, I ) ) +$ ALPHA*TEMP2ELSEC( I, J ) = BETA *C( I, J ) +$ TEMP1*DBLE( A( I, I ) ) +$ ALPHA*TEMP2END IF60 CONTINUE70 CONTINUEELSEDO 100, J = 1, NDO 90, I = M, 1, -1TEMP1 = ALPHA*B( I, J )TEMP2 = ZERODO 80, K = I + 1, MC( K, J ) = C( K, J ) + TEMP1*A( K, I )TEMP2 = TEMP2 +$ B( K, J )*DCONJG( A( K, I ) )80 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = TEMP1*DBLE( A( I, I ) ) +$ ALPHA*TEMP2ELSEC( I, J ) = BETA *C( I, J ) +$ TEMP1*DBLE( A( I, I ) ) +$ ALPHA*TEMP2END IF90 CONTINUE100 CONTINUEEND IFELSE** Form C := alpha*B*A + beta*C.*DO 170, J = 1, NTEMP1 = ALPHA*DBLE( A( J, J ) )IF( BETA.EQ.ZERO )THENDO 110, I = 1, MC( I, J ) = TEMP1*B( I, J )110 CONTINUEELSEDO 120, I = 1, MC( I, J ) = BETA*C( I, J ) + TEMP1*B( I, J )120 CONTINUEEND IFDO 140, K = 1, J - 1IF( UPPER )THENTEMP1 = ALPHA*A( K, J )ELSETEMP1 = ALPHA*DCONJG( A( J, K ) )END IFDO 130, I = 1, MC( I, J ) = C( I, J ) + TEMP1*B( I, K )130 CONTINUE140 CONTINUEDO 160, K = J + 1, NIF( UPPER )THENTEMP1 = ALPHA*DCONJG( A( J, K ) )ELSETEMP1 = ALPHA*A( K, J )END IFDO 150, I = 1, MC( I, J ) = C( I, J ) + TEMP1*B( I, K )150 CONTINUE160 CONTINUE170 CONTINUEEND IF*RETURN** End of ZHEMM .*ENDSUBROUTINE ZHER ( UPLO, N, ALPHA, X, INCX, A, LDA )* .. Scalar Arguments ..DOUBLE PRECISION ALPHAINTEGER INCX, LDA, NCHARACTER*1 UPLO* .. Array Arguments ..COMPLEX*16 A( LDA, * ), X( * )* ..** Purpose* =======** ZHER performs the hermitian rank 1 operation** A := alpha*x*conjg( x' ) + A,** where alpha is a real scalar, x is an n element vector and A is an* n by n hermitian matrix.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the upper or lower* triangular part of the array A is to be referenced as* follows:** UPLO = 'U' or 'u' Only the upper triangular part of A* is to be referenced.** UPLO = 'L' or 'l' Only the lower triangular part of A* is to be referenced.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix A.* N must be at least zero.* Unchanged on exit.** ALPHA - DOUBLE PRECISION.* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the n* element vector x.* Unchanged on exit.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, n ).* Before entry with UPLO = 'U' or 'u', the leading n by n* upper triangular part of the array A must contain the upper* triangular part of the hermitian matrix and the strictly* lower triangular part of A is not referenced. On exit, the* upper triangular part of the array A is overwritten by the* upper triangular part of the updated matrix.* Before entry with UPLO = 'L' or 'l', the leading n by n* lower triangular part of the array A must contain the lower* triangular part of the hermitian matrix and the strictly* upper triangular part of A is not referenced. On exit, the* lower triangular part of the array A is overwritten by the* lower triangular part of the updated matrix.* Note that the imaginary parts of the diagonal elements need* not be set, they are assumed to be zero, and on exit they* are set to zero.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. LDA must be at least* max( 1, n ).* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMPINTEGER I, INFO, IX, J, JX, KX* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX, DBLE* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( UPLO, 'U' ).AND.$ .NOT.LSAME( UPLO, 'L' ) )THENINFO = 1ELSE IF( N.LT.0 )THENINFO = 2ELSE IF( INCX.EQ.0 )THENINFO = 5ELSE IF( LDA.LT.MAX( 1, N ) )THENINFO = 7END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZHER ', INFO )RETURNEND IF** Quick return if possible.*IF( ( N.EQ.0 ).OR.( ALPHA.EQ.DBLE( ZERO ) ) )$ RETURN** Set the start point in X if the increment is not unity.*IF( INCX.LE.0 )THENKX = 1 - ( N - 1 )*INCXELSE IF( INCX.NE.1 )THENKX = 1END IF** Start the operations. In this version the elements of A are* accessed sequentially with one pass through the triangular part* of A.*IF( LSAME( UPLO, 'U' ) )THEN** Form A when A is stored in upper triangle.*IF( INCX.EQ.1 )THENDO 20, J = 1, Nc IF( X( J ).NE.ZERO )THENTEMP = ALPHA*DCONJG( X( J ) )DO 10, I = 1, J - 1A( I, J ) = A( I, J ) + X( I )*TEMP10 CONTINUEA( J, J ) = DBLE( A( J, J ) ) + DBLE( X( J )*TEMP )c ELSEc A( J, J ) = DBLE( A( J, J ) )c END IF20 CONTINUEELSEJX = KXDO 40, J = 1, Nc IF( X( JX ).NE.ZERO )THENTEMP = ALPHA*DCONJG( X( JX ) )IX = KXDO 30, I = 1, J - 1A( I, J ) = A( I, J ) + X( IX )*TEMPIX = IX + INCX30 CONTINUEA( J, J ) = DBLE( A( J, J ) ) + DBLE( X( JX )*TEMP )c ELSEc A( J, J ) = DBLE( A( J, J ) )c END IFJX = JX + INCX40 CONTINUEEND IFELSE** Form A when A is stored in lower triangle.*IF( INCX.EQ.1 )THENDO 60, J = 1, Nc IF( X( J ).NE.ZERO )THENTEMP = ALPHA*DCONJG( X( J ) )A( J, J ) = DBLE( A( J, J ) ) + DBLE( TEMP*X( J ) )DO 50, I = J + 1, NA( I, J ) = A( I, J ) + X( I )*TEMP50 CONTINUEc ELSEc A( J, J ) = DBLE( A( J, J ) )c END IF60 CONTINUEELSEJX = KXDO 80, J = 1, Nc IF( X( JX ).NE.ZERO )THENTEMP = ALPHA*DCONJG( X( JX ) )A( J, J ) = DBLE( A( J, J ) ) + DBLE( TEMP*X( JX ) )IX = JXDO 70, I = J + 1, NIX = IX + INCXA( I, J ) = A( I, J ) + X( IX )*TEMP70 CONTINUEc ELSEc A( J, J ) = DBLE( A( J, J ) )c END IFJX = JX + INCX80 CONTINUEEND IFEND IF*RETURN** End of ZHER .*ENDSUBROUTINE ZHERK( UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC )* .. Scalar Arguments ..CHARACTER TRANS, UPLOINTEGER K, LDA, LDC, NDOUBLE PRECISION ALPHA, BETA* ..* .. Array Arguments ..COMPLEX*16 A( LDA, * ), C( LDC, * )* ..** Purpose* =======** ZHERK performs one of the hermitian rank k operations** C := alpha*A*conjg( A' ) + beta*C,** or** C := alpha*conjg( A' )*A + beta*C,** where alpha and beta are real scalars, C is an n by n hermitian* matrix and A is an n by k matrix in the first case and a k by n* matrix in the second case.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the upper or lower* triangular part of the array C is to be referenced as* follows:** UPLO = 'U' or 'u' Only the upper triangular part of C* is to be referenced.** UPLO = 'L' or 'l' Only the lower triangular part of C* is to be referenced.** Unchanged on exit.** TRANS - CHARACTER*1.* On entry, TRANS specifies the operation to be performed as* follows:** TRANS = 'N' or 'n' C := alpha*A*conjg( A' ) + beta*C.** TRANS = 'C' or 'c' C := alpha*conjg( A' )*A + beta*C.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix C. N must be* at least zero.* Unchanged on exit.** K - INTEGER.* On entry with TRANS = 'N' or 'n', K specifies the number* of columns of the matrix A, and on entry with* TRANS = 'C' or 'c', K specifies the number of rows of the* matrix A. K must be at least zero.* Unchanged on exit.** ALPHA - DOUBLE PRECISION .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, ka ), where ka is* k when TRANS = 'N' or 'n', and is n otherwise.* Before entry with TRANS = 'N' or 'n', the leading n by k* part of the array A must contain the matrix A, otherwise* the leading k by n part of the array A must contain the* matrix A.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. When TRANS = 'N' or 'n'* then LDA must be at least max( 1, n ), otherwise LDA must* be at least max( 1, k ).* Unchanged on exit.** BETA - DOUBLE PRECISION.* On entry, BETA specifies the scalar beta.* Unchanged on exit.** C - COMPLEX*16 array of DIMENSION ( LDC, n ).* Before entry with UPLO = 'U' or 'u', the leading n by n* upper triangular part of the array C must contain the upper* triangular part of the hermitian matrix and the strictly* lower triangular part of C is not referenced. On exit, the* upper triangular part of the array C is overwritten by the* upper triangular part of the updated matrix.* Before entry with UPLO = 'L' or 'l', the leading n by n* lower triangular part of the array C must contain the lower* triangular part of the hermitian matrix and the strictly* upper triangular part of C is not referenced. On exit, the* lower triangular part of the array C is overwritten by the* lower triangular part of the updated matrix.* Note that the imaginary parts of the diagonal elements need* not be set, they are assumed to be zero, and on exit they* are set to zero.** LDC - INTEGER.* On entry, LDC specifies the first dimension of C as declared* in the calling (sub) program. LDC must be at least* max( 1, n ).* Unchanged on exit.*** Level 3 Blas routine.** -- Written on 8-February-1989.* Jack Dongarra, Argonne National Laboratory.* Iain Duff, AERE Harwell.* Jeremy Du Croz, Numerical Algorithms Group Ltd.* Sven Hammarling, Numerical Algorithms Group Ltd.** -- Modified 8-Nov-93 to set C(J,J) to DBLE( C(J,J) ) when BETA = 1.* Ed Anderson, Cray Research Inc.*** .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* ..* .. External Subroutines ..EXTERNAL XERBLA* ..* .. Intrinsic Functions ..INTRINSIC DBLE, DCMPLX, DCONJG, MAX* ..* .. Local Scalars ..LOGICAL UPPERINTEGER I, INFO, J, L, NROWADOUBLE PRECISION RTEMPCOMPLEX*16 TEMP* ..* .. Parameters ..DOUBLE PRECISION ONE, ZEROPARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )* ..* .. Executable Statements ..** Test the input parameters.*IF( LSAME( TRANS, 'N' ) ) THENNROWA = NELSENROWA = KEND IFUPPER = LSAME( UPLO, 'U' )*INFO = 0IF( ( .NOT.UPPER ) .AND. ( .NOT.LSAME( UPLO, 'L' ) ) ) THENINFO = 1ELSE IF( ( .NOT.LSAME( TRANS, 'N' ) ) .AND.$ ( .NOT.LSAME( TRANS, 'C' ) ) ) THENINFO = 2ELSE IF( N.LT.0 ) THENINFO = 3ELSE IF( K.LT.0 ) THENINFO = 4ELSE IF( LDA.LT.MAX( 1, NROWA ) ) THENINFO = 7ELSE IF( LDC.LT.MAX( 1, N ) ) THENINFO = 10END IFIF( INFO.NE.0 ) THENCALL XERBLA( 'ZHERK ', INFO )RETURNEND IF** Quick return if possible.*IF( ( N.EQ.0 ) .OR. ( ( ( ALPHA.EQ.ZERO ) .OR. ( K.EQ.0 ) ) .AND.$ ( BETA.EQ.ONE ) ) )RETURN** And when alpha.eq.zero.*IF( ALPHA.EQ.ZERO ) THENIF( UPPER ) THENIF( BETA.EQ.ZERO ) THENDO 20 J = 1, NDO 10 I = 1, JC( I, J ) = ZERO10 CONTINUE20 CONTINUEELSEDO 40 J = 1, NDO 30 I = 1, J - 1C( I, J ) = BETA*C( I, J )30 CONTINUEC( J, J ) = BETA*DBLE( C( J, J ) )40 CONTINUEEND IFELSEIF( BETA.EQ.ZERO ) THENDO 60 J = 1, NDO 50 I = J, NC( I, J ) = ZERO50 CONTINUE60 CONTINUEELSEDO 80 J = 1, NC( J, J ) = BETA*DBLE( C( J, J ) )DO 70 I = J + 1, NC( I, J ) = BETA*C( I, J )70 CONTINUE80 CONTINUEEND IFEND IFRETURNEND IF** Start the operations.*IF( LSAME( TRANS, 'N' ) ) THEN** Form C := alpha*A*conjg( A' ) + beta*C.*IF( UPPER ) THENDO 130 J = 1, NIF( BETA.EQ.ZERO ) THENDO 90 I = 1, JC( I, J ) = ZERO90 CONTINUEELSE IF( BETA.NE.ONE ) THENDO 100 I = 1, J - 1C( I, J ) = BETA*C( I, J )100 CONTINUEC( J, J ) = BETA*DBLE( C( J, J ) )ELSEC( J, J ) = DBLE( C( J, J ) )END IFDO 120 L = 1, KIF( A( J, L ).NE.DCMPLX( ZERO ) ) THENTEMP = ALPHA*DCONJG( A( J, L ) )DO 110 I = 1, J - 1C( I, J ) = C( I, J ) + TEMP*A( I, L )110 CONTINUEC( J, J ) = DBLE( C( J, J ) ) +$ DBLE( TEMP*A( I, L ) )END IF120 CONTINUE130 CONTINUEELSEDO 180 J = 1, NIF( BETA.EQ.ZERO ) THENDO 140 I = J, NC( I, J ) = ZERO140 CONTINUEELSE IF( BETA.NE.ONE ) THENC( J, J ) = BETA*DBLE( C( J, J ) )DO 150 I = J + 1, NC( I, J ) = BETA*C( I, J )150 CONTINUEELSEC( J, J ) = DBLE( C( J, J ) )END IFDO 170 L = 1, KIF( A( J, L ).NE.DCMPLX( ZERO ) ) THENTEMP = ALPHA*DCONJG( A( J, L ) )C( J, J ) = DBLE( C( J, J ) ) +$ DBLE( TEMP*A( J, L ) )DO 160 I = J + 1, NC( I, J ) = C( I, J ) + TEMP*A( I, L )160 CONTINUEEND IF170 CONTINUE180 CONTINUEEND IFELSE** Form C := alpha*conjg( A' )*A + beta*C.*IF( UPPER ) THENDO 220 J = 1, NDO 200 I = 1, J - 1TEMP = ZERODO 190 L = 1, KTEMP = TEMP + DCONJG( A( L, I ) )*A( L, J )190 CONTINUEIF( BETA.EQ.ZERO ) THENC( I, J ) = ALPHA*TEMPELSEC( I, J ) = ALPHA*TEMP + BETA*C( I, J )END IF200 CONTINUERTEMP = ZERODO 210 L = 1, KRTEMP = RTEMP + DCONJG( A( L, J ) )*A( L, J )210 CONTINUEIF( BETA.EQ.ZERO ) THENC( J, J ) = ALPHA*RTEMPELSEC( J, J ) = ALPHA*RTEMP + BETA*DBLE( C( J, J ) )END IF220 CONTINUEELSEDO 260 J = 1, NRTEMP = ZERODO 230 L = 1, KRTEMP = RTEMP + DCONJG( A( L, J ) )*A( L, J )230 CONTINUEIF( BETA.EQ.ZERO ) THENC( J, J ) = ALPHA*RTEMPELSEC( J, J ) = ALPHA*RTEMP + BETA*DBLE( C( J, J ) )END IFDO 250 I = J + 1, NTEMP = ZERODO 240 L = 1, KTEMP = TEMP + DCONJG( A( L, I ) )*A( L, J )240 CONTINUEIF( BETA.EQ.ZERO ) THENC( I, J ) = ALPHA*TEMPELSEC( I, J ) = ALPHA*TEMP + BETA*C( I, J )END IF250 CONTINUE260 CONTINUEEND IFEND IF*RETURN** End of ZHERK .*ENDSUBROUTINE ZHPMV ( UPLO, N, ALPHA, AP, X, INCX, BETA, Y, INCY )* .. Scalar Arguments ..COMPLEX*16 ALPHA, BETAINTEGER INCX, INCY, NCHARACTER*1 UPLO* .. Array Arguments ..COMPLEX*16 AP( * ), X( * ), Y( * )* ..** Purpose* =======** ZHPMV performs the matrix-vector operation** y := alpha*A*x + beta*y,** where alpha and beta are scalars, x and y are n element vectors and* A is an n by n hermitian matrix, supplied in packed form.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the upper or lower* triangular part of the matrix A is supplied in the packed* array AP as follows:** UPLO = 'U' or 'u' The upper triangular part of A is* supplied in AP.** UPLO = 'L' or 'l' The lower triangular part of A is* supplied in AP.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix A.* N must be at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** AP - COMPLEX*16 array of DIMENSION at least* ( ( n*( n + 1 ) )/2 ).* Before entry with UPLO = 'U' or 'u', the array AP must* contain the upper triangular part of the hermitian matrix* packed sequentially, column by column, so that AP( 1 )* contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 )* and a( 2, 2 ) respectively, and so on.* Before entry with UPLO = 'L' or 'l', the array AP must* contain the lower triangular part of the hermitian matrix* packed sequentially, column by column, so that AP( 1 )* contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 )* and a( 3, 1 ) respectively, and so on.* Note that the imaginary parts of the diagonal elements need* not be set and are assumed to be zero.* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the n* element vector x.* Unchanged on exit.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.** BETA - COMPLEX*16 .* On entry, BETA specifies the scalar beta. When BETA is* supplied as zero then Y need not be set on input.* Unchanged on exit.** Y - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCY ) ).* Before entry, the incremented array Y must contain the n* element vector y. On exit, Y is overwritten by the updated* vector y.** INCY - INTEGER.* On entry, INCY specifies the increment for the elements of* Y. INCY must not be zero.* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ONEPARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMP1, TEMP2INTEGER I, INFO, IX, IY, J, JX, JY, K, KK, KX, KY* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, DBLE* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( UPLO, 'U' ).AND.$ .NOT.LSAME( UPLO, 'L' ) )THENINFO = 1ELSE IF( N.LT.0 )THENINFO = 2ELSE IF( INCX.EQ.0 )THENINFO = 6ELSE IF( INCY.EQ.0 )THENINFO = 9END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZHPMV ', INFO )RETURNEND IF** Quick return if possible.*IF( ( N.EQ.0 ).OR.( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )$ RETURN** Set up the start points in X and Y.*IF( INCX.GT.0 )THENKX = 1ELSEKX = 1 - ( N - 1 )*INCXEND IFIF( INCY.GT.0 )THENKY = 1ELSEKY = 1 - ( N - 1 )*INCYEND IF** Start the operations. In this version the elements of the array AP* are accessed sequentially with one pass through AP.** First form y := beta*y.*IF( BETA.NE.ONE )THENIF( INCY.EQ.1 )THENIF( BETA.EQ.ZERO )THENDO 10, I = 1, NY( I ) = ZERO10 CONTINUEELSEDO 20, I = 1, NY( I ) = BETA*Y( I )20 CONTINUEEND IFELSEIY = KYIF( BETA.EQ.ZERO )THENDO 30, I = 1, NY( IY ) = ZEROIY = IY + INCY30 CONTINUEELSEDO 40, I = 1, NY( IY ) = BETA*Y( IY )IY = IY + INCY40 CONTINUEEND IFEND IFEND IFIF( ALPHA.EQ.ZERO )$ RETURNKK = 1IF( LSAME( UPLO, 'U' ) )THEN** Form y when AP contains the upper triangle.*IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THENDO 60, J = 1, NTEMP1 = ALPHA*X( J )TEMP2 = ZEROK = KKDO 50, I = 1, J - 1Y( I ) = Y( I ) + TEMP1*AP( K )TEMP2 = TEMP2 + DCONJG( AP( K ) )*X( I )K = K + 150 CONTINUEY( J ) = Y( J ) + TEMP1*DBLE( AP( KK + J - 1 ) )$ + ALPHA*TEMP2KK = KK + J60 CONTINUEELSEJX = KXJY = KYDO 80, J = 1, NTEMP1 = ALPHA*X( JX )TEMP2 = ZEROIX = KXIY = KYDO 70, K = KK, KK + J - 2Y( IY ) = Y( IY ) + TEMP1*AP( K )TEMP2 = TEMP2 + DCONJG( AP( K ) )*X( IX )IX = IX + INCXIY = IY + INCY70 CONTINUEY( JY ) = Y( JY ) + TEMP1*DBLE( AP( KK + J - 1 ) )$ + ALPHA*TEMP2JX = JX + INCXJY = JY + INCYKK = KK + J80 CONTINUEEND IFELSE** Form y when AP contains the lower triangle.*IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THENDO 100, J = 1, NTEMP1 = ALPHA*X( J )TEMP2 = ZEROY( J ) = Y( J ) + TEMP1*DBLE( AP( KK ) )K = KK + 1DO 90, I = J + 1, NY( I ) = Y( I ) + TEMP1*AP( K )TEMP2 = TEMP2 + DCONJG( AP( K ) )*X( I )K = K + 190 CONTINUEY( J ) = Y( J ) + ALPHA*TEMP2KK = KK + ( N - J + 1 )100 CONTINUEELSEJX = KXJY = KYDO 120, J = 1, NTEMP1 = ALPHA*X( JX )TEMP2 = ZEROY( JY ) = Y( JY ) + TEMP1*DBLE( AP( KK ) )IX = JXIY = JYDO 110, K = KK + 1, KK + N - JIX = IX + INCXIY = IY + INCYY( IY ) = Y( IY ) + TEMP1*AP( K )TEMP2 = TEMP2 + DCONJG( AP( K ) )*X( IX )110 CONTINUEY( JY ) = Y( JY ) + ALPHA*TEMP2JX = JX + INCXJY = JY + INCYKK = KK + ( N - J + 1 )120 CONTINUEEND IFEND IF*RETURN** End of ZHPMV .*ENDSUBROUTINE ZHPR ( UPLO, N, ALPHA, X, INCX, AP )* .. Scalar Arguments ..DOUBLE PRECISION ALPHAINTEGER INCX, NCHARACTER*1 UPLO* .. Array Arguments ..COMPLEX*16 AP( * ), X( * )* ..** Purpose* =======** ZHPR performs the hermitian rank 1 operation** A := alpha*x*conjg( x' ) + A,** where alpha is a real scalar, x is an n element vector and A is an* n by n hermitian matrix, supplied in packed form.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the upper or lower* triangular part of the matrix A is supplied in the packed* array AP as follows:** UPLO = 'U' or 'u' The upper triangular part of A is* supplied in AP.** UPLO = 'L' or 'l' The lower triangular part of A is* supplied in AP.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix A.* N must be at least zero.* Unchanged on exit.** ALPHA - DOUBLE PRECISION.* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the n* element vector x.* Unchanged on exit.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.** AP - COMPLEX*16 array of DIMENSION at least* ( ( n*( n + 1 ) )/2 ).* Before entry with UPLO = 'U' or 'u', the array AP must* contain the upper triangular part of the hermitian matrix* packed sequentially, column by column, so that AP( 1 )* contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 )* and a( 2, 2 ) respectively, and so on. On exit, the array* AP is overwritten by the upper triangular part of the* updated matrix.* Before entry with UPLO = 'L' or 'l', the array AP must* contain the lower triangular part of the hermitian matrix* packed sequentially, column by column, so that AP( 1 )* contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 )* and a( 3, 1 ) respectively, and so on. On exit, the array* AP is overwritten by the lower triangular part of the* updated matrix.* Note that the imaginary parts of the diagonal elements need* not be set, they are assumed to be zero, and on exit they* are set to zero.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMPINTEGER I, INFO, IX, J, JX, K, KK, KX* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, DBLE* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( UPLO, 'U' ).AND.$ .NOT.LSAME( UPLO, 'L' ) )THENINFO = 1ELSE IF( N.LT.0 )THENINFO = 2ELSE IF( INCX.EQ.0 )THENINFO = 5END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZHPR ', INFO )RETURNEND IF** Quick return if possible.*IF( ( N.EQ.0 ).OR.( ALPHA.EQ.DBLE( ZERO ) ) )$ RETURN** Set the start point in X if the increment is not unity.*IF( INCX.LE.0 )THENKX = 1 - ( N - 1 )*INCXELSE IF( INCX.NE.1 )THENKX = 1END IF** Start the operations. In this version the elements of the array AP* are accessed sequentially with one pass through AP.*KK = 1IF( LSAME( UPLO, 'U' ) )THEN** Form A when upper triangle is stored in AP.*IF( INCX.EQ.1 )THENDO 20, J = 1, Nc IF( X( J ).NE.ZERO )THENTEMP = ALPHA*DCONJG( X( J ) )K = KKDO 10, I = 1, J - 1AP( K ) = AP( K ) + X( I )*TEMPK = K + 110 CONTINUEAP( KK + J - 1 ) = DBLE( AP( KK + J - 1 ) )$ + DBLE( X( J )*TEMP )c ELSEc AP( KK + J - 1 ) = DBLE( AP( KK + J - 1 ) )c END IFKK = KK + J20 CONTINUEELSEJX = KXDO 40, J = 1, Nc IF( X( JX ).NE.ZERO )THENTEMP = ALPHA*DCONJG( X( JX ) )IX = KXDO 30, K = KK, KK + J - 2AP( K ) = AP( K ) + X( IX )*TEMPIX = IX + INCX30 CONTINUEAP( KK + J - 1 ) = DBLE( AP( KK + J - 1 ) )$ + DBLE( X( JX )*TEMP )c ELSEc AP( KK + J - 1 ) = DBLE( AP( KK + J - 1 ) )c END IFJX = JX + INCXKK = KK + J40 CONTINUEEND IFELSE** Form A when lower triangle is stored in AP.*IF( INCX.EQ.1 )THENDO 60, J = 1, Nc IF( X( J ).NE.ZERO )THENTEMP = ALPHA*DCONJG( X( J ) )AP( KK ) = DBLE( AP( KK ) ) + DBLE( TEMP*X( J ) )K = KK + 1DO 50, I = J + 1, NAP( K ) = AP( K ) + X( I )*TEMPK = K + 150 CONTINUEc ELSEc AP( KK ) = DBLE( AP( KK ) )c END IFKK = KK + N - J + 160 CONTINUEELSEJX = KXDO 80, J = 1, Nc IF( X( JX ).NE.ZERO )THENTEMP = ALPHA*DCONJG( X( JX ) )AP( KK ) = DBLE( AP( KK ) ) + DBLE( TEMP*X( JX ) )IX = JXDO 70, K = KK + 1, KK + N - JIX = IX + INCXAP( K ) = AP( K ) + X( IX )*TEMP70 CONTINUEc ELSEc AP( KK ) = DBLE( AP( KK ) )c END IFJX = JX + INCXKK = KK + N - J + 180 CONTINUEEND IFEND IF*RETURN** End of ZHPR .*ENDSUBROUTINE ZHPR2 ( UPLO, N, ALPHA, X, INCX, Y, INCY, AP )* .. Scalar Arguments ..COMPLEX*16 ALPHAINTEGER INCX, INCY, NCHARACTER*1 UPLO* .. Array Arguments ..COMPLEX*16 AP( * ), X( * ), Y( * )* ..** Purpose* =======** ZHPR2 performs the hermitian rank 2 operation** A := alpha*x*conjg( y' ) + conjg( alpha )*y*conjg( x' ) + A,** where alpha is a scalar, x and y are n element vectors and A is an* n by n hermitian matrix, supplied in packed form.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the upper or lower* triangular part of the matrix A is supplied in the packed* array AP as follows:** UPLO = 'U' or 'u' The upper triangular part of A is* supplied in AP.** UPLO = 'L' or 'l' The lower triangular part of A is* supplied in AP.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix A.* N must be at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the n* element vector x.* Unchanged on exit.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.** Y - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCY ) ).* Before entry, the incremented array Y must contain the n* element vector y.* Unchanged on exit.** INCY - INTEGER.* On entry, INCY specifies the increment for the elements of* Y. INCY must not be zero.* Unchanged on exit.** AP - COMPLEX*16 array of DIMENSION at least* ( ( n*( n + 1 ) )/2 ).* Before entry with UPLO = 'U' or 'u', the array AP must* contain the upper triangular part of the hermitian matrix* packed sequentially, column by column, so that AP( 1 )* contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 )* and a( 2, 2 ) respectively, and so on. On exit, the array* AP is overwritten by the upper triangular part of the* updated matrix.* Before entry with UPLO = 'L' or 'l', the array AP must* contain the lower triangular part of the hermitian matrix* packed sequentially, column by column, so that AP( 1 )* contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 )* and a( 3, 1 ) respectively, and so on. On exit, the array* AP is overwritten by the lower triangular part of the* updated matrix.* Note that the imaginary parts of the diagonal elements need* not be set, they are assumed to be zero, and on exit they* are set to zero.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMP1, TEMP2INTEGER I, INFO, IX, IY, J, JX, JY, K, KK, KX, KY* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, DBLE* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( UPLO, 'U' ).AND.$ .NOT.LSAME( UPLO, 'L' ) )THENINFO = 1ELSE IF( N.LT.0 )THENINFO = 2ELSE IF( INCX.EQ.0 )THENINFO = 5ELSE IF( INCY.EQ.0 )THENINFO = 7END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZHPR2 ', INFO )RETURNEND IF** Quick return if possible.*IF( ( N.EQ.0 ).OR.( ALPHA.EQ.ZERO ) )$ RETURN** Set up the start points in X and Y if the increments are not both* unity.*IF( ( INCX.NE.1 ).OR.( INCY.NE.1 ) )THENIF( INCX.GT.0 )THENKX = 1ELSEKX = 1 - ( N - 1 )*INCXEND IFIF( INCY.GT.0 )THENKY = 1ELSEKY = 1 - ( N - 1 )*INCYEND IFJX = KXJY = KYEND IF** Start the operations. In this version the elements of the array AP* are accessed sequentially with one pass through AP.*KK = 1IF( LSAME( UPLO, 'U' ) )THEN** Form A when upper triangle is stored in AP.*IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THENDO 20, J = 1, Nc IF( ( X( J ).NE.ZERO ).OR.( Y( J ).NE.ZERO ) )THENTEMP1 = ALPHA*DCONJG( Y( J ) )TEMP2 = DCONJG( ALPHA*X( J ) )K = KKDO 10, I = 1, J - 1AP( K ) = AP( K ) + X( I )*TEMP1 + Y( I )*TEMP2K = K + 110 CONTINUEAP( KK + J - 1 ) = DBLE( AP( KK + J - 1 ) ) +$ DBLE( X( J )*TEMP1 + Y( J )*TEMP2 )c ELSEc AP( KK + J - 1 ) = DBLE( AP( KK + J - 1 ) )c END IFKK = KK + J20 CONTINUEELSEDO 40, J = 1, Nc IF( ( X( JX ).NE.ZERO ).OR.( Y( JY ).NE.ZERO ) )THENTEMP1 = ALPHA*DCONJG( Y( JY ) )TEMP2 = DCONJG( ALPHA*X( JX ) )IX = KXIY = KYDO 30, K = KK, KK + J - 2AP( K ) = AP( K ) + X( IX )*TEMP1 + Y( IY )*TEMP2IX = IX + INCXIY = IY + INCY30 CONTINUEAP( KK + J - 1 ) = DBLE( AP( KK + J - 1 ) ) +$ DBLE( X( JX )*TEMP1 +$ Y( JY )*TEMP2 )c ELSEc AP( KK + J - 1 ) = DBLE( AP( KK + J - 1 ) )c END IFJX = JX + INCXJY = JY + INCYKK = KK + J40 CONTINUEEND IFELSE** Form A when lower triangle is stored in AP.*IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THENDO 60, J = 1, Nc IF( ( X( J ).NE.ZERO ).OR.( Y( J ).NE.ZERO ) )THENTEMP1 = ALPHA*DCONJG( Y( J ) )TEMP2 = DCONJG( ALPHA*X( J ) )AP( KK ) = DBLE( AP( KK ) ) +$ DBLE( X( J )*TEMP1 + Y( J )*TEMP2 )K = KK + 1DO 50, I = J + 1, NAP( K ) = AP( K ) + X( I )*TEMP1 + Y( I )*TEMP2K = K + 150 CONTINUEc ELSEc AP( KK ) = DBLE( AP( KK ) )c END IFKK = KK + N - J + 160 CONTINUEELSEDO 80, J = 1, Nc IF( ( X( JX ).NE.ZERO ).OR.( Y( JY ).NE.ZERO ) )THENTEMP1 = ALPHA*DCONJG( Y( JY ) )TEMP2 = DCONJG( ALPHA*X( JX ) )AP( KK ) = DBLE( AP( KK ) ) +$ DBLE( X( JX )*TEMP1 + Y( JY )*TEMP2 )IX = JXIY = JYDO 70, K = KK + 1, KK + N - JIX = IX + INCXIY = IY + INCYAP( K ) = AP( K ) + X( IX )*TEMP1 + Y( IY )*TEMP270 CONTINUEc ELSEc AP( KK ) = DBLE( AP( KK ) )c END IFJX = JX + INCXJY = JY + INCYKK = KK + N - J + 180 CONTINUEEND IFEND IF*RETURN** End of ZHPR2 .*ENDsubroutine zrotg(ca,cb,c,s)double complex ca,cb,sdouble precision cdouble precision norm,scaledouble complex alphaintrinsic dconjg, dcmplxif (cdabs(ca) .ne. 0.0d0) go to 10c = 0.0d0s = (1.0d0,0.0d0)ca = cbgo to 2010 continuescale = cdabs(ca) + cdabs(cb)norm = scale*dsqrt((cdabs(ca/dcmplx(scale,0.0d0)))**2 +* (cdabs(cb/dcmplx(scale,0.0d0)))**2)alpha = ca /cdabs(ca)c = cdabs(ca) / norms = alpha * dconjg(cb) / normca = alpha * norm20 continuereturnendSUBROUTINE ZSYMM ( SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB,$ BETA, C, LDC )* .. Scalar Arguments ..CHARACTER*1 SIDE, UPLOINTEGER M, N, LDA, LDB, LDCCOMPLEX*16 ALPHA, BETA* .. Array Arguments ..COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * )* ..** Purpose* =======** ZSYMM performs one of the matrix-matrix operations** C := alpha*A*B + beta*C,** or** C := alpha*B*A + beta*C,** where alpha and beta are scalars, A is a symmetric matrix and B and* C are m by n matrices.** Parameters* ==========** SIDE - CHARACTER*1.* On entry, SIDE specifies whether the symmetric matrix A* appears on the left or right in the operation as follows:** SIDE = 'L' or 'l' C := alpha*A*B + beta*C,** SIDE = 'R' or 'r' C := alpha*B*A + beta*C,** Unchanged on exit.** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the upper or lower* triangular part of the symmetric matrix A is to be* referenced as follows:** UPLO = 'U' or 'u' Only the upper triangular part of the* symmetric matrix is to be referenced.** UPLO = 'L' or 'l' Only the lower triangular part of the* symmetric matrix is to be referenced.** Unchanged on exit.** M - INTEGER.* On entry, M specifies the number of rows of the matrix C.* M must be at least zero.* Unchanged on exit.** N - INTEGER.* On entry, N specifies the number of columns of the matrix C.* N must be at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, ka ), where ka is* m when SIDE = 'L' or 'l' and is n otherwise.* Before entry with SIDE = 'L' or 'l', the m by m part of* the array A must contain the symmetric matrix, such that* when UPLO = 'U' or 'u', the leading m by m upper triangular* part of the array A must contain the upper triangular part* of the symmetric matrix and the strictly lower triangular* part of A is not referenced, and when UPLO = 'L' or 'l',* the leading m by m lower triangular part of the array A* must contain the lower triangular part of the symmetric* matrix and the strictly upper triangular part of A is not* referenced.* Before entry with SIDE = 'R' or 'r', the n by n part of* the array A must contain the symmetric matrix, such that* when UPLO = 'U' or 'u', the leading n by n upper triangular* part of the array A must contain the upper triangular part* of the symmetric matrix and the strictly lower triangular* part of A is not referenced, and when UPLO = 'L' or 'l',* the leading n by n lower triangular part of the array A* must contain the lower triangular part of the symmetric* matrix and the strictly upper triangular part of A is not* referenced.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. When SIDE = 'L' or 'l' then* LDA must be at least max( 1, m ), otherwise LDA must be at* least max( 1, n ).* Unchanged on exit.** B - COMPLEX*16 array of DIMENSION ( LDB, n ).* Before entry, the leading m by n part of the array B must* contain the matrix B.* Unchanged on exit.** LDB - INTEGER.* On entry, LDB specifies the first dimension of B as declared* in the calling (sub) program. LDB must be at least* max( 1, m ).* Unchanged on exit.** BETA - COMPLEX*16 .* On entry, BETA specifies the scalar beta. When BETA is* supplied as zero then C need not be set on input.* Unchanged on exit.** C - COMPLEX*16 array of DIMENSION ( LDC, n ).* Before entry, the leading m by n part of the array C must* contain the matrix C, except when beta is zero, in which* case C need not be set on entry.* On exit, the array C is overwritten by the m by n updated* matrix.** LDC - INTEGER.* On entry, LDC specifies the first dimension of C as declared* in the calling (sub) program. LDC must be at least* max( 1, m ).* Unchanged on exit.*** Level 3 Blas routine.** -- Written on 8-February-1989.* Jack Dongarra, Argonne National Laboratory.* Iain Duff, AERE Harwell.* Jeremy Du Croz, Numerical Algorithms Group Ltd.* Sven Hammarling, Numerical Algorithms Group Ltd.*** .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC MAX* .. Local Scalars ..LOGICAL UPPERINTEGER I, INFO, J, K, NROWACOMPLEX*16 TEMP1, TEMP2* .. Parameters ..COMPLEX*16 ONEPARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* ..* .. Executable Statements ..** Set NROWA as the number of rows of A.*IF( LSAME( SIDE, 'L' ) )THENNROWA = MELSENROWA = NEND IFUPPER = LSAME( UPLO, 'U' )** Test the input parameters.*INFO = 0IF( ( .NOT.LSAME( SIDE, 'L' ) ).AND.$ ( .NOT.LSAME( SIDE, 'R' ) ) )THENINFO = 1ELSE IF( ( .NOT.UPPER ).AND.$ ( .NOT.LSAME( UPLO, 'L' ) ) )THENINFO = 2ELSE IF( M .LT.0 )THENINFO = 3ELSE IF( N .LT.0 )THENINFO = 4ELSE IF( LDA.LT.MAX( 1, NROWA ) )THENINFO = 7ELSE IF( LDB.LT.MAX( 1, M ) )THENINFO = 9ELSE IF( LDC.LT.MAX( 1, M ) )THENINFO = 12END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZSYMM ', INFO )RETURNEND IF** Quick return if possible.*IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.$ ( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )$ RETURN** And when alpha.eq.zero.*IF( ALPHA.EQ.ZERO )THENIF( BETA.EQ.ZERO )THENDO 20, J = 1, NDO 10, I = 1, MC( I, J ) = ZERO10 CONTINUE20 CONTINUEELSEDO 40, J = 1, NDO 30, I = 1, MC( I, J ) = BETA*C( I, J )30 CONTINUE40 CONTINUEEND IFRETURNEND IF** Start the operations.*IF( LSAME( SIDE, 'L' ) )THEN** Form C := alpha*A*B + beta*C.*IF( UPPER )THENDO 70, J = 1, NDO 60, I = 1, MTEMP1 = ALPHA*B( I, J )TEMP2 = ZERODO 50, K = 1, I - 1C( K, J ) = C( K, J ) + TEMP1 *A( K, I )TEMP2 = TEMP2 + B( K, J )*A( K, I )50 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = TEMP1*A( I, I ) + ALPHA*TEMP2ELSEC( I, J ) = BETA *C( I, J ) +$ TEMP1*A( I, I ) + ALPHA*TEMP2END IF60 CONTINUE70 CONTINUEELSEDO 100, J = 1, NDO 90, I = M, 1, -1TEMP1 = ALPHA*B( I, J )TEMP2 = ZERODO 80, K = I + 1, MC( K, J ) = C( K, J ) + TEMP1 *A( K, I )TEMP2 = TEMP2 + B( K, J )*A( K, I )80 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = TEMP1*A( I, I ) + ALPHA*TEMP2ELSEC( I, J ) = BETA *C( I, J ) +$ TEMP1*A( I, I ) + ALPHA*TEMP2END IF90 CONTINUE100 CONTINUEEND IFELSE** Form C := alpha*B*A + beta*C.*DO 170, J = 1, NTEMP1 = ALPHA*A( J, J )IF( BETA.EQ.ZERO )THENDO 110, I = 1, MC( I, J ) = TEMP1*B( I, J )110 CONTINUEELSEDO 120, I = 1, MC( I, J ) = BETA*C( I, J ) + TEMP1*B( I, J )120 CONTINUEEND IFDO 140, K = 1, J - 1IF( UPPER )THENTEMP1 = ALPHA*A( K, J )ELSETEMP1 = ALPHA*A( J, K )END IFDO 130, I = 1, MC( I, J ) = C( I, J ) + TEMP1*B( I, K )130 CONTINUE140 CONTINUEDO 160, K = J + 1, NIF( UPPER )THENTEMP1 = ALPHA*A( J, K )ELSETEMP1 = ALPHA*A( K, J )END IFDO 150, I = 1, MC( I, J ) = C( I, J ) + TEMP1*B( I, K )150 CONTINUE160 CONTINUE170 CONTINUEEND IF*RETURN** End of ZSYMM .*ENDSUBROUTINE ZSYR2K( UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB,$ BETA, C, LDC )* .. Scalar Arguments ..CHARACTER*1 UPLO, TRANSINTEGER N, K, LDA, LDB, LDCCOMPLEX*16 ALPHA, BETA* .. Array Arguments ..COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * )* ..** Purpose* =======** ZSYR2K performs one of the symmetric rank 2k operations** C := alpha*A*B' + alpha*B*A' + beta*C,** or** C := alpha*A'*B + alpha*B'*A + beta*C,** where alpha and beta are scalars, C is an n by n symmetric matrix* and A and B are n by k matrices in the first case and k by n* matrices in the second case.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the upper or lower* triangular part of the array C is to be referenced as* follows:** UPLO = 'U' or 'u' Only the upper triangular part of C* is to be referenced.** UPLO = 'L' or 'l' Only the lower triangular part of C* is to be referenced.** Unchanged on exit.** TRANS - CHARACTER*1.* On entry, TRANS specifies the operation to be performed as* follows:** TRANS = 'N' or 'n' C := alpha*A*B' + alpha*B*A' +* beta*C.** TRANS = 'T' or 't' C := alpha*A'*B + alpha*B'*A +* beta*C.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix C. N must be* at least zero.* Unchanged on exit.** K - INTEGER.* On entry with TRANS = 'N' or 'n', K specifies the number* of columns of the matrices A and B, and on entry with* TRANS = 'T' or 't', K specifies the number of rows of the* matrices A and B. K must be at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, ka ), where ka is* k when TRANS = 'N' or 'n', and is n otherwise.* Before entry with TRANS = 'N' or 'n', the leading n by k* part of the array A must contain the matrix A, otherwise* the leading k by n part of the array A must contain the* matrix A.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. When TRANS = 'N' or 'n'* then LDA must be at least max( 1, n ), otherwise LDA must* be at least max( 1, k ).* Unchanged on exit.** B - COMPLEX*16 array of DIMENSION ( LDB, kb ), where kb is* k when TRANS = 'N' or 'n', and is n otherwise.* Before entry with TRANS = 'N' or 'n', the leading n by k* part of the array B must contain the matrix B, otherwise* the leading k by n part of the array B must contain the* matrix B.* Unchanged on exit.** LDB - INTEGER.* On entry, LDB specifies the first dimension of B as declared* in the calling (sub) program. When TRANS = 'N' or 'n'* then LDB must be at least max( 1, n ), otherwise LDB must* be at least max( 1, k ).* Unchanged on exit.** BETA - COMPLEX*16 .* On entry, BETA specifies the scalar beta.* Unchanged on exit.** C - COMPLEX*16 array of DIMENSION ( LDC, n ).* Before entry with UPLO = 'U' or 'u', the leading n by n* upper triangular part of the array C must contain the upper* triangular part of the symmetric matrix and the strictly* lower triangular part of C is not referenced. On exit, the* upper triangular part of the array C is overwritten by the* upper triangular part of the updated matrix.* Before entry with UPLO = 'L' or 'l', the leading n by n* lower triangular part of the array C must contain the lower* triangular part of the symmetric matrix and the strictly* upper triangular part of C is not referenced. On exit, the* lower triangular part of the array C is overwritten by the* lower triangular part of the updated matrix.** LDC - INTEGER.* On entry, LDC specifies the first dimension of C as declared* in the calling (sub) program. LDC must be at least* max( 1, n ).* Unchanged on exit.*** Level 3 Blas routine.** -- Written on 8-February-1989.* Jack Dongarra, Argonne National Laboratory.* Iain Duff, AERE Harwell.* Jeremy Du Croz, Numerical Algorithms Group Ltd.* Sven Hammarling, Numerical Algorithms Group Ltd.*** .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC MAX* .. Local Scalars ..LOGICAL UPPERINTEGER I, INFO, J, L, NROWACOMPLEX*16 TEMP1, TEMP2* .. Parameters ..COMPLEX*16 ONEPARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* ..* .. Executable Statements ..** Test the input parameters.*IF( LSAME( TRANS, 'N' ) )THENNROWA = NELSENROWA = KEND IFUPPER = LSAME( UPLO, 'U' )*INFO = 0IF( ( .NOT.UPPER ).AND.$ ( .NOT.LSAME( UPLO , 'L' ) ) )THENINFO = 1ELSE IF( ( .NOT.LSAME( TRANS, 'N' ) ).AND.$ ( .NOT.LSAME( TRANS, 'T' ) ) )THENINFO = 2ELSE IF( N .LT.0 )THENINFO = 3ELSE IF( K .LT.0 )THENINFO = 4ELSE IF( LDA.LT.MAX( 1, NROWA ) )THENINFO = 7ELSE IF( LDB.LT.MAX( 1, NROWA ) )THENINFO = 9ELSE IF( LDC.LT.MAX( 1, N ) )THENINFO = 12END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZSYR2K', INFO )RETURNEND IF** Quick return if possible.*IF( ( N.EQ.0 ).OR.$ ( ( ( ALPHA.EQ.ZERO ).OR.( K.EQ.0 ) ).AND.( BETA.EQ.ONE ) ) )$ RETURN** And when alpha.eq.zero.*IF( ALPHA.EQ.ZERO )THENIF( UPPER )THENIF( BETA.EQ.ZERO )THENDO 20, J = 1, NDO 10, I = 1, JC( I, J ) = ZERO10 CONTINUE20 CONTINUEELSEDO 40, J = 1, NDO 30, I = 1, JC( I, J ) = BETA*C( I, J )30 CONTINUE40 CONTINUEEND IFELSEIF( BETA.EQ.ZERO )THENDO 60, J = 1, NDO 50, I = J, NC( I, J ) = ZERO50 CONTINUE60 CONTINUEELSEDO 80, J = 1, NDO 70, I = J, NC( I, J ) = BETA*C( I, J )70 CONTINUE80 CONTINUEEND IFEND IFRETURNEND IF** Start the operations.*IF( LSAME( TRANS, 'N' ) )THEN** Form C := alpha*A*B' + alpha*B*A' + C.*IF( UPPER )THENDO 130, J = 1, NIF( BETA.EQ.ZERO )THENDO 90, I = 1, JC( I, J ) = ZERO90 CONTINUEELSE IF( BETA.NE.ONE )THENDO 100, I = 1, JC( I, J ) = BETA*C( I, J )100 CONTINUEEND IFDO 120, L = 1, Kc IF( ( A( J, L ).NE.ZERO ).OR.c $ ( B( J, L ).NE.ZERO ) )THENTEMP1 = ALPHA*B( J, L )TEMP2 = ALPHA*A( J, L )DO 110, I = 1, JC( I, J ) = C( I, J ) + A( I, L )*TEMP1 +$ B( I, L )*TEMP2110 CONTINUEc END IF120 CONTINUE130 CONTINUEELSEDO 180, J = 1, NIF( BETA.EQ.ZERO )THENDO 140, I = J, NC( I, J ) = ZERO140 CONTINUEELSE IF( BETA.NE.ONE )THENDO 150, I = J, NC( I, J ) = BETA*C( I, J )150 CONTINUEEND IFDO 170, L = 1, Kc IF( ( A( J, L ).NE.ZERO ).OR.c $ ( B( J, L ).NE.ZERO ) )THENTEMP1 = ALPHA*B( J, L )TEMP2 = ALPHA*A( J, L )DO 160, I = J, NC( I, J ) = C( I, J ) + A( I, L )*TEMP1 +$ B( I, L )*TEMP2160 CONTINUEc END IF170 CONTINUE180 CONTINUEEND IFELSE** Form C := alpha*A'*B + alpha*B'*A + C.*IF( UPPER )THENDO 210, J = 1, NDO 200, I = 1, JTEMP1 = ZEROTEMP2 = ZERODO 190, L = 1, KTEMP1 = TEMP1 + A( L, I )*B( L, J )TEMP2 = TEMP2 + B( L, I )*A( L, J )190 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = ALPHA*TEMP1 + ALPHA*TEMP2ELSEC( I, J ) = BETA *C( I, J ) +$ ALPHA*TEMP1 + ALPHA*TEMP2END IF200 CONTINUE210 CONTINUEELSEDO 240, J = 1, NDO 230, I = J, NTEMP1 = ZEROTEMP2 = ZERODO 220, L = 1, KTEMP1 = TEMP1 + A( L, I )*B( L, J )TEMP2 = TEMP2 + B( L, I )*A( L, J )220 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = ALPHA*TEMP1 + ALPHA*TEMP2ELSEC( I, J ) = BETA *C( I, J ) +$ ALPHA*TEMP1 + ALPHA*TEMP2END IF230 CONTINUE240 CONTINUEEND IFEND IF*RETURN** End of ZSYR2K.*ENDSUBROUTINE ZSYRK ( UPLO, TRANS, N, K, ALPHA, A, LDA,$ BETA, C, LDC )* .. Scalar Arguments ..CHARACTER*1 UPLO, TRANSINTEGER N, K, LDA, LDCCOMPLEX*16 ALPHA, BETA* .. Array Arguments ..COMPLEX*16 A( LDA, * ), C( LDC, * )* ..** Purpose* =======** ZSYRK performs one of the symmetric rank k operations** C := alpha*A*A' + beta*C,** or** C := alpha*A'*A + beta*C,** where alpha and beta are scalars, C is an n by n symmetric matrix* and A is an n by k matrix in the first case and a k by n matrix* in the second case.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the upper or lower* triangular part of the array C is to be referenced as* follows:** UPLO = 'U' or 'u' Only the upper triangular part of C* is to be referenced.** UPLO = 'L' or 'l' Only the lower triangular part of C* is to be referenced.** Unchanged on exit.** TRANS - CHARACTER*1.* On entry, TRANS specifies the operation to be performed as* follows:** TRANS = 'N' or 'n' C := alpha*A*A' + beta*C.** TRANS = 'T' or 't' C := alpha*A'*A + beta*C.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix C. N must be* at least zero.* Unchanged on exit.** K - INTEGER.* On entry with TRANS = 'N' or 'n', K specifies the number* of columns of the matrix A, and on entry with* TRANS = 'T' or 't', K specifies the number of rows of the* matrix A. K must be at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, ka ), where ka is* k when TRANS = 'N' or 'n', and is n otherwise.* Before entry with TRANS = 'N' or 'n', the leading n by k* part of the array A must contain the matrix A, otherwise* the leading k by n part of the array A must contain the* matrix A.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. When TRANS = 'N' or 'n'* then LDA must be at least max( 1, n ), otherwise LDA must* be at least max( 1, k ).* Unchanged on exit.** BETA - COMPLEX*16 .* On entry, BETA specifies the scalar beta.* Unchanged on exit.** C - COMPLEX*16 array of DIMENSION ( LDC, n ).* Before entry with UPLO = 'U' or 'u', the leading n by n* upper triangular part of the array C must contain the upper* triangular part of the symmetric matrix and the strictly* lower triangular part of C is not referenced. On exit, the* upper triangular part of the array C is overwritten by the* upper triangular part of the updated matrix.* Before entry with UPLO = 'L' or 'l', the leading n by n* lower triangular part of the array C must contain the lower* triangular part of the symmetric matrix and the strictly* upper triangular part of C is not referenced. On exit, the* lower triangular part of the array C is overwritten by the* lower triangular part of the updated matrix.** LDC - INTEGER.* On entry, LDC specifies the first dimension of C as declared* in the calling (sub) program. LDC must be at least* max( 1, n ).* Unchanged on exit.*** Level 3 Blas routine.** -- Written on 8-February-1989.* Jack Dongarra, Argonne National Laboratory.* Iain Duff, AERE Harwell.* Jeremy Du Croz, Numerical Algorithms Group Ltd.* Sven Hammarling, Numerical Algorithms Group Ltd.*** .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC MAX* .. Local Scalars ..LOGICAL UPPERINTEGER I, INFO, J, L, NROWACOMPLEX*16 TEMP* .. Parameters ..COMPLEX*16 ONEPARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* ..* .. Executable Statements ..** Test the input parameters.*IF( LSAME( TRANS, 'N' ) )THENNROWA = NELSENROWA = KEND IFUPPER = LSAME( UPLO, 'U' )*INFO = 0IF( ( .NOT.UPPER ).AND.$ ( .NOT.LSAME( UPLO , 'L' ) ) )THENINFO = 1ELSE IF( ( .NOT.LSAME( TRANS, 'N' ) ).AND.$ ( .NOT.LSAME( TRANS, 'T' ) ) )THENINFO = 2ELSE IF( N .LT.0 )THENINFO = 3ELSE IF( K .LT.0 )THENINFO = 4ELSE IF( LDA.LT.MAX( 1, NROWA ) )THENINFO = 7ELSE IF( LDC.LT.MAX( 1, N ) )THENINFO = 10END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZSYRK ', INFO )RETURNEND IF** Quick return if possible.*IF( ( N.EQ.0 ).OR.$ ( ( ( ALPHA.EQ.ZERO ).OR.( K.EQ.0 ) ).AND.( BETA.EQ.ONE ) ) )$ RETURN** And when alpha.eq.zero.*IF( ALPHA.EQ.ZERO )THENIF( UPPER )THENIF( BETA.EQ.ZERO )THENDO 20, J = 1, NDO 10, I = 1, JC( I, J ) = ZERO10 CONTINUE20 CONTINUEELSEDO 40, J = 1, NDO 30, I = 1, JC( I, J ) = BETA*C( I, J )30 CONTINUE40 CONTINUEEND IFELSEIF( BETA.EQ.ZERO )THENDO 60, J = 1, NDO 50, I = J, NC( I, J ) = ZERO50 CONTINUE60 CONTINUEELSEDO 80, J = 1, NDO 70, I = J, NC( I, J ) = BETA*C( I, J )70 CONTINUE80 CONTINUEEND IFEND IFRETURNEND IF** Start the operations.*IF( LSAME( TRANS, 'N' ) )THEN** Form C := alpha*A*A' + beta*C.*IF( UPPER )THENDO 130, J = 1, NIF( BETA.EQ.ZERO )THENDO 90, I = 1, JC( I, J ) = ZERO90 CONTINUEELSE IF( BETA.NE.ONE )THENDO 100, I = 1, JC( I, J ) = BETA*C( I, J )100 CONTINUEEND IFDO 120, L = 1, Kc IF( A( J, L ).NE.ZERO )THENTEMP = ALPHA*A( J, L )DO 110, I = 1, JC( I, J ) = C( I, J ) + TEMP*A( I, L )110 CONTINUEc END IF120 CONTINUE130 CONTINUEELSEDO 180, J = 1, NIF( BETA.EQ.ZERO )THENDO 140, I = J, NC( I, J ) = ZERO140 CONTINUEELSE IF( BETA.NE.ONE )THENDO 150, I = J, NC( I, J ) = BETA*C( I, J )150 CONTINUEEND IFDO 170, L = 1, Kc IF( A( J, L ).NE.ZERO )THENTEMP = ALPHA*A( J, L )DO 160, I = J, NC( I, J ) = C( I, J ) + TEMP*A( I, L )160 CONTINUEc END IF170 CONTINUE180 CONTINUEEND IFELSE** Form C := alpha*A'*A + beta*C.*IF( UPPER )THENDO 210, J = 1, NDO 200, I = 1, JTEMP = ZERODO 190, L = 1, KTEMP = TEMP + A( L, I )*A( L, J )190 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = ALPHA*TEMPELSEC( I, J ) = ALPHA*TEMP + BETA*C( I, J )END IF200 CONTINUE210 CONTINUEELSEDO 240, J = 1, NDO 230, I = J, NTEMP = ZERODO 220, L = 1, KTEMP = TEMP + A( L, I )*A( L, J )220 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = ALPHA*TEMPELSEC( I, J ) = ALPHA*TEMP + BETA*C( I, J )END IF230 CONTINUE240 CONTINUEEND IFEND IF*RETURN** End of ZSYRK .*ENDSUBROUTINE ZTBMV ( UPLO, TRANS, DIAG, N, K, A, LDA, X, INCX )* .. Scalar Arguments ..INTEGER INCX, K, LDA, NCHARACTER*1 DIAG, TRANS, UPLO* .. Array Arguments ..COMPLEX*16 A( LDA, * ), X( * )* ..** Purpose* =======** ZTBMV performs one of the matrix-vector operations** x := A*x, or x := A'*x, or x := conjg( A' )*x,** where x is an n element vector and A is an n by n unit, or non-unit,* upper or lower triangular band matrix, with ( k + 1 ) diagonals.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the matrix is an upper or* lower triangular matrix as follows:** UPLO = 'U' or 'u' A is an upper triangular matrix.** UPLO = 'L' or 'l' A is a lower triangular matrix.** Unchanged on exit.** TRANS - CHARACTER*1.* On entry, TRANS specifies the operation to be performed as* follows:** TRANS = 'N' or 'n' x := A*x.** TRANS = 'T' or 't' x := A'*x.** TRANS = 'C' or 'c' x := conjg( A' )*x.** Unchanged on exit.** DIAG - CHARACTER*1.* On entry, DIAG specifies whether or not A is unit* triangular as follows:** DIAG = 'U' or 'u' A is assumed to be unit triangular.** DIAG = 'N' or 'n' A is not assumed to be unit* triangular.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix A.* N must be at least zero.* Unchanged on exit.** K - INTEGER.* On entry with UPLO = 'U' or 'u', K specifies the number of* super-diagonals of the matrix A.* On entry with UPLO = 'L' or 'l', K specifies the number of* sub-diagonals of the matrix A.* K must satisfy 0 .le. K.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, n ).* Before entry with UPLO = 'U' or 'u', the leading ( k + 1 )* by n part of the array A must contain the upper triangular* band part of the matrix of coefficients, supplied column by* column, with the leading diagonal of the matrix in row* ( k + 1 ) of the array, the first super-diagonal starting at* position 2 in row k, and so on. The top left k by k triangle* of the array A is not referenced.* The following program segment will transfer an upper* triangular band matrix from conventional full matrix storage* to band storage:** DO 20, J = 1, N* M = K + 1 - J* DO 10, I = MAX( 1, J - K ), J* A( M + I, J ) = matrix( I, J )* 10 CONTINUE* 20 CONTINUE** Before entry with UPLO = 'L' or 'l', the leading ( k + 1 )* by n part of the array A must contain the lower triangular* band part of the matrix of coefficients, supplied column by* column, with the leading diagonal of the matrix in row 1 of* the array, the first sub-diagonal starting at position 1 in* row 2, and so on. The bottom right k by k triangle of the* array A is not referenced.* The following program segment will transfer a lower* triangular band matrix from conventional full matrix storage* to band storage:** DO 20, J = 1, N* M = 1 - J* DO 10, I = J, MIN( N, J + K )* A( M + I, J ) = matrix( I, J )* 10 CONTINUE* 20 CONTINUE** Note that when DIAG = 'U' or 'u' the elements of the array A* corresponding to the diagonal elements of the matrix are not* referenced, but are assumed to be unity.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. LDA must be at least* ( k + 1 ).* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the n* element vector x. On exit, X is overwritten with the* tranformed vector x.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMPINTEGER I, INFO, IX, J, JX, KPLUS1, KX, LLOGICAL NOCONJ, NOUNIT* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX, MIN* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( UPLO , 'U' ).AND.$ .NOT.LSAME( UPLO , 'L' ) )THENINFO = 1ELSE IF( .NOT.LSAME( TRANS, 'N' ).AND.$ .NOT.LSAME( TRANS, 'T' ).AND.$ .NOT.LSAME( TRANS, 'C' ) )THENINFO = 2ELSE IF( .NOT.LSAME( DIAG , 'U' ).AND.$ .NOT.LSAME( DIAG , 'N' ) )THENINFO = 3ELSE IF( N.LT.0 )THENINFO = 4ELSE IF( K.LT.0 )THENINFO = 5ELSE IF( LDA.LT.( K + 1 ) )THENINFO = 7ELSE IF( INCX.EQ.0 )THENINFO = 9END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZTBMV ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN*NOCONJ = LSAME( TRANS, 'T' )NOUNIT = LSAME( DIAG , 'N' )** Set up the start point in X if the increment is not unity. This* will be ( N - 1 )*INCX too small for descending loops.*IF( INCX.LE.0 )THENKX = 1 - ( N - 1 )*INCXELSE IF( INCX.NE.1 )THENKX = 1END IF** Start the operations. In this version the elements of A are* accessed sequentially with one pass through A.*IF( LSAME( TRANS, 'N' ) )THEN** Form x := A*x.*IF( LSAME( UPLO, 'U' ) )THENKPLUS1 = K + 1IF( INCX.EQ.1 )THENDO 20, J = 1, Nc IF( X( J ).NE.ZERO )THENTEMP = X( J )L = KPLUS1 - JDO 10, I = MAX( 1, J - K ), J - 1X( I ) = X( I ) + TEMP*A( L + I, J )10 CONTINUEIF( NOUNIT )$ X( J ) = X( J )*A( KPLUS1, J )c END IF20 CONTINUEELSEJX = KXDO 40, J = 1, Nc IF( X( JX ).NE.ZERO )THENTEMP = X( JX )IX = KXL = KPLUS1 - JDO 30, I = MAX( 1, J - K ), J - 1X( IX ) = X( IX ) + TEMP*A( L + I, J )IX = IX + INCX30 CONTINUEIF( NOUNIT )$ X( JX ) = X( JX )*A( KPLUS1, J )c END IFJX = JX + INCXIF( J.GT.K )$ KX = KX + INCX40 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 60, J = N, 1, -1c IF( X( J ).NE.ZERO )THENTEMP = X( J )L = 1 - JDO 50, I = MIN( N, J + K ), J + 1, -1X( I ) = X( I ) + TEMP*A( L + I, J )50 CONTINUEIF( NOUNIT )$ X( J ) = X( J )*A( 1, J )c END IF60 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 80, J = N, 1, -1c IF( X( JX ).NE.ZERO )THENTEMP = X( JX )IX = KXL = 1 - JDO 70, I = MIN( N, J + K ), J + 1, -1X( IX ) = X( IX ) + TEMP*A( L + I, J )IX = IX - INCX70 CONTINUEIF( NOUNIT )$ X( JX ) = X( JX )*A( 1, J )c END IFJX = JX - INCXIF( ( N - J ).GE.K )$ KX = KX - INCX80 CONTINUEEND IFEND IFELSE** Form x := A'*x or x := conjg( A' )*x.*IF( LSAME( UPLO, 'U' ) )THENKPLUS1 = K + 1IF( INCX.EQ.1 )THENDO 110, J = N, 1, -1TEMP = X( J )L = KPLUS1 - JIF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*A( KPLUS1, J )DO 90, I = J - 1, MAX( 1, J - K ), -1TEMP = TEMP + A( L + I, J )*X( I )90 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( A( KPLUS1, J ) )DO 100, I = J - 1, MAX( 1, J - K ), -1TEMP = TEMP + DCONJG( A( L + I, J ) )*X( I )100 CONTINUEEND IFX( J ) = TEMP110 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 140, J = N, 1, -1TEMP = X( JX )KX = KX - INCXIX = KXL = KPLUS1 - JIF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*A( KPLUS1, J )DO 120, I = J - 1, MAX( 1, J - K ), -1TEMP = TEMP + A( L + I, J )*X( IX )IX = IX - INCX120 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( A( KPLUS1, J ) )DO 130, I = J - 1, MAX( 1, J - K ), -1TEMP = TEMP + DCONJG( A( L + I, J ) )*X( IX )IX = IX - INCX130 CONTINUEEND IFX( JX ) = TEMPJX = JX - INCX140 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 170, J = 1, NTEMP = X( J )L = 1 - JIF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*A( 1, J )DO 150, I = J + 1, MIN( N, J + K )TEMP = TEMP + A( L + I, J )*X( I )150 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( A( 1, J ) )DO 160, I = J + 1, MIN( N, J + K )TEMP = TEMP + DCONJG( A( L + I, J ) )*X( I )160 CONTINUEEND IFX( J ) = TEMP170 CONTINUEELSEJX = KXDO 200, J = 1, NTEMP = X( JX )KX = KX + INCXIX = KXL = 1 - JIF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*A( 1, J )DO 180, I = J + 1, MIN( N, J + K )TEMP = TEMP + A( L + I, J )*X( IX )IX = IX + INCX180 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( A( 1, J ) )DO 190, I = J + 1, MIN( N, J + K )TEMP = TEMP + DCONJG( A( L + I, J ) )*X( IX )IX = IX + INCX190 CONTINUEEND IFX( JX ) = TEMPJX = JX + INCX200 CONTINUEEND IFEND IFEND IF*RETURN** End of ZTBMV .*ENDSUBROUTINE ZTBSV ( UPLO, TRANS, DIAG, N, K, A, LDA, X, INCX )* .. Scalar Arguments ..INTEGER INCX, K, LDA, NCHARACTER*1 DIAG, TRANS, UPLO* .. Array Arguments ..COMPLEX*16 A( LDA, * ), X( * )* ..** Purpose* =======** ZTBSV solves one of the systems of equations** A*x = b, or A'*x = b, or conjg( A' )*x = b,** where b and x are n element vectors and A is an n by n unit, or* non-unit, upper or lower triangular band matrix, with ( k + 1 )* diagonals.** No test for singularity or near-singularity is included in this* routine. Such tests must be performed before calling this routine.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the matrix is an upper or* lower triangular matrix as follows:** UPLO = 'U' or 'u' A is an upper triangular matrix.** UPLO = 'L' or 'l' A is a lower triangular matrix.** Unchanged on exit.** TRANS - CHARACTER*1.* On entry, TRANS specifies the equations to be solved as* follows:** TRANS = 'N' or 'n' A*x = b.** TRANS = 'T' or 't' A'*x = b.** TRANS = 'C' or 'c' conjg( A' )*x = b.** Unchanged on exit.** DIAG - CHARACTER*1.* On entry, DIAG specifies whether or not A is unit* triangular as follows:** DIAG = 'U' or 'u' A is assumed to be unit triangular.** DIAG = 'N' or 'n' A is not assumed to be unit* triangular.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix A.* N must be at least zero.* Unchanged on exit.** K - INTEGER.* On entry with UPLO = 'U' or 'u', K specifies the number of* super-diagonals of the matrix A.* On entry with UPLO = 'L' or 'l', K specifies the number of* sub-diagonals of the matrix A.* K must satisfy 0 .le. K.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, n ).* Before entry with UPLO = 'U' or 'u', the leading ( k + 1 )* by n part of the array A must contain the upper triangular* band part of the matrix of coefficients, supplied column by* column, with the leading diagonal of the matrix in row* ( k + 1 ) of the array, the first super-diagonal starting at* position 2 in row k, and so on. The top left k by k triangle* of the array A is not referenced.* The following program segment will transfer an upper* triangular band matrix from conventional full matrix storage* to band storage:** DO 20, J = 1, N* M = K + 1 - J* DO 10, I = MAX( 1, J - K ), J* A( M + I, J ) = matrix( I, J )* 10 CONTINUE* 20 CONTINUE** Before entry with UPLO = 'L' or 'l', the leading ( k + 1 )* by n part of the array A must contain the lower triangular* band part of the matrix of coefficients, supplied column by* column, with the leading diagonal of the matrix in row 1 of* the array, the first sub-diagonal starting at position 1 in* row 2, and so on. The bottom right k by k triangle of the* array A is not referenced.* The following program segment will transfer a lower* triangular band matrix from conventional full matrix storage* to band storage:** DO 20, J = 1, N* M = 1 - J* DO 10, I = J, MIN( N, J + K )* A( M + I, J ) = matrix( I, J )* 10 CONTINUE* 20 CONTINUE** Note that when DIAG = 'U' or 'u' the elements of the array A* corresponding to the diagonal elements of the matrix are not* referenced, but are assumed to be unity.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. LDA must be at least* ( k + 1 ).* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the n* element right-hand side vector b. On exit, X is overwritten* with the solution vector x.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMPINTEGER I, INFO, IX, J, JX, KPLUS1, KX, LLOGICAL NOCONJ, NOUNIT* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX, MIN* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( UPLO , 'U' ).AND.$ .NOT.LSAME( UPLO , 'L' ) )THENINFO = 1ELSE IF( .NOT.LSAME( TRANS, 'N' ).AND.$ .NOT.LSAME( TRANS, 'T' ).AND.$ .NOT.LSAME( TRANS, 'C' ) )THENINFO = 2ELSE IF( .NOT.LSAME( DIAG , 'U' ).AND.$ .NOT.LSAME( DIAG , 'N' ) )THENINFO = 3ELSE IF( N.LT.0 )THENINFO = 4ELSE IF( K.LT.0 )THENINFO = 5ELSE IF( LDA.LT.( K + 1 ) )THENINFO = 7ELSE IF( INCX.EQ.0 )THENINFO = 9END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZTBSV ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN*NOCONJ = LSAME( TRANS, 'T' )NOUNIT = LSAME( DIAG , 'N' )** Set up the start point in X if the increment is not unity. This* will be ( N - 1 )*INCX too small for descending loops.*IF( INCX.LE.0 )THENKX = 1 - ( N - 1 )*INCXELSE IF( INCX.NE.1 )THENKX = 1END IF** Start the operations. In this version the elements of A are* accessed by sequentially with one pass through A.*IF( LSAME( TRANS, 'N' ) )THEN** Form x := inv( A )*x.*IF( LSAME( UPLO, 'U' ) )THENKPLUS1 = K + 1IF( INCX.EQ.1 )THENDO 20, J = N, 1, -1c IF( X( J ).NE.ZERO )THENL = KPLUS1 - JIF( NOUNIT )$ X( J ) = X( J )/A( KPLUS1, J )TEMP = X( J )DO 10, I = J - 1, MAX( 1, J - K ), -1X( I ) = X( I ) - TEMP*A( L + I, J )10 CONTINUEc END IF20 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 40, J = N, 1, -1KX = KX - INCXc IF( X( JX ).NE.ZERO )THENIX = KXL = KPLUS1 - JIF( NOUNIT )$ X( JX ) = X( JX )/A( KPLUS1, J )TEMP = X( JX )DO 30, I = J - 1, MAX( 1, J - K ), -1X( IX ) = X( IX ) - TEMP*A( L + I, J )IX = IX - INCX30 CONTINUEc END IFJX = JX - INCX40 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 60, J = 1, Nc IF( X( J ).NE.ZERO )THENL = 1 - JIF( NOUNIT )$ X( J ) = X( J )/A( 1, J )TEMP = X( J )DO 50, I = J + 1, MIN( N, J + K )X( I ) = X( I ) - TEMP*A( L + I, J )50 CONTINUEc END IF60 CONTINUEELSEJX = KXDO 80, J = 1, NKX = KX + INCXc IF( X( JX ).NE.ZERO )THENIX = KXL = 1 - JIF( NOUNIT )$ X( JX ) = X( JX )/A( 1, J )TEMP = X( JX )DO 70, I = J + 1, MIN( N, J + K )X( IX ) = X( IX ) - TEMP*A( L + I, J )IX = IX + INCX70 CONTINUEc END IFJX = JX + INCX80 CONTINUEEND IFEND IFELSE** Form x := inv( A' )*x or x := inv( conjg( A') )*x.*IF( LSAME( UPLO, 'U' ) )THENKPLUS1 = K + 1IF( INCX.EQ.1 )THENDO 110, J = 1, NTEMP = X( J )L = KPLUS1 - JIF( NOCONJ )THENDO 90, I = MAX( 1, J - K ), J - 1TEMP = TEMP - A( L + I, J )*X( I )90 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( KPLUS1, J )ELSEDO 100, I = MAX( 1, J - K ), J - 1TEMP = TEMP - DCONJG( A( L + I, J ) )*X( I )100 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( A( KPLUS1, J ) )END IFX( J ) = TEMP110 CONTINUEELSEJX = KXDO 140, J = 1, NTEMP = X( JX )IX = KXL = KPLUS1 - JIF( NOCONJ )THENDO 120, I = MAX( 1, J - K ), J - 1TEMP = TEMP - A( L + I, J )*X( IX )IX = IX + INCX120 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( KPLUS1, J )ELSEDO 130, I = MAX( 1, J - K ), J - 1TEMP = TEMP - DCONJG( A( L + I, J ) )*X( IX )IX = IX + INCX130 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( A( KPLUS1, J ) )END IFX( JX ) = TEMPJX = JX + INCXIF( J.GT.K )$ KX = KX + INCX140 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 170, J = N, 1, -1TEMP = X( J )L = 1 - JIF( NOCONJ )THENDO 150, I = MIN( N, J + K ), J + 1, -1TEMP = TEMP - A( L + I, J )*X( I )150 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( 1, J )ELSEDO 160, I = MIN( N, J + K ), J + 1, -1TEMP = TEMP - DCONJG( A( L + I, J ) )*X( I )160 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( A( 1, J ) )END IFX( J ) = TEMP170 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 200, J = N, 1, -1TEMP = X( JX )IX = KXL = 1 - JIF( NOCONJ )THENDO 180, I = MIN( N, J + K ), J + 1, -1TEMP = TEMP - A( L + I, J )*X( IX )IX = IX - INCX180 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( 1, J )ELSEDO 190, I = MIN( N, J + K ), J + 1, -1TEMP = TEMP - DCONJG( A( L + I, J ) )*X( IX )IX = IX - INCX190 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( A( 1, J ) )END IFX( JX ) = TEMPJX = JX - INCXIF( ( N - J ).GE.K )$ KX = KX - INCX200 CONTINUEEND IFEND IFEND IF*RETURN** End of ZTBSV .*ENDSUBROUTINE ZTPMV ( UPLO, TRANS, DIAG, N, AP, X, INCX )* .. Scalar Arguments ..INTEGER INCX, NCHARACTER*1 DIAG, TRANS, UPLO* .. Array Arguments ..COMPLEX*16 AP( * ), X( * )* ..** Purpose* =======** ZTPMV performs one of the matrix-vector operations** x := A*x, or x := A'*x, or x := conjg( A' )*x,** where x is an n element vector and A is an n by n unit, or non-unit,* upper or lower triangular matrix, supplied in packed form.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the matrix is an upper or* lower triangular matrix as follows:** UPLO = 'U' or 'u' A is an upper triangular matrix.** UPLO = 'L' or 'l' A is a lower triangular matrix.** Unchanged on exit.** TRANS - CHARACTER*1.* On entry, TRANS specifies the operation to be performed as* follows:** TRANS = 'N' or 'n' x := A*x.** TRANS = 'T' or 't' x := A'*x.** TRANS = 'C' or 'c' x := conjg( A' )*x.** Unchanged on exit.** DIAG - CHARACTER*1.* On entry, DIAG specifies whether or not A is unit* triangular as follows:** DIAG = 'U' or 'u' A is assumed to be unit triangular.** DIAG = 'N' or 'n' A is not assumed to be unit* triangular.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix A.* N must be at least zero.* Unchanged on exit.** AP - COMPLEX*16 array of DIMENSION at least* ( ( n*( n + 1 ) )/2 ).* Before entry with UPLO = 'U' or 'u', the array AP must* contain the upper triangular matrix packed sequentially,* column by column, so that AP( 1 ) contains a( 1, 1 ),* AP( 2 ) and AP( 3 ) contain a( 1, 2 ) and a( 2, 2 )* respectively, and so on.* Before entry with UPLO = 'L' or 'l', the array AP must* contain the lower triangular matrix packed sequentially,* column by column, so that AP( 1 ) contains a( 1, 1 ),* AP( 2 ) and AP( 3 ) contain a( 2, 1 ) and a( 3, 1 )* respectively, and so on.* Note that when DIAG = 'U' or 'u', the diagonal elements of* A are not referenced, but are assumed to be unity.* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the n* element vector x. On exit, X is overwritten with the* tranformed vector x.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMPINTEGER I, INFO, IX, J, JX, K, KK, KXLOGICAL NOCONJ, NOUNIT* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( UPLO , 'U' ).AND.$ .NOT.LSAME( UPLO , 'L' ) )THENINFO = 1ELSE IF( .NOT.LSAME( TRANS, 'N' ).AND.$ .NOT.LSAME( TRANS, 'T' ).AND.$ .NOT.LSAME( TRANS, 'C' ) )THENINFO = 2ELSE IF( .NOT.LSAME( DIAG , 'U' ).AND.$ .NOT.LSAME( DIAG , 'N' ) )THENINFO = 3ELSE IF( N.LT.0 )THENINFO = 4ELSE IF( INCX.EQ.0 )THENINFO = 7END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZTPMV ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN*NOCONJ = LSAME( TRANS, 'T' )NOUNIT = LSAME( DIAG , 'N' )** Set up the start point in X if the increment is not unity. This* will be ( N - 1 )*INCX too small for descending loops.*IF( INCX.LE.0 )THENKX = 1 - ( N - 1 )*INCXELSE IF( INCX.NE.1 )THENKX = 1END IF** Start the operations. In this version the elements of AP are* accessed sequentially with one pass through AP.*IF( LSAME( TRANS, 'N' ) )THEN** Form x:= A*x.*IF( LSAME( UPLO, 'U' ) )THENKK = 1IF( INCX.EQ.1 )THENDO 20, J = 1, Nc IF( X( J ).NE.ZERO )THENTEMP = X( J )K = KKDO 10, I = 1, J - 1X( I ) = X( I ) + TEMP*AP( K )K = K + 110 CONTINUEIF( NOUNIT )$ X( J ) = X( J )*AP( KK + J - 1 )c END IFKK = KK + J20 CONTINUEELSEJX = KXDO 40, J = 1, Nc IF( X( JX ).NE.ZERO )THENTEMP = X( JX )IX = KXDO 30, K = KK, KK + J - 2X( IX ) = X( IX ) + TEMP*AP( K )IX = IX + INCX30 CONTINUEIF( NOUNIT )$ X( JX ) = X( JX )*AP( KK + J - 1 )c END IFJX = JX + INCXKK = KK + J40 CONTINUEEND IFELSEKK = ( N*( N + 1 ) )/2IF( INCX.EQ.1 )THENDO 60, J = N, 1, -1c IF( X( J ).NE.ZERO )THENTEMP = X( J )K = KKDO 50, I = N, J + 1, -1X( I ) = X( I ) + TEMP*AP( K )K = K - 150 CONTINUEIF( NOUNIT )$ X( J ) = X( J )*AP( KK - N + J )c END IFKK = KK - ( N - J + 1 )60 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 80, J = N, 1, -1c IF( X( JX ).NE.ZERO )THENTEMP = X( JX )IX = KXDO 70, K = KK, KK - ( N - ( J + 1 ) ), -1X( IX ) = X( IX ) + TEMP*AP( K )IX = IX - INCX70 CONTINUEIF( NOUNIT )$ X( JX ) = X( JX )*AP( KK - N + J )c END IFJX = JX - INCXKK = KK - ( N - J + 1 )80 CONTINUEEND IFEND IFELSE** Form x := A'*x or x := conjg( A' )*x.*IF( LSAME( UPLO, 'U' ) )THENKK = ( N*( N + 1 ) )/2IF( INCX.EQ.1 )THENDO 110, J = N, 1, -1TEMP = X( J )K = KK - 1IF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*AP( KK )DO 90, I = J - 1, 1, -1TEMP = TEMP + AP( K )*X( I )K = K - 190 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( AP( KK ) )DO 100, I = J - 1, 1, -1TEMP = TEMP + DCONJG( AP( K ) )*X( I )K = K - 1100 CONTINUEEND IFX( J ) = TEMPKK = KK - J110 CONTINUEELSEJX = KX + ( N - 1 )*INCXDO 140, J = N, 1, -1TEMP = X( JX )IX = JXIF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*AP( KK )DO 120, K = KK - 1, KK - J + 1, -1IX = IX - INCXTEMP = TEMP + AP( K )*X( IX )120 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( AP( KK ) )DO 130, K = KK - 1, KK - J + 1, -1IX = IX - INCXTEMP = TEMP + DCONJG( AP( K ) )*X( IX )130 CONTINUEEND IFX( JX ) = TEMPJX = JX - INCXKK = KK - J140 CONTINUEEND IFELSEKK = 1IF( INCX.EQ.1 )THENDO 170, J = 1, NTEMP = X( J )K = KK + 1IF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*AP( KK )DO 150, I = J + 1, NTEMP = TEMP + AP( K )*X( I )K = K + 1150 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( AP( KK ) )DO 160, I = J + 1, NTEMP = TEMP + DCONJG( AP( K ) )*X( I )K = K + 1160 CONTINUEEND IFX( J ) = TEMPKK = KK + ( N - J + 1 )170 CONTINUEELSEJX = KXDO 200, J = 1, NTEMP = X( JX )IX = JXIF( NOCONJ )THENIF( NOUNIT )$ TEMP = TEMP*AP( KK )DO 180, K = KK + 1, KK + N - JIX = IX + INCXTEMP = TEMP + AP( K )*X( IX )180 CONTINUEELSEIF( NOUNIT )$ TEMP = TEMP*DCONJG( AP( KK ) )DO 190, K = KK + 1, KK + N - JIX = IX + INCXTEMP = TEMP + DCONJG( AP( K ) )*X( IX )190 CONTINUEEND IFX( JX ) = TEMPJX = JX + INCXKK = KK + ( N - J + 1 )200 CONTINUEEND IFEND IFEND IF*RETURN** End of ZTPMV .*ENDSUBROUTINE ZTPSV ( UPLO, TRANS, DIAG, N, AP, X, INCX )* .. Scalar Arguments ..INTEGER INCX, NCHARACTER*1 DIAG, TRANS, UPLO* .. Array Arguments ..COMPLEX*16 AP( * ), X( * )* ..** Purpose* =======** ZTPSV solves one of the systems of equations** A*x = b, or A'*x = b, or conjg( A' )*x = b,** where b and x are n element vectors and A is an n by n unit, or* non-unit, upper or lower triangular matrix, supplied in packed form.** No test for singularity or near-singularity is included in this* routine. Such tests must be performed before calling this routine.** Parameters* ==========** UPLO - CHARACTER*1.* On entry, UPLO specifies whether the matrix is an upper or* lower triangular matrix as follows:** UPLO = 'U' or 'u' A is an upper triangular matrix.** UPLO = 'L' or 'l' A is a lower triangular matrix.** Unchanged on exit.** TRANS - CHARACTER*1.* On entry, TRANS specifies the equations to be solved as* follows:** TRANS = 'N' or 'n' A*x = b.** TRANS = 'T' or 't' A'*x = b.** TRANS = 'C' or 'c' conjg( A' )*x = b.** Unchanged on exit.** DIAG - CHARACTER*1.* On entry, DIAG specifies whether or not A is unit* triangular as follows:** DIAG = 'U' or 'u' A is assumed to be unit triangular.** DIAG = 'N' or 'n' A is not assumed to be unit* triangular.** Unchanged on exit.** N - INTEGER.* On entry, N specifies the order of the matrix A.* N must be at least zero.* Unchanged on exit.** AP - COMPLEX*16 array of DIMENSION at least* ( ( n*( n + 1 ) )/2 ).* Before entry with UPLO = 'U' or 'u', the array AP must* contain the upper triangular matrix packed sequentially,* column by column, so that AP( 1 ) contains a( 1, 1 ),* AP( 2 ) and AP( 3 ) contain a( 1, 2 ) and a( 2, 2 )* respectively, and so on.* Before entry with UPLO = 'L' or 'l', the array AP must* contain the lower triangular matrix packed sequentially,* column by column, so that AP( 1 ) contains a( 1, 1 ),* AP( 2 ) and AP( 3 ) contain a( 2, 1 ) and a( 3, 1 )* respectively, and so on.* Note that when DIAG = 'U' or 'u', the diagonal elements of* A are not referenced, but are assumed to be unity.* Unchanged on exit.** X - COMPLEX*16 array of dimension at least* ( 1 + ( n - 1 )*abs( INCX ) ).* Before entry, the incremented array X must contain the n* element right-hand side vector b. On exit, X is overwritten* with the solution vector x.** INCX - INTEGER.* On entry, INCX specifies the increment for the elements of* X. INCX must not be zero.* Unchanged on exit.*** Level 2 Blas routine.** -- Written on 22-October-1986.* Jack Dongarra, Argonne National Lab.* Jeremy Du Croz, Nag Central Office.* Sven Hammarling, Nag Central Office.* Richard Hanson, Sandia National Labs.*** .. Parameters ..COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* .. Local Scalars ..COMPLEX*16 TEMPINTEGER I, INFO, IX, J, JX, K, KK, KXLOGICAL NOCONJ, NOUNIT* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG* ..* .. Executable Statements ..** Test the input parameters.*INFO = 0IF ( .NOT.LSAME( UPLO , 'U' ).AND.$ .NOT.LSAME( UPLO , 'L' ) )THENINFO = 1ELSE IF( .NOT.LSAME( TRANS, 'N' ).AND.$ .NOT.LSAME( TRANS, 'T' ).AND.$ .NOT.LSAME( TRANS, 'C' ) )THENINFO = 2ELSE IF( .NOT.LSAME( DIAG , 'U' ).AND.$ .NOT.LSAME( DIAG , 'N' ) )THENINFO = 3ELSE IF( N.LT.0 )THENINFO = 4ELSE IF( INCX.EQ.0 )THENINFO = 7END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZTPSV ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN*NOCONJ = LSAME( TRANS, 'T' )NOUNIT = LSAME( DIAG , 'N' )** Set up the start point in X if the increment is not unity. This* will be ( N - 1 )*INCX too small for descending loops.*IF( INCX.LE.0 )THENKX = 1 - ( N - 1 )*INCXELSE IF( INCX.NE.1 )THENKX = 1END IF** Start the operations. In this version the elements of AP are* accessed sequentially with one pass through AP.*IF( LSAME( TRANS, 'N' ) )THEN** Form x := inv( A )*x.*IF( LSAME( UPLO, 'U' ) )THENKK = ( N*( N + 1 ) )/2IF( INCX.EQ.1 )THENDO 20, J = N, 1, -1c IF( X( J ).NE.ZERO )THENIF( NOUNIT )$ X( J ) = X( J )/AP( KK )TEMP = X( J )K = KK - 1DO 10, I = J - 1, 1, -1X( I ) = X( I ) - TEMP*AP( K )K = K - 110 CONTINUEc END IFKK = KK - J20 CONTINUEELSEJX = KX + ( N - 1 )*INCXDO 40, J = N, 1, -1c IF( X( JX ).NE.ZERO )THENIF( NOUNIT )$ X( JX ) = X( JX )/AP( KK )TEMP = X( JX )IX = JXDO 30, K = KK - 1, KK - J + 1, -1IX = IX - INCXX( IX ) = X( IX ) - TEMP*AP( K )30 CONTINUEc END IFJX = JX - INCXKK = KK - J40 CONTINUEEND IFELSEKK = 1IF( INCX.EQ.1 )THENDO 60, J = 1, Nc IF( X( J ).NE.ZERO )THENIF( NOUNIT )$ X( J ) = X( J )/AP( KK )TEMP = X( J )K = KK + 1DO 50, I = J + 1, NX( I ) = X( I ) - TEMP*AP( K )K = K + 150 CONTINUEc END IFKK = KK + ( N - J + 1 )60 CONTINUEELSEJX = KXDO 80, J = 1, Nc IF( X( JX ).NE.ZERO )THENIF( NOUNIT )$ X( JX ) = X( JX )/AP( KK )TEMP = X( JX )IX = JXDO 70, K = KK + 1, KK + N - JIX = IX + INCXX( IX ) = X( IX ) - TEMP*AP( K )70 CONTINUEc END IFJX = JX + INCXKK = KK + ( N - J + 1 )80 CONTINUEEND IFEND IFELSE** Form x := inv( A' )*x or x := inv( conjg( A' ) )*x.*IF( LSAME( UPLO, 'U' ) )THENKK = 1IF( INCX.EQ.1 )THENDO 110, J = 1, NTEMP = X( J )K = KKIF( NOCONJ )THENDO 90, I = 1, J - 1TEMP = TEMP - AP( K )*X( I )K = K + 190 CONTINUEIF( NOUNIT )$ TEMP = TEMP/AP( KK + J - 1 )ELSEDO 100, I = 1, J - 1TEMP = TEMP - DCONJG( AP( K ) )*X( I )K = K + 1100 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( AP( KK + J - 1 ) )END IFX( J ) = TEMPKK = KK + J110 CONTINUEELSEJX = KXDO 140, J = 1, NTEMP = X( JX )IX = KXIF( NOCONJ )THENDO 120, K = KK, KK + J - 2TEMP = TEMP - AP( K )*X( IX )IX = IX + INCX120 CONTINUEIF( NOUNIT )$ TEMP = TEMP/AP( KK + J - 1 )ELSEDO 130, K = KK, KK + J - 2TEMP = TEMP - DCONJG( AP( K ) )*X( IX )IX = IX + INCX130 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( AP( KK + J - 1 ) )END IFX( JX ) = TEMPJX = JX + INCXKK = KK + J140 CONTINUEEND IFELSEKK = ( N*( N + 1 ) )/2IF( INCX.EQ.1 )THENDO 170, J = N, 1, -1TEMP = X( J )K = KKIF( NOCONJ )THENDO 150, I = N, J + 1, -1TEMP = TEMP - AP( K )*X( I )K = K - 1150 CONTINUEIF( NOUNIT )$ TEMP = TEMP/AP( KK - N + J )ELSEDO 160, I = N, J + 1, -1TEMP = TEMP - DCONJG( AP( K ) )*X( I )K = K - 1160 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( AP( KK - N + J ) )END IFX( J ) = TEMPKK = KK - ( N - J + 1 )170 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 200, J = N, 1, -1TEMP = X( JX )IX = KXIF( NOCONJ )THENDO 180, K = KK, KK - ( N - ( J + 1 ) ), -1TEMP = TEMP - AP( K )*X( IX )IX = IX - INCX180 CONTINUEIF( NOUNIT )$ TEMP = TEMP/AP( KK - N + J )ELSEDO 190, K = KK, KK - ( N - ( J + 1 ) ), -1TEMP = TEMP - DCONJG( AP( K ) )*X( IX )IX = IX - INCX190 CONTINUEIF( NOUNIT )$ TEMP = TEMP/DCONJG( AP( KK - N + J ) )END IFX( JX ) = TEMPJX = JX - INCXKK = KK - ( N - J + 1 )200 CONTINUEEND IFEND IFEND IF*RETURN** End of ZTPSV .*ENDSUBROUTINE ZGEMM ( TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB,$ BETA, C, LDC )* .. Scalar Arguments ..CHARACTER*1 TRANSA, TRANSBINTEGER M, N, K, LDA, LDB, LDCCOMPLEX*16 ALPHA, BETA* .. Array Arguments ..COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * )* ..** Purpose* =======** ZGEMM performs one of the matrix-matrix operations** C := alpha*op( A )*op( B ) + beta*C,** where op( X ) is one of** op( X ) = X or op( X ) = X' or op( X ) = conjg( X' ),** alpha and beta are scalars, and A, B and C are matrices, with op( A )* an m by k matrix, op( B ) a k by n matrix and C an m by n matrix.** Parameters* ==========** TRANSA - CHARACTER*1.* On entry, TRANSA specifies the form of op( A ) to be used in* the matrix multiplication as follows:** TRANSA = 'N' or 'n', op( A ) = A.** TRANSA = 'T' or 't', op( A ) = A'.** TRANSA = 'C' or 'c', op( A ) = conjg( A' ).** Unchanged on exit.** TRANSB - CHARACTER*1.* On entry, TRANSB specifies the form of op( B ) to be used in* the matrix multiplication as follows:** TRANSB = 'N' or 'n', op( B ) = B.** TRANSB = 'T' or 't', op( B ) = B'.** TRANSB = 'C' or 'c', op( B ) = conjg( B' ).** Unchanged on exit.** M - INTEGER.* On entry, M specifies the number of rows of the matrix* op( A ) and of the matrix C. M must be at least zero.* Unchanged on exit.** N - INTEGER.* On entry, N specifies the number of columns of the matrix* op( B ) and the number of columns of the matrix C. N must be* at least zero.* Unchanged on exit.** K - INTEGER.* On entry, K specifies the number of columns of the matrix* op( A ) and the number of rows of the matrix op( B ). K must* be at least zero.* Unchanged on exit.** ALPHA - COMPLEX*16 .* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - COMPLEX*16 array of DIMENSION ( LDA, ka ), where ka is* k when TRANSA = 'N' or 'n', and is m otherwise.* Before entry with TRANSA = 'N' or 'n', the leading m by k* part of the array A must contain the matrix A, otherwise* the leading k by m part of the array A must contain the* matrix A.* Unchanged on exit.** LDA - INTEGER.* On entry, LDA specifies the first dimension of A as declared* in the calling (sub) program. When TRANSA = 'N' or 'n' then* LDA must be at least max( 1, m ), otherwise LDA must be at* least max( 1, k ).* Unchanged on exit.** B - COMPLEX*16 array of DIMENSION ( LDB, kb ), where kb is* n when TRANSB = 'N' or 'n', and is k otherwise.* Before entry with TRANSB = 'N' or 'n', the leading k by n* part of the array B must contain the matrix B, otherwise* the leading n by k part of the array B must contain the* matrix B.* Unchanged on exit.** LDB - INTEGER.* On entry, LDB specifies the first dimension of B as declared* in the calling (sub) program. When TRANSB = 'N' or 'n' then* LDB must be at least max( 1, k ), otherwise LDB must be at* least max( 1, n ).* Unchanged on exit.** BETA - COMPLEX*16 .* On entry, BETA specifies the scalar beta. When BETA is* supplied as zero then C need not be set on input.* Unchanged on exit.** C - COMPLEX*16 array of DIMENSION ( LDC, n ).* Before entry, the leading m by n part of the array C must* contain the matrix C, except when beta is zero, in which* case C need not be set on entry.* On exit, the array C is overwritten by the m by n matrix* ( alpha*op( A )*op( B ) + beta*C ).** LDC - INTEGER.* On entry, LDC specifies the first dimension of C as declared* in the calling (sub) program. LDC must be at least* max( 1, m ).* Unchanged on exit.*** Level 3 Blas routine.** -- Written on 8-February-1989.* Jack Dongarra, Argonne National Laboratory.* Iain Duff, AERE Harwell.* Jeremy Du Croz, Numerical Algorithms Group Ltd.* Sven Hammarling, Numerical Algorithms Group Ltd.*** .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC DCONJG, MAX* .. Local Scalars ..LOGICAL CONJA, CONJB, NOTA, NOTBINTEGER I, INFO, J, L, NCOLA, NROWA, NROWBCOMPLEX*16 TEMP* .. Parameters ..COMPLEX*16 ONEPARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )COMPLEX*16 ZEROPARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )* ..* .. Executable Statements ..** Set NOTA and NOTB as true if A and B respectively are not* conjugated or transposed, set CONJA and CONJB as true if A and* B respectively are to be transposed but not conjugated and set* NROWA, NCOLA and NROWB as the number of rows and columns of A* and the number of rows of B respectively.*NOTA = LSAME( TRANSA, 'N' )NOTB = LSAME( TRANSB, 'N' )CONJA = LSAME( TRANSA, 'C' )CONJB = LSAME( TRANSB, 'C' )IF( NOTA )THENNROWA = MNCOLA = KELSENROWA = KNCOLA = MEND IFIF( NOTB )THENNROWB = KELSENROWB = NEND IF** Test the input parameters.*INFO = 0IF( ( .NOT.NOTA ).AND.$ ( .NOT.CONJA ).AND.$ ( .NOT.LSAME( TRANSA, 'T' ) ) )THENINFO = 1ELSE IF( ( .NOT.NOTB ).AND.$ ( .NOT.CONJB ).AND.$ ( .NOT.LSAME( TRANSB, 'T' ) ) )THENINFO = 2ELSE IF( M .LT.0 )THENINFO = 3ELSE IF( N .LT.0 )THENINFO = 4ELSE IF( K .LT.0 )THENINFO = 5ELSE IF( LDA.LT.MAX( 1, NROWA ) )THENINFO = 8ELSE IF( LDB.LT.MAX( 1, NROWB ) )THENINFO = 10ELSE IF( LDC.LT.MAX( 1, M ) )THENINFO = 13END IFIF( INFO.NE.0 )THENCALL XERBLA( 'ZGEMM ', INFO )RETURNEND IF** Quick return if possible.*IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.$ ( ( ( ALPHA.EQ.ZERO ).OR.( K.EQ.0 ) ).AND.( BETA.EQ.ONE ) ) )$ RETURN** And when alpha.eq.zero.*IF( ALPHA.EQ.ZERO )THENIF( BETA.EQ.ZERO )THENDO 20, J = 1, NDO 10, I = 1, MC( I, J ) = ZERO10 CONTINUE20 CONTINUEELSEDO 40, J = 1, NDO 30, I = 1, MC( I, J ) = BETA*C( I, J )30 CONTINUE40 CONTINUEEND IFRETURNEND IF** Start the operations.*IF( NOTB )THENIF( NOTA )THEN** Form C := alpha*A*B + beta*C.*DO 90, J = 1, NIF( BETA.EQ.ZERO )THENDO 50, I = 1, MC( I, J ) = ZERO50 CONTINUEELSE IF( BETA.NE.ONE )THENDO 60, I = 1, MC( I, J ) = BETA*C( I, J )60 CONTINUEEND IFDO 80, L = 1, Kc IF( B( L, J ).NE.ZERO )THENTEMP = ALPHA*B( L, J )DO 70, I = 1, MC( I, J ) = C( I, J ) + TEMP*A( I, L )70 CONTINUEc END IF80 CONTINUE90 CONTINUEELSE IF( CONJA )THEN** Form C := alpha*conjg( A' )*B + beta*C.*DO 120, J = 1, NDO 110, I = 1, MTEMP = ZERODO 100, L = 1, KTEMP = TEMP + DCONJG( A( L, I ) )*B( L, J )100 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = ALPHA*TEMPELSEC( I, J ) = ALPHA*TEMP + BETA*C( I, J )END IF110 CONTINUE120 CONTINUEELSE** Form C := alpha*A'*B + beta*C*DO 150, J = 1, NDO 140, I = 1, MTEMP = ZERODO 130, L = 1, KTEMP = TEMP + A( L, I )*B( L, J )130 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = ALPHA*TEMPELSEC( I, J ) = ALPHA*TEMP + BETA*C( I, J )END IF140 CONTINUE150 CONTINUEEND IFELSE IF( NOTA )THENIF( CONJB )THEN** Form C := alpha*A*conjg( B' ) + beta*C.*DO 200, J = 1, NIF( BETA.EQ.ZERO )THENDO 160, I = 1, MC( I, J ) = ZERO160 CONTINUEELSE IF( BETA.NE.ONE )THENDO 170, I = 1, MC( I, J ) = BETA*C( I, J )170 CONTINUEEND IFDO 190, L = 1, Kc IF( B( J, L ).NE.ZERO )THENTEMP = ALPHA*DCONJG( B( J, L ) )DO 180, I = 1, MC( I, J ) = C( I, J ) + TEMP*A( I, L )180 CONTINUEc END IF190 CONTINUE200 CONTINUEELSE** Form C := alpha*A*B' + beta*C*DO 250, J = 1, NIF( BETA.EQ.ZERO )THENDO 210, I = 1, MC( I, J ) = ZERO210 CONTINUEELSE IF( BETA.NE.ONE )THENDO 220, I = 1, MC( I, J ) = BETA*C( I, J )220 CONTINUEEND IFDO 240, L = 1, Kc IF( B( J, L ).NE.ZERO )THENTEMP = ALPHA*B( J, L )DO 230, I = 1, MC( I, J ) = C( I, J ) + TEMP*A( I, L )230 CONTINUEc END IF240 CONTINUE250 CONTINUEEND IFELSE IF( CONJA )THENIF( CONJB )THEN** Form C := alpha*conjg( A' )*conjg( B' ) + beta*C.*DO 280, J = 1, NDO 270, I = 1, MTEMP = ZERODO 260, L = 1, KTEMP = TEMP +$ DCONJG( A( L, I ) )*DCONJG( B( J, L ) )260 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = ALPHA*TEMPELSEC( I, J ) = ALPHA*TEMP + BETA*C( I, J )END IF270 CONTINUE280 CONTINUEELSE** Form C := alpha*conjg( A' )*B' + beta*C*DO 310, J = 1, NDO 300, I = 1, MTEMP = ZERODO 290, L = 1, KTEMP = TEMP + DCONJG( A( L, I ) )*B( J, L )290 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = ALPHA*TEMPELSEC( I, J ) = ALPHA*TEMP + BETA*C( I, J )END IF300 CONTINUE310 CONTINUEEND IFELSEIF( CONJB )THEN** Form C := alpha*A'*conjg( B' ) + beta*C*DO 340, J = 1, NDO 330, I = 1, MTEMP = ZERODO 320, L = 1, KTEMP = TEMP + A( L, I )*DCONJG( B( J, L ) )320 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = ALPHA*TEMPELSEC( I, J ) = ALPHA*TEMP + BETA*C( I, J )END IF330 CONTINUE340 CONTINUEELSE** Form C := alpha*A'*B' + beta*C*DO 370, J = 1, NDO 360, I = 1, MTEMP = ZERODO 350, L = 1, KTEMP = TEMP + A( L, I )*B( J, L )350 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = ALPHA*TEMPELSEC( I, J ) = ALPHA*TEMP + BETA*C( I, J )END IF360 CONTINUE370 CONTINUEEND IFEND IF*RETURN** End of ZGEMM .*END