LAPACK 3.3.1
Linear Algebra PACKage
|
00001 SUBROUTINE DSBMV(UPLO,N,K,ALPHA,A,LDA,X,INCX,BETA,Y,INCY) 00002 * .. Scalar Arguments .. 00003 DOUBLE PRECISION ALPHA,BETA 00004 INTEGER INCX,INCY,K,LDA,N 00005 CHARACTER UPLO 00006 * .. 00007 * .. Array Arguments .. 00008 DOUBLE PRECISION A(LDA,*),X(*),Y(*) 00009 * .. 00010 * 00011 * Purpose 00012 * ======= 00013 * 00014 * DSBMV performs the matrix-vector operation 00015 * 00016 * y := alpha*A*x + beta*y, 00017 * 00018 * where alpha and beta are scalars, x and y are n element vectors and 00019 * A is an n by n symmetric band matrix, with k super-diagonals. 00020 * 00021 * Arguments 00022 * ========== 00023 * 00024 * UPLO - CHARACTER*1. 00025 * On entry, UPLO specifies whether the upper or lower 00026 * triangular part of the band matrix A is being supplied as 00027 * follows: 00028 * 00029 * UPLO = 'U' or 'u' The upper triangular part of A is 00030 * being supplied. 00031 * 00032 * UPLO = 'L' or 'l' The lower triangular part of A is 00033 * being supplied. 00034 * 00035 * Unchanged on exit. 00036 * 00037 * N - INTEGER. 00038 * On entry, N specifies the order of the matrix A. 00039 * N must be at least zero. 00040 * Unchanged on exit. 00041 * 00042 * K - INTEGER. 00043 * On entry, K specifies the number of super-diagonals of the 00044 * matrix A. K must satisfy 0 .le. K. 00045 * Unchanged on exit. 00046 * 00047 * ALPHA - DOUBLE PRECISION. 00048 * On entry, ALPHA specifies the scalar alpha. 00049 * Unchanged on exit. 00050 * 00051 * A - DOUBLE PRECISION array of DIMENSION ( LDA, n ). 00052 * Before entry with UPLO = 'U' or 'u', the leading ( k + 1 ) 00053 * by n part of the array A must contain the upper triangular 00054 * band part of the symmetric matrix, supplied column by 00055 * column, with the leading diagonal of the matrix in row 00056 * ( k + 1 ) of the array, the first super-diagonal starting at 00057 * position 2 in row k, and so on. The top left k by k triangle 00058 * of the array A is not referenced. 00059 * The following program segment will transfer the upper 00060 * triangular part of a symmetric band matrix from conventional 00061 * full matrix storage to band storage: 00062 * 00063 * DO 20, J = 1, N 00064 * M = K + 1 - J 00065 * DO 10, I = MAX( 1, J - K ), J 00066 * A( M + I, J ) = matrix( I, J ) 00067 * 10 CONTINUE 00068 * 20 CONTINUE 00069 * 00070 * Before entry with UPLO = 'L' or 'l', the leading ( k + 1 ) 00071 * by n part of the array A must contain the lower triangular 00072 * band part of the symmetric matrix, supplied column by 00073 * column, with the leading diagonal of the matrix in row 1 of 00074 * the array, the first sub-diagonal starting at position 1 in 00075 * row 2, and so on. The bottom right k by k triangle of the 00076 * array A is not referenced. 00077 * The following program segment will transfer the lower 00078 * triangular part of a symmetric band matrix from conventional 00079 * full matrix storage to band storage: 00080 * 00081 * DO 20, J = 1, N 00082 * M = 1 - J 00083 * DO 10, I = J, MIN( N, J + K ) 00084 * A( M + I, J ) = matrix( I, J ) 00085 * 10 CONTINUE 00086 * 20 CONTINUE 00087 * 00088 * Unchanged on exit. 00089 * 00090 * LDA - INTEGER. 00091 * On entry, LDA specifies the first dimension of A as declared 00092 * in the calling (sub) program. LDA must be at least 00093 * ( k + 1 ). 00094 * Unchanged on exit. 00095 * 00096 * X - DOUBLE PRECISION array of DIMENSION at least 00097 * ( 1 + ( n - 1 )*abs( INCX ) ). 00098 * Before entry, the incremented array X must contain the 00099 * vector x. 00100 * Unchanged on exit. 00101 * 00102 * INCX - INTEGER. 00103 * On entry, INCX specifies the increment for the elements of 00104 * X. INCX must not be zero. 00105 * Unchanged on exit. 00106 * 00107 * BETA - DOUBLE PRECISION. 00108 * On entry, BETA specifies the scalar beta. 00109 * Unchanged on exit. 00110 * 00111 * Y - DOUBLE PRECISION array of DIMENSION at least 00112 * ( 1 + ( n - 1 )*abs( INCY ) ). 00113 * Before entry, the incremented array Y must contain the 00114 * vector y. On exit, Y is overwritten by the updated vector y. 00115 * 00116 * INCY - INTEGER. 00117 * On entry, INCY specifies the increment for the elements of 00118 * Y. INCY must not be zero. 00119 * Unchanged on exit. 00120 * 00121 * Further Details 00122 * =============== 00123 * 00124 * Level 2 Blas routine. 00125 * The vector and matrix arguments are not referenced when N = 0, or M = 0 00126 * 00127 * -- Written on 22-October-1986. 00128 * Jack Dongarra, Argonne National Lab. 00129 * Jeremy Du Croz, Nag Central Office. 00130 * Sven Hammarling, Nag Central Office. 00131 * Richard Hanson, Sandia National Labs. 00132 * 00133 * ===================================================================== 00134 * 00135 * .. Parameters .. 00136 DOUBLE PRECISION ONE,ZERO 00137 PARAMETER (ONE=1.0D+0,ZERO=0.0D+0) 00138 * .. 00139 * .. Local Scalars .. 00140 DOUBLE PRECISION TEMP1,TEMP2 00141 INTEGER I,INFO,IX,IY,J,JX,JY,KPLUS1,KX,KY,L 00142 * .. 00143 * .. External Functions .. 00144 LOGICAL LSAME 00145 EXTERNAL LSAME 00146 * .. 00147 * .. External Subroutines .. 00148 EXTERNAL XERBLA 00149 * .. 00150 * .. Intrinsic Functions .. 00151 INTRINSIC MAX,MIN 00152 * .. 00153 * 00154 * Test the input parameters. 00155 * 00156 INFO = 0 00157 IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN 00158 INFO = 1 00159 ELSE IF (N.LT.0) THEN 00160 INFO = 2 00161 ELSE IF (K.LT.0) THEN 00162 INFO = 3 00163 ELSE IF (LDA.LT. (K+1)) THEN 00164 INFO = 6 00165 ELSE IF (INCX.EQ.0) THEN 00166 INFO = 8 00167 ELSE IF (INCY.EQ.0) THEN 00168 INFO = 11 00169 END IF 00170 IF (INFO.NE.0) THEN 00171 CALL XERBLA('DSBMV ',INFO) 00172 RETURN 00173 END IF 00174 * 00175 * Quick return if possible. 00176 * 00177 IF ((N.EQ.0) .OR. ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN 00178 * 00179 * Set up the start points in X and Y. 00180 * 00181 IF (INCX.GT.0) THEN 00182 KX = 1 00183 ELSE 00184 KX = 1 - (N-1)*INCX 00185 END IF 00186 IF (INCY.GT.0) THEN 00187 KY = 1 00188 ELSE 00189 KY = 1 - (N-1)*INCY 00190 END IF 00191 * 00192 * Start the operations. In this version the elements of the array A 00193 * are accessed sequentially with one pass through A. 00194 * 00195 * First form y := beta*y. 00196 * 00197 IF (BETA.NE.ONE) THEN 00198 IF (INCY.EQ.1) THEN 00199 IF (BETA.EQ.ZERO) THEN 00200 DO 10 I = 1,N 00201 Y(I) = ZERO 00202 10 CONTINUE 00203 ELSE 00204 DO 20 I = 1,N 00205 Y(I) = BETA*Y(I) 00206 20 CONTINUE 00207 END IF 00208 ELSE 00209 IY = KY 00210 IF (BETA.EQ.ZERO) THEN 00211 DO 30 I = 1,N 00212 Y(IY) = ZERO 00213 IY = IY + INCY 00214 30 CONTINUE 00215 ELSE 00216 DO 40 I = 1,N 00217 Y(IY) = BETA*Y(IY) 00218 IY = IY + INCY 00219 40 CONTINUE 00220 END IF 00221 END IF 00222 END IF 00223 IF (ALPHA.EQ.ZERO) RETURN 00224 IF (LSAME(UPLO,'U')) THEN 00225 * 00226 * Form y when upper triangle of A is stored. 00227 * 00228 KPLUS1 = K + 1 00229 IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN 00230 DO 60 J = 1,N 00231 TEMP1 = ALPHA*X(J) 00232 TEMP2 = ZERO 00233 L = KPLUS1 - J 00234 DO 50 I = MAX(1,J-K),J - 1 00235 Y(I) = Y(I) + TEMP1*A(L+I,J) 00236 TEMP2 = TEMP2 + A(L+I,J)*X(I) 00237 50 CONTINUE 00238 Y(J) = Y(J) + TEMP1*A(KPLUS1,J) + ALPHA*TEMP2 00239 60 CONTINUE 00240 ELSE 00241 JX = KX 00242 JY = KY 00243 DO 80 J = 1,N 00244 TEMP1 = ALPHA*X(JX) 00245 TEMP2 = ZERO 00246 IX = KX 00247 IY = KY 00248 L = KPLUS1 - J 00249 DO 70 I = MAX(1,J-K),J - 1 00250 Y(IY) = Y(IY) + TEMP1*A(L+I,J) 00251 TEMP2 = TEMP2 + A(L+I,J)*X(IX) 00252 IX = IX + INCX 00253 IY = IY + INCY 00254 70 CONTINUE 00255 Y(JY) = Y(JY) + TEMP1*A(KPLUS1,J) + ALPHA*TEMP2 00256 JX = JX + INCX 00257 JY = JY + INCY 00258 IF (J.GT.K) THEN 00259 KX = KX + INCX 00260 KY = KY + INCY 00261 END IF 00262 80 CONTINUE 00263 END IF 00264 ELSE 00265 * 00266 * Form y when lower triangle of A is stored. 00267 * 00268 IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN 00269 DO 100 J = 1,N 00270 TEMP1 = ALPHA*X(J) 00271 TEMP2 = ZERO 00272 Y(J) = Y(J) + TEMP1*A(1,J) 00273 L = 1 - J 00274 DO 90 I = J + 1,MIN(N,J+K) 00275 Y(I) = Y(I) + TEMP1*A(L+I,J) 00276 TEMP2 = TEMP2 + A(L+I,J)*X(I) 00277 90 CONTINUE 00278 Y(J) = Y(J) + ALPHA*TEMP2 00279 100 CONTINUE 00280 ELSE 00281 JX = KX 00282 JY = KY 00283 DO 120 J = 1,N 00284 TEMP1 = ALPHA*X(JX) 00285 TEMP2 = ZERO 00286 Y(JY) = Y(JY) + TEMP1*A(1,J) 00287 L = 1 - J 00288 IX = JX 00289 IY = JY 00290 DO 110 I = J + 1,MIN(N,J+K) 00291 IX = IX + INCX 00292 IY = IY + INCY 00293 Y(IY) = Y(IY) + TEMP1*A(L+I,J) 00294 TEMP2 = TEMP2 + A(L+I,J)*X(IX) 00295 110 CONTINUE 00296 Y(JY) = Y(JY) + ALPHA*TEMP2 00297 JX = JX + INCX 00298 JY = JY + INCY 00299 120 CONTINUE 00300 END IF 00301 END IF 00302 * 00303 RETURN 00304 * 00305 * End of DSBMV . 00306 * 00307 END