Rev 14286 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
double precision function dcabs1(z)double complex z,zzdouble precision t(2)equivalence (zz,t(1))zz = zdcabs1 = dabs(t(1)) + dabs(t(2))returnendSUBROUTINE 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 .*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 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 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 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 .*END