Rev 23175 | Blame | Last modification | View Log | Download | RSS feed
double precision function dasum(n,dx,incx)cc takes the sum of the absolute values.c jack dongarra, linpack, 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 precision dx(*),dtempinteger i,incx,m,mp1,n,nincxcdasum = 0.0d0dtemp = 0.0d0if( n.le.0 .or. incx.le.0 )returnif(incx.eq.1)go to 20cc code for increment not equal to 1cnincx = n*incxdo 10 i = 1,nincx,incxdtemp = dtemp + dabs(dx(i))10 continuedasum = dtempreturncc code for increment equal to 1ccc clean-up loopc20 m = mod(n,6)if( m .eq. 0 ) go to 40do 30 i = 1,mdtemp = dtemp + dabs(dx(i))30 continueif( n .lt. 6 ) go to 6040 mp1 = m + 1do 50 i = mp1,n,6dtemp = dtemp + dabs(dx(i)) + dabs(dx(i + 1)) + dabs(dx(i + 2))* + dabs(dx(i + 3)) + dabs(dx(i + 4)) + dabs(dx(i + 5))50 continue60 dasum = dtempreturnendsubroutine daxpy(n,da,dx,incx,dy,incy)cc constant times a vector plus a vector.c uses unrolled loops for increments equal to one.c jack dongarra, linpack, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)cdouble precision dx(*),dy(*),dainteger i,incx,incy,ix,iy,m,mp1,ncif(n.le.0)returnif (da .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,ndy(iy) = dy(iy) + da*dx(ix)ix = ix + incxiy = iy + incy10 continuereturncc code for both increments equal to 1ccc clean-up loopc20 m = mod(n,4)if( m .eq. 0 ) go to 40do 30 i = 1,mdy(i) = dy(i) + da*dx(i)30 continueif( n .lt. 4 ) return40 mp1 = m + 1do 50 i = mp1,n,4dy(i) = dy(i) + da*dx(i)dy(i + 1) = dy(i + 1) + da*dx(i + 1)dy(i + 2) = dy(i + 2) + da*dx(i + 2)dy(i + 3) = dy(i + 3) + da*dx(i + 3)50 continuereturnendsubroutine dcopy(n,dx,incx,dy,incy)cc copies a vector, x, to a vector, y.c uses unrolled loops for increments equal to one.c jack dongarra, linpack, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)cdouble precision dx(*),dy(*)integer i,incx,incy,ix,iy,m,mp1,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,ndy(iy) = dx(ix)ix = ix + incxiy = iy + incy10 continuereturncc code for both increments equal to 1ccc clean-up loopc20 m = mod(n,7)if( m .eq. 0 ) go to 40do 30 i = 1,mdy(i) = dx(i)30 continueif( n .lt. 7 ) return40 mp1 = m + 1do 50 i = mp1,n,7dy(i) = dx(i)dy(i + 1) = dx(i + 1)dy(i + 2) = dx(i + 2)dy(i + 3) = dx(i + 3)dy(i + 4) = dx(i + 4)dy(i + 5) = dx(i + 5)dy(i + 6) = dx(i + 6)50 continuereturnenddouble precision function ddot(n,dx,incx,dy,incy)cc forms the dot product of two vectors.c uses unrolled loops for increments equal to one.c jack dongarra, linpack, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)cdouble precision dx(*),dy(*),dtempinteger i,incx,incy,ix,iy,m,mp1,ncddot = 0.0d0dtemp = 0.0d0if(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,ndtemp = dtemp + dx(ix)*dy(iy)ix = ix + incxiy = iy + incy10 continueddot = dtempreturncc code for both increments equal to 1ccc clean-up loopc20 m = mod(n,5)if( m .eq. 0 ) go to 40do 30 i = 1,mdtemp = dtemp + dx(i)*dy(i)30 continueif( n .lt. 5 ) go to 6040 mp1 = m + 1do 50 i = mp1,n,5dtemp = dtemp + dx(i)*dy(i) + dx(i + 1)*dy(i + 1) +* dx(i + 2)*dy(i + 2) + dx(i + 3)*dy(i + 3) + dx(i + 4)*dy(i + 4)50 continue60 ddot = dtempreturnendSUBROUTINE DGBMV ( TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX,$ BETA, Y, INCY )* .. Scalar Arguments ..DOUBLE PRECISION ALPHA, BETAINTEGER INCX, INCY, KL, KU, LDA, M, NCHARACTER*1 TRANS* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), X( * ), Y( * )* ..** Purpose* =======** DGBMV performs one of the matrix-vector operations** y := alpha*A*x + beta*y, or y := alpha*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*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 - DOUBLE PRECISION.* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION.* 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 - DOUBLE PRECISION 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 ..DOUBLE PRECISION ONE , ZEROPARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMPINTEGER I, INFO, IX, IY, J, JX, JY, K, KUP1, KX, KY,$ LENX, LENY* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC 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( 'DGBMV ', INFO )RETURNEND IF** Quick return if possible.*IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.$ ( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )$ RETURN** 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, NIF( 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 CONTINUEEND IFJX = JX + INCX60 CONTINUEELSEDO 80, J = 1, NIF( 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 CONTINUEEND IFJX = JX + INCXIF( J.GT.KU )$ KY = KY + INCY80 CONTINUEEND IFELSE** Form y := alpha*A'*x + y.*JY = KYIF( INCX.EQ.1 )THENDO 100, J = 1, NTEMP = ZEROK = KUP1 - JDO 90, I = MAX( 1, J - KU ), MIN( M, J + KL )TEMP = TEMP + A( K + I, J )*X( I )90 CONTINUEY( JY ) = Y( JY ) + ALPHA*TEMPJY = JY + INCY100 CONTINUEELSEDO 120, J = 1, NTEMP = ZEROIX = KXK = KUP1 - JDO 110, I = MAX( 1, J - KU ), MIN( M, J + KL )TEMP = TEMP + A( K + I, J )*X( IX )IX = IX + INCX110 CONTINUEY( JY ) = Y( JY ) + ALPHA*TEMPJY = JY + INCYIF( J.GT.KU )$ KX = KX + INCX120 CONTINUEEND IFEND IF*RETURN** End of DGBMV .*ENDSUBROUTINE DGEMM ( TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB,$ BETA, C, LDC )* .. Scalar Arguments ..CHARACTER*1 TRANSA, TRANSBINTEGER M, N, K, LDA, LDB, LDCDOUBLE PRECISION ALPHA, BETA* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * )* ..** Purpose* =======** DGEMM 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',** 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 ) = 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 ) = 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 - DOUBLE PRECISION.* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION.* 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 - DOUBLE PRECISION 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 MAX* .. Local Scalars ..LOGICAL NOTA, NOTBINTEGER I, INFO, J, L, NCOLA, NROWA, NROWBDOUBLE PRECISION TEMP* .. Parameters ..DOUBLE PRECISION ONE , ZEROPARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )* ..* .. Executable Statements ..** Set NOTA and NOTB as true if A and B respectively are not* transposed 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' )IF( NOTA )THENNROWA = MNCOLA = KELSENROWA = KNCOLA = MEND IFIF( NOTB )THENNROWB = KELSENROWB = NEND IF** Test the input parameters.*INFO = 0IF( ( .NOT.NOTA ).AND.$ ( .NOT.LSAME( TRANSA, 'C' ) ).AND.$ ( .NOT.LSAME( TRANSA, 'T' ) ) )THENINFO = 1ELSE IF( ( .NOT.NOTB ).AND.$ ( .NOT.LSAME( TRANSB, 'C' ) ).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( 'DGEMM ', 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 if 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, KIF( 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 CONTINUEEND IF80 CONTINUE90 CONTINUEELSE** Form C := alpha*A'*B + beta*C*DO 120, J = 1, NDO 110, I = 1, MTEMP = ZERODO 100, L = 1, KTEMP = TEMP + 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 CONTINUEEND IFELSEIF( NOTA )THEN** Form C := alpha*A*B' + beta*C*DO 170, J = 1, NIF( BETA.EQ.ZERO )THENDO 130, I = 1, MC( I, J ) = ZERO130 CONTINUEELSE IF( BETA.NE.ONE )THENDO 140, I = 1, MC( I, J ) = BETA*C( I, J )140 CONTINUEEND IFDO 160, L = 1, KIF( B( J, L ).NE.ZERO )THENTEMP = ALPHA*B( J, L )DO 150, I = 1, MC( I, J ) = C( I, J ) + TEMP*A( I, L )150 CONTINUEEND IF160 CONTINUE170 CONTINUEELSE** Form C := alpha*A'*B' + beta*C*DO 200, J = 1, NDO 190, I = 1, MTEMP = ZERODO 180, L = 1, KTEMP = TEMP + A( L, I )*B( J, L )180 CONTINUEIF( BETA.EQ.ZERO )THENC( I, J ) = ALPHA*TEMPELSEC( I, J ) = ALPHA*TEMP + BETA*C( I, J )END IF190 CONTINUE200 CONTINUEEND IFEND IF*RETURN** End of DGEMM .*ENDSUBROUTINE DGEMV ( TRANS, M, N, ALPHA, A, LDA, X, INCX,$ BETA, Y, INCY )* .. Scalar Arguments ..DOUBLE PRECISION ALPHA, BETAINTEGER INCX, INCY, LDA, M, NCHARACTER*1 TRANS* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), X( * ), Y( * )* ..** Purpose* =======** DGEMV performs one of the matrix-vector operations** y := alpha*A*x + beta*y, or y := alpha*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*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 - DOUBLE PRECISION.* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION.* 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 - DOUBLE PRECISION 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 ..DOUBLE PRECISION ONE , ZEROPARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMPINTEGER I, INFO, IX, IY, J, JX, JY, KX, KY, LENX, LENY* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC 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( 'DGEMV ', INFO )RETURNEND IF** Quick return if possible.*IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.$ ( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )$ RETURN** 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, NIF( X( JX ).NE.ZERO )THENTEMP = ALPHA*X( JX )DO 50, I = 1, MY( I ) = Y( I ) + TEMP*A( I, J )50 CONTINUEEND IFJX = JX + INCX60 CONTINUEELSEDO 80, J = 1, NIF( X( JX ).NE.ZERO )THENTEMP = ALPHA*X( JX )IY = KYDO 70, I = 1, MY( IY ) = Y( IY ) + TEMP*A( I, J )IY = IY + INCY70 CONTINUEEND IFJX = JX + INCX80 CONTINUEEND IFELSE** Form y := alpha*A'*x + y.*JY = KYIF( INCX.EQ.1 )THENDO 100, J = 1, NTEMP = ZERODO 90, I = 1, MTEMP = TEMP + A( I, J )*X( I )90 CONTINUEY( JY ) = Y( JY ) + ALPHA*TEMPJY = JY + INCY100 CONTINUEELSEDO 120, J = 1, NTEMP = ZEROIX = KXDO 110, I = 1, MTEMP = TEMP + A( I, J )*X( IX )IX = IX + INCX110 CONTINUEY( JY ) = Y( JY ) + ALPHA*TEMPJY = JY + INCY120 CONTINUEEND IFEND IF*RETURN** End of DGEMV .*ENDSUBROUTINE DGER ( M, N, ALPHA, X, INCX, Y, INCY, A, LDA )* .. Scalar Arguments ..DOUBLE PRECISION ALPHAINTEGER INCX, INCY, LDA, M, N* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), X( * ), Y( * )* ..** Purpose* =======** DGER 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 - DOUBLE PRECISION.* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** X - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 ..DOUBLE PRECISION ZEROPARAMETER ( ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION 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( 'DGER ', 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, NIF( Y( JY ).NE.ZERO )THENTEMP = ALPHA*Y( JY )DO 10, I = 1, MA( I, J ) = A( I, J ) + X( I )*TEMP10 CONTINUEEND IFJY = JY + INCY20 CONTINUEELSEIF( INCX.GT.0 )THENKX = 1ELSEKX = 1 - ( M - 1 )*INCXEND IFDO 40, J = 1, NIF( Y( JY ).NE.ZERO )THENTEMP = ALPHA*Y( JY )IX = KXDO 30, I = 1, MA( I, J ) = A( I, J ) + X( IX )*TEMPIX = IX + INCX30 CONTINUEEND IFJY = JY + INCY40 CONTINUEEND IF*RETURN** End of DGER .*ENDDOUBLE PRECISION FUNCTION DNRM2 ( N, X, INCX )* .. Scalar Arguments ..INTEGER INCX, N* .. Array Arguments ..DOUBLE PRECISION X( * )* ..** DNRM2 returns the euclidean norm of a vector via the function* name, so that** DNRM2 := sqrt( x'*x )**** -- This version written on 25-October-1982.* Modified on 14-October-1993 to inline the call to DLASSQ.* Sven Hammarling, Nag Ltd.*** .. Parameters ..DOUBLE PRECISION ONE , ZEROPARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )* .. Local Scalars ..INTEGER IXDOUBLE PRECISION ABSXI, NORM, SCALE, SSQ* .. Intrinsic Functions ..INTRINSIC ABS, SQRT* ..* .. Executable Statements ..IF( N.LT.1 .OR. INCX.LT.1 )THENNORM = ZEROELSE IF( N.EQ.1 )THENNORM = ABS( X( 1 ) )ELSESCALE = ZEROSSQ = ONE* The following loop is equivalent to this call to the LAPACK* auxiliary routine:* CALL DLASSQ( N, X, INCX, SCALE, SSQ )*DO 10, IX = 1, 1 + ( N - 1 )*INCX, INCXIF( X( IX ).NE.ZERO )THENABSXI = ABS( X( IX ) )IF( SCALE.LT.ABSXI )THENSSQ = ONE + SSQ*( SCALE/ABSXI )**2SCALE = ABSXIELSESSQ = SSQ + ( ABSXI/SCALE )**2END IFEND IF10 CONTINUENORM = SCALE * SQRT( SSQ )END IF*DNRM2 = NORMRETURN** End of DNRM2.*ENDsubroutine drot (n,dx,incx,dy,incy,c,s)cc applies a plane rotation.c jack dongarra, linpack, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)cdouble precision dx(*),dy(*),dtemp,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,ndtemp = c*dx(ix) + s*dy(iy)dy(iy) = c*dy(iy) - s*dx(ix)dx(ix) = dtempix = ix + incxiy = iy + incy10 continuereturncc code for both increments equal to 1c20 do 30 i = 1,ndtemp = c*dx(i) + s*dy(i)dy(i) = c*dy(i) - s*dx(i)dx(i) = dtemp30 continuereturnendsubroutine drotg(da,db,c,s)cc construct givens plane rotation.c jack dongarra, linpack, 3/11/78.cdouble precision da,db,c,s,roe,scale,r,zcroe = dbif( dabs(da) .gt. dabs(db) ) roe = dascale = dabs(da) + dabs(db)if( scale .ne. 0.0d0 ) go to 10c = 1.0d0s = 0.0d0r = 0.0d0z = 0.0d0go to 2010 r = scale*dsqrt((da/scale)**2 + (db/scale)**2)r = dsign(1.0d0,roe)*rc = da/rs = db/rz = 1.0d0if( dabs(da) .gt. dabs(db) ) z = sif( dabs(db) .ge. dabs(da) .and. c .ne. 0.0d0 ) z = 1.0d0/c20 da = rdb = zreturnendSUBROUTINE DROTM (N,DX,INCX,DY,INCY,DPARAM)CC APPLY THE MODIFIED GIVENS TRANSFORMATION, H, TO THE 2 BY N MATRIXCC (DX**T) , WHERE **T INDICATES TRANSPOSE. THE ELEMENTS OF DX ARE INC (DY**T)CC DX(LX+I*INCX), I = 0 TO N-1, WHERE LX = 1 IF INCX .GE. 0, ELSEC LX = (-INCX)*N, AND SIMILARLY FOR SY USING LY AND INCY.C WITH DPARAM(1)=DFLAG, H HAS ONE OF THE FOLLOWING FORMS..CC DFLAG=-1.D0 DFLAG=0.D0 DFLAG=1.D0 DFLAG=-2.D0CC (DH11 DH12) (1.D0 DH12) (DH11 1.D0) (1.D0 0.D0)C H=( ) ( ) ( ) ( )C (DH21 DH22), (DH21 1.D0), (-1.D0 DH22), (0.D0 1.D0).C SEE DROTMG FOR A DESCRIPTION OF DATA STORAGE IN DPARAM.CINTEGER N, INCX, INCYINTEGER NSTEPS, I, KX,KYDOUBLE PRECISION DFLAG,DH12,DH22,DX,TWO,Z,DH11,DH21,1 DPARAM,DY,W,ZERODIMENSION DX(1),DY(1),DPARAM(5)DATA ZERO,TWO/0.D0,2.D0/CDFLAG=DPARAM(1)IF(N .LE. 0 .OR.(DFLAG+TWO.EQ.ZERO)) GO TO 140IF(.NOT.(INCX.EQ.INCY.AND. INCX .GT.0)) GO TO 70CNSTEPS=N*INCXIF(DFLAG) 50,10,3010 CONTINUEDH12=DPARAM(4)DH21=DPARAM(3)DO 20 I=1,NSTEPS,INCXW=DX(I)Z=DY(I)DX(I)=W+Z*DH12DY(I)=W*DH21+Z20 CONTINUEGO TO 14030 CONTINUEDH11=DPARAM(2)DH22=DPARAM(5)DO 40 I=1,NSTEPS,INCXW=DX(I)Z=DY(I)DX(I)=W*DH11+ZDY(I)=-W+DH22*Z40 CONTINUEGO TO 14050 CONTINUEDH11=DPARAM(2)DH12=DPARAM(4)DH21=DPARAM(3)DH22=DPARAM(5)DO 60 I=1,NSTEPS,INCXW=DX(I)Z=DY(I)DX(I)=W*DH11+Z*DH12DY(I)=W*DH21+Z*DH2260 CONTINUEGO TO 14070 CONTINUEKX=1KY=1IF(INCX .LT. 0) KX=1+(1-N)*INCXIF(INCY .LT. 0) KY=1+(1-N)*INCYCIF(DFLAG)120,80,10080 CONTINUEDH12=DPARAM(4)DH21=DPARAM(3)DO 90 I=1,NW=DX(KX)Z=DY(KY)DX(KX)=W+Z*DH12DY(KY)=W*DH21+ZKX=KX+INCXKY=KY+INCY90 CONTINUEGO TO 140100 CONTINUEDH11=DPARAM(2)DH22=DPARAM(5)DO 110 I=1,NW=DX(KX)Z=DY(KY)DX(KX)=W*DH11+ZDY(KY)=-W+DH22*ZKX=KX+INCXKY=KY+INCY110 CONTINUEGO TO 140120 CONTINUEDH11=DPARAM(2)DH12=DPARAM(4)DH21=DPARAM(3)DH22=DPARAM(5)DO 130 I=1,NW=DX(KX)Z=DY(KY)DX(KX)=W*DH11+Z*DH12DY(KY)=W*DH21+Z*DH22KX=KX+INCXKY=KY+INCY130 CONTINUE140 CONTINUERETURNENDSUBROUTINE DROTMG (DD1,DD2,DX1,DY1,DPARAM)CC CONSTRUCT THE MODIFIED GIVENS TRANSFORMATION MATRIX H WHICH ZEROSC THE SECOND COMPONENT OF THE 2-VECTOR (DSQRT(DD1)*DX1,DSQRT(DD2)*C DY2)**T.C WITH DPARAM(1)=DFLAG, H HAS ONE OF THE FOLLOWING FORMS..CC DFLAG=-1.D0 DFLAG=0.D0 DFLAG=1.D0 DFLAG=-2.D0CC (DH11 DH12) (1.D0 DH12) (DH11 1.D0) (1.D0 0.D0)C H=( ) ( ) ( ) ( )C (DH21 DH22), (DH21 1.D0), (-1.D0 DH22), (0.D0 1.D0).C LOCATIONS 2-4 OF DPARAM CONTAIN DH11, DH21, DH12, AND DH22C RESPECTIVELY. (VALUES OF 1.D0, -1.D0, OR 0.D0 IMPLIED BY THEC VALUE OF DPARAM(1) ARE NOT STORED IN DPARAM.)CC THE VALUES OF GAMSQ AND RGAMSQ SET IN THE DATA STATEMENT MAY BEC INEXACT. THIS IS OK AS THEY ARE ONLY USED FOR TESTING THE SIZEC OF DD1 AND DD2. ALL ACTUAL SCALING OF DATA IS DONE USING GAM.CDOUBLE PRECISION GAM,ONE,RGAMSQ,DD2,DH11,DH21,DPARAM,DP2,1 DQ2,DU,DY1,ZERO,GAMSQ,DD1,DFLAG,DH12,DH22,DP1,DQ1,2 DTEMP,DX1,TWODIMENSION DPARAM(5)CINTEGER IGOCDATA ZERO,ONE,TWO /0.D0,1.D0,2.D0/DATA GAM,GAMSQ,RGAMSQ/4096.D0,16777216.D0,5.9604645D-8/CIF(.NOT. DD1 .LT. ZERO) GO TO 10C GO ZERO-H-D-AND-DX1..GO TO 6010 CONTINUEC CASE-DD1-NONNEGATIVEDP2=DD2*DY1IF(.NOT. DP2 .EQ. ZERO) GO TO 20DFLAG=-TWOGO TO 260C REGULAR-CASE..20 CONTINUEDP1=DD1*DX1DQ2=DP2*DY1DQ1=DP1*DX1CIF(.NOT. DABS(DQ1) .GT. DABS(DQ2)) GO TO 40DH21=-DY1/DX1DH12=DP2/DP1CDU=ONE-DH12*DH21CIF(.NOT. DU .LE. ZERO) GO TO 30C GO ZERO-H-D-AND-DX1..GO TO 6030 CONTINUEDFLAG=ZERODD1=DD1/DUDD2=DD2/DUDX1=DX1*DUC GO SCALE-CHECK..GO TO 10040 CONTINUEIF(.NOT. DQ2 .LT. ZERO) GO TO 50C GO ZERO-H-D-AND-DX1..GO TO 6050 CONTINUEDFLAG=ONEDH11=DP1/DP2DH22=DX1/DY1DU=ONE+DH11*DH22DTEMP=DD2/DUDD2=DD1/DUDD1=DTEMPDX1=DY1*DUC GO SCALE-CHECKGO TO 100C PROCEDURE..ZERO-H-D-AND-DX1..60 CONTINUEDFLAG=-ONEDH11=ZERODH12=ZERODH21=ZERODH22=ZEROCDD1=ZERODD2=ZERODX1=ZEROC RETURN..GO TO 220C PROCEDURE..FIX-H..70 CONTINUEIF(.NOT. DFLAG .GE. ZERO) GO TO 90CIF(.NOT. DFLAG .EQ. ZERO) GO TO 80DH11=ONEDH22=ONEDFLAG=-ONEGO TO 9080 CONTINUEDH21=-ONEDH12=ONEDFLAG=-ONE90 CONTINUEGO TO IGO,(120,150,180,210)C PROCEDURE..SCALE-CHECK100 CONTINUE110 CONTINUEIF(.NOT. DD1 .LE. RGAMSQ) GO TO 130IF(DD1 .EQ. ZERO) GO TO 160ASSIGN 120 TO IGOC FIX-H..GO TO 70120 CONTINUEDD1=DD1*GAM**2DX1=DX1/GAMDH11=DH11/GAMDH12=DH12/GAMGO TO 110130 CONTINUE140 CONTINUEIF(.NOT. DD1 .GE. GAMSQ) GO TO 160ASSIGN 150 TO IGOC FIX-H..GO TO 70150 CONTINUEDD1=DD1/GAM**2DX1=DX1*GAMDH11=DH11*GAMDH12=DH12*GAMGO TO 140160 CONTINUE170 CONTINUEIF(.NOT. DABS(DD2) .LE. RGAMSQ) GO TO 190IF(DD2 .EQ. ZERO) GO TO 220ASSIGN 180 TO IGOC FIX-H..GO TO 70180 CONTINUEDD2=DD2*GAM**2DH21=DH21/GAMDH22=DH22/GAMGO TO 170190 CONTINUE200 CONTINUEIF(.NOT. DABS(DD2) .GE. GAMSQ) GO TO 220ASSIGN 210 TO IGOC FIX-H..GO TO 70210 CONTINUEDD2=DD2/GAM**2DH21=DH21*GAMDH22=DH22*GAMGO TO 200220 CONTINUEIF(DFLAG)250,230,240230 CONTINUEDPARAM(3)=DH21DPARAM(4)=DH12GO TO 260240 CONTINUEDPARAM(2)=DH11DPARAM(5)=DH22GO TO 260250 CONTINUEDPARAM(2)=DH11DPARAM(3)=DH21DPARAM(4)=DH12DPARAM(5)=DH22260 CONTINUEDPARAM(1)=DFLAGRETURNENDSUBROUTINE DSBMV ( UPLO, N, K, ALPHA, A, LDA, X, INCX,$ BETA, Y, INCY )* .. Scalar Arguments ..DOUBLE PRECISION ALPHA, BETAINTEGER INCX, INCY, K, LDA, NCHARACTER*1 UPLO* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), X( * ), Y( * )* ..** Purpose* =======** DSBMV 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 symmetric 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 - DOUBLE PRECISION.* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - DOUBLE PRECISION 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 symmetric 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 symmetric 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 symmetric 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 symmetric 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** 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION.* On entry, BETA specifies the scalar beta.* Unchanged on exit.** Y - DOUBLE PRECISION 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 ..DOUBLE PRECISION ONE , ZEROPARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION 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 MAX, MIN* ..* .. 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( 'DSBMV ', 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 + A( L + I, J )*X( I )50 CONTINUEY( J ) = Y( J ) + TEMP1*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 + A( L + I, J )*X( IX )IX = IX + INCXIY = IY + INCY70 CONTINUEY( JY ) = Y( JY ) + TEMP1*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*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 + 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*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 + A( L + I, J )*X( IX )110 CONTINUEY( JY ) = Y( JY ) + ALPHA*TEMP2JX = JX + INCXJY = JY + INCY120 CONTINUEEND IFEND IF*RETURN** End of DSBMV .*ENDsubroutine dscal(n,da,dx,incx)cc scales a vector by a constant.c uses unrolled loops for increment equal to one.c jack dongarra, linpack, 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 precision da,dx(*)integer i,incx,m,mp1,n,nincxcif( n.le.0 .or. incx.le.0 )returnif(incx.eq.1)go to 20cc code for increment not equal to 1cnincx = n*incxdo 10 i = 1,nincx,incxdx(i) = da*dx(i)10 continuereturncc code for increment equal to 1ccc clean-up loopc20 m = mod(n,5)if( m .eq. 0 ) go to 40do 30 i = 1,mdx(i) = da*dx(i)30 continueif( n .lt. 5 ) return40 mp1 = m + 1do 50 i = mp1,n,5dx(i) = da*dx(i)dx(i + 1) = da*dx(i + 1)dx(i + 2) = da*dx(i + 2)dx(i + 3) = da*dx(i + 3)dx(i + 4) = da*dx(i + 4)50 continuereturnend*DECK DSDOTDOUBLE PRECISION FUNCTION DSDOT (N, SX, INCX, SY, INCY)C***BEGIN PROLOGUE DSDOTC***PURPOSE Compute the inner product of two vectors with extendedC precision accumulation and result.C***LIBRARY SLATEC (BLAS)C***CATEGORY D1A4C***TYPE DOUBLE PRECISION (DSDOT-D, DCDOT-C)C***KEYWORDS BLAS, COMPLEX VECTORS, DOT PRODUCT, INNER PRODUCT,C LINEAR ALGEBRA, VECTORC***AUTHOR Lawson, C. L., (JPL)C Hanson, R. J., (SNLA)C Kincaid, D. R., (U. of Texas)C Krogh, F. T., (JPL)C***DESCRIPTIONCC B L A S SubprogramC Description of ParametersCC --Input--C N number of elements in input vector(s)C SX single precision vector with N elementsC INCX storage spacing between elements of SXC SY single precision vector with N elementsC INCY storage spacing between elements of SYCC --Output--C DSDOT double precision dot product (zero if N.LE.0)CC Returns D.P. dot product accumulated in D.P., for S.P. SX and SYC DSDOT = sum for I = 0 to N-1 of SX(LX+I*INCX) * SY(LY+I*INCY),C where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY isC defined in a similar way using INCY.CC***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.C Krogh, Basic linear algebra subprograms for FortranC usage, Algorithm No. 539, Transactions on MathematicalC Software 5, 3 (September 1979), pp. 308-323.C***ROUTINES CALLED (NONE)C***REVISION HISTORY (YYMMDD)C 791001 DATE WRITTENC 890831 Modified array declarations. (WRB)C 890831 REVISION DATE from Version 3.2C 891214 Prologue converted to Version 4.0 format. (BAB)C 920310 Corrected definition of LX in DESCRIPTION. (WRB)C 920501 Reformatted the REFERENCES section. (WRB)C***END PROLOGUE DSDOTREAL SX(*),SY(*)INTEGER N, INCX, INCYCINTEGER KX,KY,I,NSCC***FIRST EXECUTABLE STATEMENT DSDOTDSDOT = 0.0D0IF (N .LE. 0) RETURNIF (INCX.EQ.INCY .AND. INCX.GT.0) GO TO 20CC Code for unequal or nonpositive increments.CKX = 1KY = 1IF (INCX .LT. 0) KX = 1+(1-N)*INCXIF (INCY .LT. 0) KY = 1+(1-N)*INCYDO 10 I = 1,NDSDOT = DSDOT + DBLE(SX(KX))*DBLE(SY(KY))KX = KX + INCXKY = KY + INCY10 CONTINUERETURNCC Code for equal, positive, non-unit increments.C20 NS = N*INCXDO 30 I = 1,NS,INCXDSDOT = DSDOT + DBLE(SX(I))*DBLE(SY(I))30 CONTINUERETURNENDSUBROUTINE DSPMV ( UPLO, N, ALPHA, AP, X, INCX, BETA, Y, INCY )* .. Scalar Arguments ..DOUBLE PRECISION ALPHA, BETAINTEGER INCX, INCY, NCHARACTER*1 UPLO* .. Array Arguments ..DOUBLE PRECISION AP( * ), X( * ), Y( * )* ..** Purpose* =======** DSPMV 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 symmetric 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.** AP - DOUBLE PRECISION 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 symmetric 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 symmetric 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.* Unchanged on exit.** X - DOUBLE PRECISION 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 - DOUBLE PRECISION.* 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 - DOUBLE PRECISION 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 ..DOUBLE PRECISION ONE , ZEROPARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMP1, TEMP2INTEGER I, INFO, IX, IY, J, JX, JY, K, KK, KX, KY* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* ..* .. 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( 'DSPMV ', 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 + AP( K )*X( I )K = K + 150 CONTINUEY( J ) = Y( J ) + TEMP1*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 + AP( K )*X( IX )IX = IX + INCXIY = IY + INCY70 CONTINUEY( JY ) = Y( JY ) + TEMP1*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*AP( KK )K = KK + 1DO 90, I = J + 1, NY( I ) = Y( I ) + TEMP1*AP( K )TEMP2 = TEMP2 + 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*AP( KK )IX = JXIY = JYDO 110, K = KK + 1, KK + N - JIX = IX + INCXIY = IY + INCYY( IY ) = Y( IY ) + TEMP1*AP( K )TEMP2 = TEMP2 + 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 DSPMV .*ENDSUBROUTINE DSPR ( UPLO, N, ALPHA, X, INCX, AP )* .. Scalar Arguments ..DOUBLE PRECISION ALPHAINTEGER INCX, NCHARACTER*1 UPLO* .. Array Arguments ..DOUBLE PRECISION AP( * ), X( * )* ..** Purpose* =======** DSPR performs the symmetric rank 1 operation** A := alpha*x*x' + A,** where alpha is a real scalar, x is an n element vector and A is an* n by n symmetric 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 symmetric 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 symmetric 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.*** 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 ..DOUBLE PRECISION ZEROPARAMETER ( ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMPINTEGER I, INFO, IX, J, JX, K, KK, KX* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* ..* .. 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( 'DSPR ', INFO )RETURNEND IF** Quick return if possible.*IF( ( N.EQ.0 ).OR.( ALPHA.EQ.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, NIF( X( J ).NE.ZERO )THENTEMP = ALPHA*X( J )K = KKDO 10, I = 1, JAP( K ) = AP( K ) + X( I )*TEMPK = K + 110 CONTINUEEND IFKK = KK + J20 CONTINUEELSEJX = KXDO 40, J = 1, NIF( X( JX ).NE.ZERO )THENTEMP = ALPHA*X( JX )IX = KXDO 30, K = KK, KK + J - 1AP( K ) = AP( K ) + X( IX )*TEMPIX = IX + INCX30 CONTINUEEND IFJX = JX + INCXKK = KK + J40 CONTINUEEND IFELSE** Form A when lower triangle is stored in AP.*IF( INCX.EQ.1 )THENDO 60, J = 1, NIF( X( J ).NE.ZERO )THENTEMP = ALPHA*X( J )K = KKDO 50, I = J, NAP( K ) = AP( K ) + X( I )*TEMPK = K + 150 CONTINUEEND IFKK = KK + N - J + 160 CONTINUEELSEJX = KXDO 80, J = 1, NIF( X( JX ).NE.ZERO )THENTEMP = ALPHA*X( JX )IX = JXDO 70, K = KK, KK + N - JAP( K ) = AP( K ) + X( IX )*TEMPIX = IX + INCX70 CONTINUEEND IFJX = JX + INCXKK = KK + N - J + 180 CONTINUEEND IFEND IF*RETURN** End of DSPR .*ENDSUBROUTINE DSPR2 ( UPLO, N, ALPHA, X, INCX, Y, INCY, AP )* .. Scalar Arguments ..DOUBLE PRECISION ALPHAINTEGER INCX, INCY, NCHARACTER*1 UPLO* .. Array Arguments ..DOUBLE PRECISION AP( * ), X( * ), Y( * )* ..** Purpose* =======** DSPR2 performs the symmetric rank 2 operation** A := alpha*x*y' + alpha*y*x' + A,** where alpha is a scalar, x and y are n element vectors and A is an* n by n symmetric 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 symmetric 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 symmetric 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.*** 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 ..DOUBLE PRECISION ZEROPARAMETER ( ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMP1, TEMP2INTEGER I, INFO, IX, IY, J, JX, JY, K, KK, KX, KY* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* ..* .. 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( 'DSPR2 ', 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, NIF( ( X( J ).NE.ZERO ).OR.( Y( J ).NE.ZERO ) )THENTEMP1 = ALPHA*Y( J )TEMP2 = ALPHA*X( J )K = KKDO 10, I = 1, JAP( K ) = AP( K ) + X( I )*TEMP1 + Y( I )*TEMP2K = K + 110 CONTINUEEND IFKK = KK + J20 CONTINUEELSEDO 40, J = 1, NIF( ( X( JX ).NE.ZERO ).OR.( Y( JY ).NE.ZERO ) )THENTEMP1 = ALPHA*Y( JY )TEMP2 = ALPHA*X( JX )IX = KXIY = KYDO 30, K = KK, KK + J - 1AP( K ) = AP( K ) + X( IX )*TEMP1 + Y( IY )*TEMP2IX = IX + INCXIY = IY + INCY30 CONTINUEEND 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, NIF( ( X( J ).NE.ZERO ).OR.( Y( J ).NE.ZERO ) )THENTEMP1 = ALPHA*Y( J )TEMP2 = ALPHA*X( J )K = KKDO 50, I = J, NAP( K ) = AP( K ) + X( I )*TEMP1 + Y( I )*TEMP2K = K + 150 CONTINUEEND IFKK = KK + N - J + 160 CONTINUEELSEDO 80, J = 1, NIF( ( X( JX ).NE.ZERO ).OR.( Y( JY ).NE.ZERO ) )THENTEMP1 = ALPHA*Y( JY )TEMP2 = ALPHA*X( JX )IX = JXIY = JYDO 70, K = KK, KK + N - JAP( K ) = AP( K ) + X( IX )*TEMP1 + Y( IY )*TEMP2IX = IX + INCXIY = IY + INCY70 CONTINUEEND IFJX = JX + INCXJY = JY + INCYKK = KK + N - J + 180 CONTINUEEND IFEND IF*RETURN** End of DSPR2 .*ENDsubroutine dswap (n,dx,incx,dy,incy)cc interchanges two vectors.c uses unrolled loops for increments equal one.c jack dongarra, linpack, 3/11/78.c modified 12/3/93, array(1) declarations changed to array(*)cdouble precision dx(*),dy(*),dtempinteger i,incx,incy,ix,iy,m,mp1,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,ndtemp = dx(ix)dx(ix) = dy(iy)dy(iy) = dtempix = ix + incxiy = iy + incy10 continuereturncc code for both increments equal to 1ccc clean-up loopc20 m = mod(n,3)if( m .eq. 0 ) go to 40do 30 i = 1,mdtemp = dx(i)dx(i) = dy(i)dy(i) = dtemp30 continueif( n .lt. 3 ) return40 mp1 = m + 1do 50 i = mp1,n,3dtemp = dx(i)dx(i) = dy(i)dy(i) = dtempdtemp = dx(i + 1)dx(i + 1) = dy(i + 1)dy(i + 1) = dtempdtemp = dx(i + 2)dx(i + 2) = dy(i + 2)dy(i + 2) = dtemp50 continuereturnendSUBROUTINE DSYMM ( SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB,$ BETA, C, LDC )* .. Scalar Arguments ..CHARACTER*1 SIDE, UPLOINTEGER M, N, LDA, LDB, LDCDOUBLE PRECISION ALPHA, BETA* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * )* ..** Purpose* =======** DSYMM 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 - DOUBLE PRECISION.* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION.* 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 - DOUBLE PRECISION 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, NROWADOUBLE PRECISION TEMP1, TEMP2* .. Parameters ..DOUBLE PRECISION ONE , ZEROPARAMETER ( ONE = 1.0D+0, ZERO = 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( 'DSYMM ', 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 DSYMM .*ENDSUBROUTINE DSYMV ( UPLO, N, ALPHA, A, LDA, X, INCX,$ BETA, Y, INCY )* .. Scalar Arguments ..DOUBLE PRECISION ALPHA, BETAINTEGER INCX, INCY, LDA, NCHARACTER*1 UPLO* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), X( * ), Y( * )* ..** Purpose* =======** DSYMV 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 symmetric 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.** A - DOUBLE PRECISION 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 symmetric 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 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. LDA must be at least* max( 1, n ).* Unchanged on exit.** X - DOUBLE PRECISION 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 - DOUBLE PRECISION.* 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 - DOUBLE PRECISION 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 ..DOUBLE PRECISION ONE , ZEROPARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMP1, TEMP2INTEGER I, INFO, IX, IY, J, JX, JY, KX, KY* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC MAX* ..* .. 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( 'DSYMV ', 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 + A( I, J )*X( I )50 CONTINUEY( J ) = Y( J ) + TEMP1*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 + A( I, J )*X( IX )IX = IX + INCXIY = IY + INCY70 CONTINUEY( JY ) = Y( JY ) + TEMP1*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*A( J, J )DO 90, I = J + 1, NY( I ) = Y( I ) + TEMP1*A( I, J )TEMP2 = TEMP2 + 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*A( J, J )IX = JXIY = JYDO 110, I = J + 1, NIX = IX + INCXIY = IY + INCYY( IY ) = Y( IY ) + TEMP1*A( I, J )TEMP2 = TEMP2 + A( I, J )*X( IX )110 CONTINUEY( JY ) = Y( JY ) + ALPHA*TEMP2JX = JX + INCXJY = JY + INCY120 CONTINUEEND IFEND IF*RETURN** End of DSYMV .*ENDSUBROUTINE DSYR ( UPLO, N, ALPHA, X, INCX, A, LDA )* .. Scalar Arguments ..DOUBLE PRECISION ALPHAINTEGER INCX, LDA, NCHARACTER*1 UPLO* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), X( * )* ..** Purpose* =======** DSYR performs the symmetric rank 1 operation** A := alpha*x*x' + A,** where alpha is a real scalar, x is an n element vector and A is an* n by n symmetric 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 symmetric 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 symmetric 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.** 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 ..DOUBLE PRECISION ZEROPARAMETER ( ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMPINTEGER I, INFO, IX, J, JX, KX* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC MAX* ..* .. 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( 'DSYR ', INFO )RETURNEND IF** Quick return if possible.*IF( ( N.EQ.0 ).OR.( ALPHA.EQ.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, NIF( X( J ).NE.ZERO )THENTEMP = ALPHA*X( J )DO 10, I = 1, JA( I, J ) = A( I, J ) + X( I )*TEMP10 CONTINUEEND IF20 CONTINUEELSEJX = KXDO 40, J = 1, NIF( X( JX ).NE.ZERO )THENTEMP = ALPHA*X( JX )IX = KXDO 30, I = 1, JA( I, J ) = A( I, J ) + X( IX )*TEMPIX = IX + INCX30 CONTINUEEND IFJX = JX + INCX40 CONTINUEEND IFELSE** Form A when A is stored in lower triangle.*IF( INCX.EQ.1 )THENDO 60, J = 1, NIF( X( J ).NE.ZERO )THENTEMP = ALPHA*X( J )DO 50, I = J, NA( I, J ) = A( I, J ) + X( I )*TEMP50 CONTINUEEND IF60 CONTINUEELSEJX = KXDO 80, J = 1, NIF( X( JX ).NE.ZERO )THENTEMP = ALPHA*X( JX )IX = JXDO 70, I = J, NA( I, J ) = A( I, J ) + X( IX )*TEMPIX = IX + INCX70 CONTINUEEND IFJX = JX + INCX80 CONTINUEEND IFEND IF*RETURN** End of DSYR .*ENDSUBROUTINE DSYR2 ( UPLO, N, ALPHA, X, INCX, Y, INCY, A, LDA )* .. Scalar Arguments ..DOUBLE PRECISION ALPHAINTEGER INCX, INCY, LDA, NCHARACTER*1 UPLO* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), X( * ), Y( * )* ..** Purpose* =======** DSYR2 performs the symmetric rank 2 operation** A := alpha*x*y' + alpha*y*x' + A,** where alpha is a scalar, x and y are n element vectors and A is an n* by n symmetric 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 symmetric 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 symmetric 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.** 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 ..DOUBLE PRECISION ZEROPARAMETER ( ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMP1, TEMP2INTEGER I, INFO, IX, IY, J, JX, JY, KX, KY* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC MAX* ..* .. 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( 'DSYR2 ', 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, NIF( ( X( J ).NE.ZERO ).OR.( Y( J ).NE.ZERO ) )THENTEMP1 = ALPHA*Y( J )TEMP2 = ALPHA*X( J )DO 10, I = 1, JA( I, J ) = A( I, J ) + X( I )*TEMP1 + Y( I )*TEMP210 CONTINUEEND IF20 CONTINUEELSEDO 40, J = 1, NIF( ( X( JX ).NE.ZERO ).OR.( Y( JY ).NE.ZERO ) )THENTEMP1 = ALPHA*Y( JY )TEMP2 = ALPHA*X( JX )IX = KXIY = KYDO 30, I = 1, JA( I, J ) = A( I, J ) + X( IX )*TEMP1$ + Y( IY )*TEMP2IX = IX + INCXIY = IY + INCY30 CONTINUEEND 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, NIF( ( X( J ).NE.ZERO ).OR.( Y( J ).NE.ZERO ) )THENTEMP1 = ALPHA*Y( J )TEMP2 = ALPHA*X( J )DO 50, I = J, NA( I, J ) = A( I, J ) + X( I )*TEMP1 + Y( I )*TEMP250 CONTINUEEND IF60 CONTINUEELSEDO 80, J = 1, NIF( ( X( JX ).NE.ZERO ).OR.( Y( JY ).NE.ZERO ) )THENTEMP1 = ALPHA*Y( JY )TEMP2 = ALPHA*X( JX )IX = JXIY = JYDO 70, I = J, NA( I, J ) = A( I, J ) + X( IX )*TEMP1$ + Y( IY )*TEMP2IX = IX + INCXIY = IY + INCY70 CONTINUEEND IFJX = JX + INCXJY = JY + INCY80 CONTINUEEND IFEND IF*RETURN** End of DSYR2 .*ENDSUBROUTINE DSYR2K( UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB,$ BETA, C, LDC )* .. Scalar Arguments ..CHARACTER*1 UPLO, TRANSINTEGER N, K, LDA, LDB, LDCDOUBLE PRECISION ALPHA, BETA* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * )* ..** Purpose* =======** DSYR2K 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.** TRANS = 'C' or 'c' 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' or '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 - DOUBLE PRECISION.* On entry, ALPHA specifies the scalar alpha.* Unchanged on exit.** A - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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, NROWADOUBLE PRECISION TEMP1, TEMP2* .. 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, 'T' ) ).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( 'DSYR2K', 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, KIF( ( A( J, L ).NE.ZERO ).OR.$ ( 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 CONTINUEEND 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, KIF( ( A( J, L ).NE.ZERO ).OR.$ ( 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 CONTINUEEND 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 DSYR2K.*ENDSUBROUTINE DSYRK ( UPLO, TRANS, N, K, ALPHA, A, LDA,$ BETA, C, LDC )* .. Scalar Arguments ..CHARACTER*1 UPLO, TRANSINTEGER N, K, LDA, LDCDOUBLE PRECISION ALPHA, BETA* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), C( LDC, * )* ..** Purpose* =======** DSYRK 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.** TRANS = 'C' or 'c' 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' or '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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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, NROWADOUBLE PRECISION 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, 'T' ) ).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( 'DSYRK ', 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, KIF( 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 CONTINUEEND 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, KIF( 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 CONTINUEEND 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 DSYRK .*ENDSUBROUTINE DTBMV ( UPLO, TRANS, DIAG, N, K, A, LDA, X, INCX )* .. Scalar Arguments ..INTEGER INCX, K, LDA, NCHARACTER*1 DIAG, TRANS, UPLO* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), X( * )* ..** Purpose* =======** DTBMV performs one of the matrix-vector operations** x := A*x, or x := 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 := 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 ..DOUBLE PRECISION ZEROPARAMETER ( ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMPINTEGER I, INFO, IX, J, JX, KPLUS1, KX, LLOGICAL NOUNIT* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC 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( 'DTBMV ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN*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, NIF( 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 )END IF20 CONTINUEELSEJX = KXDO 40, J = 1, NIF( 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 )END IFJX = JX + INCXIF( J.GT.K )$ KX = KX + INCX40 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 60, J = N, 1, -1IF( 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 )END IF60 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 80, J = N, 1, -1IF( 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 )END IFJX = JX - INCXIF( ( N - J ).GE.K )$ KX = KX - INCX80 CONTINUEEND IFEND IFELSE** Form x := A'*x.*IF( LSAME( UPLO, 'U' ) )THENKPLUS1 = K + 1IF( INCX.EQ.1 )THENDO 100, J = N, 1, -1TEMP = X( J )L = KPLUS1 - JIF( NOUNIT )$ TEMP = TEMP*A( KPLUS1, J )DO 90, I = J - 1, MAX( 1, J - K ), -1TEMP = TEMP + A( L + I, J )*X( I )90 CONTINUEX( J ) = TEMP100 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 120, J = N, 1, -1TEMP = X( JX )KX = KX - INCXIX = KXL = KPLUS1 - JIF( NOUNIT )$ TEMP = TEMP*A( KPLUS1, J )DO 110, I = J - 1, MAX( 1, J - K ), -1TEMP = TEMP + A( L + I, J )*X( IX )IX = IX - INCX110 CONTINUEX( JX ) = TEMPJX = JX - INCX120 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 140, J = 1, NTEMP = X( J )L = 1 - JIF( NOUNIT )$ TEMP = TEMP*A( 1, J )DO 130, I = J + 1, MIN( N, J + K )TEMP = TEMP + A( L + I, J )*X( I )130 CONTINUEX( J ) = TEMP140 CONTINUEELSEJX = KXDO 160, J = 1, NTEMP = X( JX )KX = KX + INCXIX = KXL = 1 - JIF( NOUNIT )$ TEMP = TEMP*A( 1, J )DO 150, I = J + 1, MIN( N, J + K )TEMP = TEMP + A( L + I, J )*X( IX )IX = IX + INCX150 CONTINUEX( JX ) = TEMPJX = JX + INCX160 CONTINUEEND IFEND IFEND IF*RETURN** End of DTBMV .*ENDSUBROUTINE DTBSV ( UPLO, TRANS, DIAG, N, K, A, LDA, X, INCX )* .. Scalar Arguments ..INTEGER INCX, K, LDA, NCHARACTER*1 DIAG, TRANS, UPLO* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), X( * )* ..** Purpose* =======** DTBSV solves one of the systems of equations** A*x = b, or 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' 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 ..DOUBLE PRECISION ZEROPARAMETER ( ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMPINTEGER I, INFO, IX, J, JX, KPLUS1, KX, LLOGICAL NOUNIT* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC 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( 'DTBSV ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN*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, -1IF( 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 CONTINUEEND IF20 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 40, J = N, 1, -1KX = KX - INCXIF( 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 CONTINUEEND IFJX = JX - INCX40 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 60, J = 1, NIF( 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 CONTINUEEND IF60 CONTINUEELSEJX = KXDO 80, J = 1, NKX = KX + INCXIF( 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 CONTINUEEND IFJX = JX + INCX80 CONTINUEEND IFEND IFELSE** Form x := inv( A')*x.*IF( LSAME( UPLO, 'U' ) )THENKPLUS1 = K + 1IF( INCX.EQ.1 )THENDO 100, J = 1, NTEMP = X( J )L = KPLUS1 - JDO 90, I = MAX( 1, J - K ), J - 1TEMP = TEMP - A( L + I, J )*X( I )90 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( KPLUS1, J )X( J ) = TEMP100 CONTINUEELSEJX = KXDO 120, J = 1, NTEMP = X( JX )IX = KXL = KPLUS1 - JDO 110, I = MAX( 1, J - K ), J - 1TEMP = TEMP - A( L + I, J )*X( IX )IX = IX + INCX110 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( KPLUS1, J )X( JX ) = TEMPJX = JX + INCXIF( J.GT.K )$ KX = KX + INCX120 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 140, J = N, 1, -1TEMP = X( J )L = 1 - JDO 130, I = MIN( N, J + K ), J + 1, -1TEMP = TEMP - A( L + I, J )*X( I )130 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( 1, J )X( J ) = TEMP140 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 160, J = N, 1, -1TEMP = X( JX )IX = KXL = 1 - JDO 150, I = MIN( N, J + K ), J + 1, -1TEMP = TEMP - A( L + I, J )*X( IX )IX = IX - INCX150 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( 1, J )X( JX ) = TEMPJX = JX - INCXIF( ( N - J ).GE.K )$ KX = KX - INCX160 CONTINUEEND IFEND IFEND IF*RETURN** End of DTBSV .*ENDSUBROUTINE DTPMV ( UPLO, TRANS, DIAG, N, AP, X, INCX )* .. Scalar Arguments ..INTEGER INCX, NCHARACTER*1 DIAG, TRANS, UPLO* .. Array Arguments ..DOUBLE PRECISION AP( * ), X( * )* ..** Purpose* =======** DTPMV performs one of the matrix-vector operations** x := A*x, or x := 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 := 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 ..DOUBLE PRECISION ZEROPARAMETER ( ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMPINTEGER I, INFO, IX, J, JX, K, KK, KXLOGICAL NOUNIT* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* ..* .. 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( 'DTPMV ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN*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, NIF( 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 )END IFKK = KK + J20 CONTINUEELSEJX = KXDO 40, J = 1, NIF( 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 )END IFJX = JX + INCXKK = KK + J40 CONTINUEEND IFELSEKK = ( N*( N + 1 ) )/2IF( INCX.EQ.1 )THENDO 60, J = N, 1, -1IF( 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 )END IFKK = KK - ( N - J + 1 )60 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 80, J = N, 1, -1IF( 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 )END IFJX = JX - INCXKK = KK - ( N - J + 1 )80 CONTINUEEND IFEND IFELSE** Form x := A'*x.*IF( LSAME( UPLO, 'U' ) )THENKK = ( N*( N + 1 ) )/2IF( INCX.EQ.1 )THENDO 100, J = N, 1, -1TEMP = X( J )IF( NOUNIT )$ TEMP = TEMP*AP( KK )K = KK - 1DO 90, I = J - 1, 1, -1TEMP = TEMP + AP( K )*X( I )K = K - 190 CONTINUEX( J ) = TEMPKK = KK - J100 CONTINUEELSEJX = KX + ( N - 1 )*INCXDO 120, J = N, 1, -1TEMP = X( JX )IX = JXIF( NOUNIT )$ TEMP = TEMP*AP( KK )DO 110, K = KK - 1, KK - J + 1, -1IX = IX - INCXTEMP = TEMP + AP( K )*X( IX )110 CONTINUEX( JX ) = TEMPJX = JX - INCXKK = KK - J120 CONTINUEEND IFELSEKK = 1IF( INCX.EQ.1 )THENDO 140, J = 1, NTEMP = X( J )IF( NOUNIT )$ TEMP = TEMP*AP( KK )K = KK + 1DO 130, I = J + 1, NTEMP = TEMP + AP( K )*X( I )K = K + 1130 CONTINUEX( J ) = TEMPKK = KK + ( N - J + 1 )140 CONTINUEELSEJX = KXDO 160, J = 1, NTEMP = X( JX )IX = JXIF( NOUNIT )$ TEMP = TEMP*AP( KK )DO 150, K = KK + 1, KK + N - JIX = IX + INCXTEMP = TEMP + AP( K )*X( IX )150 CONTINUEX( JX ) = TEMPJX = JX + INCXKK = KK + ( N - J + 1 )160 CONTINUEEND IFEND IFEND IF*RETURN** End of DTPMV .*ENDSUBROUTINE DTPSV ( UPLO, TRANS, DIAG, N, AP, X, INCX )* .. Scalar Arguments ..INTEGER INCX, NCHARACTER*1 DIAG, TRANS, UPLO* .. Array Arguments ..DOUBLE PRECISION AP( * ), X( * )* ..** Purpose* =======** DTPSV solves one of the systems of equations** A*x = b, or 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' 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 ..DOUBLE PRECISION ZEROPARAMETER ( ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMPINTEGER I, INFO, IX, J, JX, K, KK, KXLOGICAL NOUNIT* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* ..* .. 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( 'DTPSV ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN*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, -1IF( 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 CONTINUEEND IFKK = KK - J20 CONTINUEELSEJX = KX + ( N - 1 )*INCXDO 40, J = N, 1, -1IF( 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 CONTINUEEND IFJX = JX - INCXKK = KK - J40 CONTINUEEND IFELSEKK = 1IF( INCX.EQ.1 )THENDO 60, J = 1, NIF( 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 CONTINUEEND IFKK = KK + ( N - J + 1 )60 CONTINUEELSEJX = KXDO 80, J = 1, NIF( 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 CONTINUEEND IFJX = JX + INCXKK = KK + ( N - J + 1 )80 CONTINUEEND IFEND IFELSE** Form x := inv( A' )*x.*IF( LSAME( UPLO, 'U' ) )THENKK = 1IF( INCX.EQ.1 )THENDO 100, J = 1, NTEMP = X( J )K = KKDO 90, I = 1, J - 1TEMP = TEMP - AP( K )*X( I )K = K + 190 CONTINUEIF( NOUNIT )$ TEMP = TEMP/AP( KK + J - 1 )X( J ) = TEMPKK = KK + J100 CONTINUEELSEJX = KXDO 120, J = 1, NTEMP = X( JX )IX = KXDO 110, K = KK, KK + J - 2TEMP = TEMP - AP( K )*X( IX )IX = IX + INCX110 CONTINUEIF( NOUNIT )$ TEMP = TEMP/AP( KK + J - 1 )X( JX ) = TEMPJX = JX + INCXKK = KK + J120 CONTINUEEND IFELSEKK = ( N*( N + 1 ) )/2IF( INCX.EQ.1 )THENDO 140, J = N, 1, -1TEMP = X( J )K = KKDO 130, I = N, J + 1, -1TEMP = TEMP - AP( K )*X( I )K = K - 1130 CONTINUEIF( NOUNIT )$ TEMP = TEMP/AP( KK - N + J )X( J ) = TEMPKK = KK - ( N - J + 1 )140 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 160, J = N, 1, -1TEMP = X( JX )IX = KXDO 150, K = KK, KK - ( N - ( J + 1 ) ), -1TEMP = TEMP - AP( K )*X( IX )IX = IX - INCX150 CONTINUEIF( NOUNIT )$ TEMP = TEMP/AP( KK - N + J )X( JX ) = TEMPJX = JX - INCXKK = KK - (N - J + 1 )160 CONTINUEEND IFEND IFEND IF*RETURN** End of DTPSV .*ENDSUBROUTINE DTRMM ( SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA,$ B, LDB )* .. Scalar Arguments ..CHARACTER*1 SIDE, UPLO, TRANSA, DIAGINTEGER M, N, LDA, LDBDOUBLE PRECISION ALPHA* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), B( LDB, * )* ..** Purpose* =======** DTRMM 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'.** 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 ) = 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 - DOUBLE PRECISION.* 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 MAX* .. Local Scalars ..LOGICAL LSIDE, NOUNIT, UPPERINTEGER I, INFO, J, K, NROWADOUBLE PRECISION TEMP* .. Parameters ..DOUBLE PRECISION ONE , ZEROPARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )* ..* .. Executable Statements ..** Test the input parameters.*LSIDE = LSAME( SIDE , 'L' )IF( LSIDE )THENNROWA = MELSENROWA = NEND IFNOUNIT = 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( 'DTRMM ', 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, MIF( 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 ) = TEMPEND IF40 CONTINUE50 CONTINUEELSEDO 80, J = 1, NDO 70 K = M, 1, -1IF( 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 CONTINUEEND IF70 CONTINUE80 CONTINUEEND IFELSE** Form B := alpha*A'*B.*IF( UPPER )THENDO 110, J = 1, NDO 100, I = M, 1, -1TEMP = B( I, J )IF( NOUNIT )$ TEMP = TEMP*A( I, I )DO 90, K = 1, I - 1TEMP = TEMP + A( K, I )*B( K, J )90 CONTINUEB( I, J ) = ALPHA*TEMP100 CONTINUE110 CONTINUEELSEDO 140, J = 1, NDO 130, I = 1, MTEMP = B( I, J )IF( NOUNIT )$ TEMP = TEMP*A( I, I )DO 120, K = I + 1, MTEMP = TEMP + A( K, I )*B( K, J )120 CONTINUEB( I, J ) = ALPHA*TEMP130 CONTINUE140 CONTINUEEND IFEND IFELSEIF( LSAME( TRANSA, 'N' ) )THEN** Form B := alpha*B*A.*IF( UPPER )THENDO 180, J = N, 1, -1TEMP = ALPHAIF( NOUNIT )$ TEMP = TEMP*A( J, J )DO 150, I = 1, MB( I, J ) = TEMP*B( I, J )150 CONTINUEDO 170, K = 1, J - 1IF( A( K, J ).NE.ZERO )THENTEMP = ALPHA*A( K, J )DO 160, I = 1, MB( I, J ) = B( I, J ) + TEMP*B( I, K )160 CONTINUEEND IF170 CONTINUE180 CONTINUEELSEDO 220, J = 1, NTEMP = ALPHAIF( NOUNIT )$ TEMP = TEMP*A( J, J )DO 190, I = 1, MB( I, J ) = TEMP*B( I, J )190 CONTINUEDO 210, K = J + 1, NIF( A( K, J ).NE.ZERO )THENTEMP = ALPHA*A( K, J )DO 200, I = 1, MB( I, J ) = B( I, J ) + TEMP*B( I, K )200 CONTINUEEND IF210 CONTINUE220 CONTINUEEND IFELSE** Form B := alpha*B*A'.*IF( UPPER )THENDO 260, K = 1, NDO 240, J = 1, K - 1IF( A( J, K ).NE.ZERO )THENTEMP = ALPHA*A( J, K )DO 230, I = 1, MB( I, J ) = B( I, J ) + TEMP*B( I, K )230 CONTINUEEND IF240 CONTINUETEMP = ALPHAIF( NOUNIT )$ TEMP = TEMP*A( K, K )IF( TEMP.NE.ONE )THENDO 250, I = 1, MB( I, K ) = TEMP*B( I, K )250 CONTINUEEND IF260 CONTINUEELSEDO 300, K = N, 1, -1DO 280, J = K + 1, NIF( A( J, K ).NE.ZERO )THENTEMP = ALPHA*A( J, K )DO 270, I = 1, MB( I, J ) = B( I, J ) + TEMP*B( I, K )270 CONTINUEEND IF280 CONTINUETEMP = ALPHAIF( NOUNIT )$ TEMP = TEMP*A( K, K )IF( TEMP.NE.ONE )THENDO 290, I = 1, MB( I, K ) = TEMP*B( I, K )290 CONTINUEEND IF300 CONTINUEEND IFEND IFEND IF*RETURN** End of DTRMM .*ENDSUBROUTINE DTRMV ( UPLO, TRANS, DIAG, N, A, LDA, X, INCX )* .. Scalar Arguments ..INTEGER INCX, LDA, NCHARACTER*1 DIAG, TRANS, UPLO* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), X( * )* ..** Purpose* =======** DTRMV performs one of the matrix-vector operations** x := A*x, or x := 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 := 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 ..DOUBLE PRECISION ZEROPARAMETER ( ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMPINTEGER I, INFO, IX, J, JX, KXLOGICAL NOUNIT* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC 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( 'DTRMV ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN*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, NIF( 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 )END IF20 CONTINUEELSEJX = KXDO 40, J = 1, NIF( 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 )END IFJX = JX + INCX40 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 60, J = N, 1, -1IF( 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 )END IF60 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 80, J = N, 1, -1IF( 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 )END IFJX = JX - INCX80 CONTINUEEND IFEND IFELSE** Form x := A'*x.*IF( LSAME( UPLO, 'U' ) )THENIF( INCX.EQ.1 )THENDO 100, J = N, 1, -1TEMP = X( J )IF( NOUNIT )$ TEMP = TEMP*A( J, J )DO 90, I = J - 1, 1, -1TEMP = TEMP + A( I, J )*X( I )90 CONTINUEX( J ) = TEMP100 CONTINUEELSEJX = KX + ( N - 1 )*INCXDO 120, J = N, 1, -1TEMP = X( JX )IX = JXIF( NOUNIT )$ TEMP = TEMP*A( J, J )DO 110, I = J - 1, 1, -1IX = IX - INCXTEMP = TEMP + A( I, J )*X( IX )110 CONTINUEX( JX ) = TEMPJX = JX - INCX120 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 140, J = 1, NTEMP = X( J )IF( NOUNIT )$ TEMP = TEMP*A( J, J )DO 130, I = J + 1, NTEMP = TEMP + A( I, J )*X( I )130 CONTINUEX( J ) = TEMP140 CONTINUEELSEJX = KXDO 160, J = 1, NTEMP = X( JX )IX = JXIF( NOUNIT )$ TEMP = TEMP*A( J, J )DO 150, I = J + 1, NIX = IX + INCXTEMP = TEMP + A( I, J )*X( IX )150 CONTINUEX( JX ) = TEMPJX = JX + INCX160 CONTINUEEND IFEND IFEND IF*RETURN** End of DTRMV .*ENDSUBROUTINE DTRSM ( SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA,$ B, LDB )* .. Scalar Arguments ..CHARACTER*1 SIDE, UPLO, TRANSA, DIAGINTEGER M, N, LDA, LDBDOUBLE PRECISION ALPHA* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), B( LDB, * )* ..** Purpose* =======** DTRSM 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'.** 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 ) = 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 - DOUBLE PRECISION.* 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 MAX* .. Local Scalars ..LOGICAL LSIDE, NOUNIT, UPPERINTEGER I, INFO, J, K, NROWADOUBLE PRECISION TEMP* .. Parameters ..DOUBLE PRECISION ONE , ZEROPARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )* ..* .. Executable Statements ..** Test the input parameters.*LSIDE = LSAME( SIDE , 'L' )IF( LSIDE )THENNROWA = MELSENROWA = NEND IFNOUNIT = 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( 'DTRSM ', 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, -1IF( 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 CONTINUEEND 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, MIF( 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 CONTINUEEND IF90 CONTINUE100 CONTINUEEND IFELSE** Form B := alpha*inv( A' )*B.*IF( UPPER )THENDO 130, J = 1, NDO 120, I = 1, MTEMP = ALPHA*B( I, J )DO 110, K = 1, I - 1TEMP = TEMP - A( K, I )*B( K, J )110 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( I, I )B( I, J ) = TEMP120 CONTINUE130 CONTINUEELSEDO 160, J = 1, NDO 150, I = M, 1, -1TEMP = ALPHA*B( I, J )DO 140, K = I + 1, MTEMP = TEMP - A( K, I )*B( K, J )140 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( I, I )B( I, J ) = TEMP150 CONTINUE160 CONTINUEEND IFEND IFELSEIF( LSAME( TRANSA, 'N' ) )THEN** Form B := alpha*B*inv( A ).*IF( UPPER )THENDO 210, J = 1, NIF( ALPHA.NE.ONE )THENDO 170, I = 1, MB( I, J ) = ALPHA*B( I, J )170 CONTINUEEND IFDO 190, K = 1, J - 1IF( A( K, J ).NE.ZERO )THENDO 180, I = 1, MB( I, J ) = B( I, J ) - A( K, J )*B( I, K )180 CONTINUEEND IF190 CONTINUEIF( NOUNIT )THENTEMP = ONE/A( J, J )DO 200, I = 1, MB( I, J ) = TEMP*B( I, J )200 CONTINUEEND IF210 CONTINUEELSEDO 260, J = N, 1, -1IF( ALPHA.NE.ONE )THENDO 220, I = 1, MB( I, J ) = ALPHA*B( I, J )220 CONTINUEEND IFDO 240, K = J + 1, NIF( A( K, J ).NE.ZERO )THENDO 230, I = 1, MB( I, J ) = B( I, J ) - A( K, J )*B( I, K )230 CONTINUEEND IF240 CONTINUEIF( NOUNIT )THENTEMP = ONE/A( J, J )DO 250, I = 1, MB( I, J ) = TEMP*B( I, J )250 CONTINUEEND IF260 CONTINUEEND IFELSE** Form B := alpha*B*inv( A' ).*IF( UPPER )THENDO 310, K = N, 1, -1IF( NOUNIT )THENTEMP = ONE/A( K, K )DO 270, I = 1, MB( I, K ) = TEMP*B( I, K )270 CONTINUEEND IFDO 290, J = 1, K - 1IF( A( J, K ).NE.ZERO )THENTEMP = A( J, K )DO 280, I = 1, MB( I, J ) = B( I, J ) - TEMP*B( I, K )280 CONTINUEEND IF290 CONTINUEIF( ALPHA.NE.ONE )THENDO 300, I = 1, MB( I, K ) = ALPHA*B( I, K )300 CONTINUEEND IF310 CONTINUEELSEDO 360, K = 1, NIF( NOUNIT )THENTEMP = ONE/A( K, K )DO 320, I = 1, MB( I, K ) = TEMP*B( I, K )320 CONTINUEEND IFDO 340, J = K + 1, NIF( A( J, K ).NE.ZERO )THENTEMP = A( J, K )DO 330, I = 1, MB( I, J ) = B( I, J ) - TEMP*B( I, K )330 CONTINUEEND IF340 CONTINUEIF( ALPHA.NE.ONE )THENDO 350, I = 1, MB( I, K ) = ALPHA*B( I, K )350 CONTINUEEND IF360 CONTINUEEND IFEND IFEND IF*RETURN** End of DTRSM .*ENDSUBROUTINE DTRSV ( UPLO, TRANS, DIAG, N, A, LDA, X, INCX )* .. Scalar Arguments ..INTEGER INCX, LDA, NCHARACTER*1 DIAG, TRANS, UPLO* .. Array Arguments ..DOUBLE PRECISION A( LDA, * ), X( * )* ..** Purpose* =======** DTRSV solves one of the systems of equations** A*x = b, or 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' 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 - DOUBLE PRECISION 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 - DOUBLE PRECISION 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 ..DOUBLE PRECISION ZEROPARAMETER ( ZERO = 0.0D+0 )* .. Local Scalars ..DOUBLE PRECISION TEMPINTEGER I, INFO, IX, J, JX, KXLOGICAL NOUNIT* .. External Functions ..LOGICAL LSAMEEXTERNAL LSAME* .. External Subroutines ..EXTERNAL XERBLA* .. Intrinsic Functions ..INTRINSIC 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( 'DTRSV ', INFO )RETURNEND IF** Quick return if possible.*IF( N.EQ.0 )$ RETURN*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, -1IF( 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 CONTINUEEND IF20 CONTINUEELSEJX = KX + ( N - 1 )*INCXDO 40, J = N, 1, -1IF( 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 CONTINUEEND IFJX = JX - INCX40 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 60, J = 1, NIF( 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 CONTINUEEND IF60 CONTINUEELSEJX = KXDO 80, J = 1, NIF( 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 CONTINUEEND IFJX = JX + INCX80 CONTINUEEND IFEND IFELSE** Form x := inv( A' )*x.*IF( LSAME( UPLO, 'U' ) )THENIF( INCX.EQ.1 )THENDO 100, J = 1, NTEMP = X( J )DO 90, I = 1, J - 1TEMP = TEMP - A( I, J )*X( I )90 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( J, J )X( J ) = TEMP100 CONTINUEELSEJX = KXDO 120, J = 1, NTEMP = X( JX )IX = KXDO 110, I = 1, J - 1TEMP = TEMP - A( I, J )*X( IX )IX = IX + INCX110 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( J, J )X( JX ) = TEMPJX = JX + INCX120 CONTINUEEND IFELSEIF( INCX.EQ.1 )THENDO 140, J = N, 1, -1TEMP = X( J )DO 130, I = N, J + 1, -1TEMP = TEMP - A( I, J )*X( I )130 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( J, J )X( J ) = TEMP140 CONTINUEELSEKX = KX + ( N - 1 )*INCXJX = KXDO 160, J = N, 1, -1TEMP = X( JX )IX = KXDO 150, I = N, J + 1, -1TEMP = TEMP - A( I, J )*X( IX )IX = IX - INCX150 CONTINUEIF( NOUNIT )$ TEMP = TEMP/A( J, J )X( JX ) = TEMPJX = JX - INCX160 CONTINUEEND IFEND IFEND IF*RETURN** End of DTRSV .*ENDinteger function idamax(n,dx,incx)cc finds the index of element having max. absolute value.c jack dongarra, linpack, 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 precision dx(*),dmaxinteger i,incx,ix,ncidamax = 0if( n.lt.1 .or. incx.le.0 ) returnidamax = 1if(n.eq.1)returnif(incx.eq.1)go to 20cc code for increment not equal to 1cix = 1dmax = dabs(dx(1))ix = ix + incxdo 10 i = 2,nif(dabs(dx(ix)).le.dmax) go to 5idamax = idmax = dabs(dx(ix))5 ix = ix + incx10 continuereturncc code for increment equal to 1c20 dmax = dabs(dx(1))do 30 i = 2,nif(dabs(dx(i)).le.dmax) go to 30idamax = idmax = dabs(dx(i))30 continuereturnendLOGICAL FUNCTION LSAME( CA, CB )** -- LAPACK auxiliary routine (version 2.0) --* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,* Courant Institute, Argonne National Lab, and Rice University* January 31, 1994** .. Scalar Arguments ..CHARACTER CA, CB* ..** Purpose* =======** LSAME returns .TRUE. if CA is the same letter as CB regardless of* case.** Arguments* =========** CA (input) CHARACTER*1* CB (input) CHARACTER*1* CA and CB specify the single characters to be compared.** =====================================================================** .. Intrinsic Functions ..INTRINSIC ICHAR* ..* .. Local Scalars ..INTEGER INTA, INTB, ZCODE* ..* .. Executable Statements ..** Test if the characters are equal*LSAME = CA.EQ.CBIF( LSAME )$ RETURN** Now test for equivalence if both characters are alphabetic.*ZCODE = ICHAR( 'Z' )** Use 'Z' rather than 'A' so that ASCII can be detected on Prime* machines, on which ICHAR returns a value with bit 8 set.* ICHAR('A') on Prime machines returns 193 which is the same as* ICHAR('A') on an EBCDIC machine.*INTA = ICHAR( CA )INTB = ICHAR( CB )*IF( ZCODE.EQ.90 .OR. ZCODE.EQ.122 ) THEN** ASCII is assumed - ZCODE is the ASCII code of either lower or* upper case 'Z'.*IF( INTA.GE.97 .AND. INTA.LE.122 ) INTA = INTA - 32IF( INTB.GE.97 .AND. INTB.LE.122 ) INTB = INTB - 32*ELSE IF( ZCODE.EQ.233 .OR. ZCODE.EQ.169 ) THEN** EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or* upper case 'Z'.*IF( INTA.GE.129 .AND. INTA.LE.137 .OR.$ INTA.GE.145 .AND. INTA.LE.153 .OR.$ INTA.GE.162 .AND. INTA.LE.169 ) INTA = INTA + 64IF( INTB.GE.129 .AND. INTB.LE.137 .OR.$ INTB.GE.145 .AND. INTB.LE.153 .OR.$ INTB.GE.162 .AND. INTB.LE.169 ) INTB = INTB + 64*ELSE IF( ZCODE.EQ.218 .OR. ZCODE.EQ.250 ) THEN** ASCII is assumed, on Prime machines - ZCODE is the ASCII code* plus 128 of either lower or upper case 'Z'.*IF( INTA.GE.225 .AND. INTA.LE.250 ) INTA = INTA - 32IF( INTB.GE.225 .AND. INTB.LE.250 ) INTB = INTB - 32END IFLSAME = INTA.EQ.INTB** RETURN** End of LSAME*END