00001 SUBROUTINE STBMV(UPLO,TRANS,DIAG,N,K,A,LDA,X,INCX)
00002
00003 INTEGER INCX,K,LDA,N
00004 CHARACTER DIAG,TRANS,UPLO
00005
00006
00007 REAL A(LDA,*),X(*)
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 REAL ZERO
00143 PARAMETER (ZERO=0.0E+0)
00144
00145
00146 REAL TEMP
00147 INTEGER I,INFO,IX,J,JX,KPLUS1,KX,L
00148 LOGICAL NOUNIT
00149
00150
00151 LOGICAL LSAME
00152 EXTERNAL LSAME
00153
00154
00155 EXTERNAL XERBLA
00156
00157
00158 INTRINSIC MAX,MIN
00159
00160
00161
00162
00163 INFO = 0
00164 IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
00165 INFO = 1
00166 ELSE IF (.NOT.LSAME(TRANS,'N') .AND. .NOT.LSAME(TRANS,'T') .AND.
00167 + .NOT.LSAME(TRANS,'C')) THEN
00168 INFO = 2
00169 ELSE IF (.NOT.LSAME(DIAG,'U') .AND. .NOT.LSAME(DIAG,'N')) THEN
00170 INFO = 3
00171 ELSE IF (N.LT.0) THEN
00172 INFO = 4
00173 ELSE IF (K.LT.0) THEN
00174 INFO = 5
00175 ELSE IF (LDA.LT. (K+1)) THEN
00176 INFO = 7
00177 ELSE IF (INCX.EQ.0) THEN
00178 INFO = 9
00179 END IF
00180 IF (INFO.NE.0) THEN
00181 CALL XERBLA('STBMV ',INFO)
00182 RETURN
00183 END IF
00184
00185
00186
00187 IF (N.EQ.0) RETURN
00188
00189 NOUNIT = LSAME(DIAG,'N')
00190
00191
00192
00193
00194 IF (INCX.LE.0) THEN
00195 KX = 1 - (N-1)*INCX
00196 ELSE IF (INCX.NE.1) THEN
00197 KX = 1
00198 END IF
00199
00200
00201
00202
00203 IF (LSAME(TRANS,'N')) THEN
00204
00205
00206
00207 IF (LSAME(UPLO,'U')) THEN
00208 KPLUS1 = K + 1
00209 IF (INCX.EQ.1) THEN
00210 DO 20 J = 1,N
00211 IF (X(J).NE.ZERO) THEN
00212 TEMP = X(J)
00213 L = KPLUS1 - J
00214 DO 10 I = MAX(1,J-K),J - 1
00215 X(I) = X(I) + TEMP*A(L+I,J)
00216 10 CONTINUE
00217 IF (NOUNIT) X(J) = X(J)*A(KPLUS1,J)
00218 END IF
00219 20 CONTINUE
00220 ELSE
00221 JX = KX
00222 DO 40 J = 1,N
00223 IF (X(JX).NE.ZERO) THEN
00224 TEMP = X(JX)
00225 IX = KX
00226 L = KPLUS1 - J
00227 DO 30 I = MAX(1,J-K),J - 1
00228 X(IX) = X(IX) + TEMP*A(L+I,J)
00229 IX = IX + INCX
00230 30 CONTINUE
00231 IF (NOUNIT) X(JX) = X(JX)*A(KPLUS1,J)
00232 END IF
00233 JX = JX + INCX
00234 IF (J.GT.K) KX = KX + INCX
00235 40 CONTINUE
00236 END IF
00237 ELSE
00238 IF (INCX.EQ.1) THEN
00239 DO 60 J = N,1,-1
00240 IF (X(J).NE.ZERO) THEN
00241 TEMP = X(J)
00242 L = 1 - J
00243 DO 50 I = MIN(N,J+K),J + 1,-1
00244 X(I) = X(I) + TEMP*A(L+I,J)
00245 50 CONTINUE
00246 IF (NOUNIT) X(J) = X(J)*A(1,J)
00247 END IF
00248 60 CONTINUE
00249 ELSE
00250 KX = KX + (N-1)*INCX
00251 JX = KX
00252 DO 80 J = N,1,-1
00253 IF (X(JX).NE.ZERO) THEN
00254 TEMP = X(JX)
00255 IX = KX
00256 L = 1 - J
00257 DO 70 I = MIN(N,J+K),J + 1,-1
00258 X(IX) = X(IX) + TEMP*A(L+I,J)
00259 IX = IX - INCX
00260 70 CONTINUE
00261 IF (NOUNIT) X(JX) = X(JX)*A(1,J)
00262 END IF
00263 JX = JX - INCX
00264 IF ((N-J).GE.K) KX = KX - INCX
00265 80 CONTINUE
00266 END IF
00267 END IF
00268 ELSE
00269
00270
00271
00272 IF (LSAME(UPLO,'U')) THEN
00273 KPLUS1 = K + 1
00274 IF (INCX.EQ.1) THEN
00275 DO 100 J = N,1,-1
00276 TEMP = X(J)
00277 L = KPLUS1 - J
00278 IF (NOUNIT) TEMP = TEMP*A(KPLUS1,J)
00279 DO 90 I = J - 1,MAX(1,J-K),-1
00280 TEMP = TEMP + A(L+I,J)*X(I)
00281 90 CONTINUE
00282 X(J) = TEMP
00283 100 CONTINUE
00284 ELSE
00285 KX = KX + (N-1)*INCX
00286 JX = KX
00287 DO 120 J = N,1,-1
00288 TEMP = X(JX)
00289 KX = KX - INCX
00290 IX = KX
00291 L = KPLUS1 - J
00292 IF (NOUNIT) TEMP = TEMP*A(KPLUS1,J)
00293 DO 110 I = J - 1,MAX(1,J-K),-1
00294 TEMP = TEMP + A(L+I,J)*X(IX)
00295 IX = IX - INCX
00296 110 CONTINUE
00297 X(JX) = TEMP
00298 JX = JX - INCX
00299 120 CONTINUE
00300 END IF
00301 ELSE
00302 IF (INCX.EQ.1) THEN
00303 DO 140 J = 1,N
00304 TEMP = X(J)
00305 L = 1 - J
00306 IF (NOUNIT) TEMP = TEMP*A(1,J)
00307 DO 130 I = J + 1,MIN(N,J+K)
00308 TEMP = TEMP + A(L+I,J)*X(I)
00309 130 CONTINUE
00310 X(J) = TEMP
00311 140 CONTINUE
00312 ELSE
00313 JX = KX
00314 DO 160 J = 1,N
00315 TEMP = X(JX)
00316 KX = KX + INCX
00317 IX = KX
00318 L = 1 - J
00319 IF (NOUNIT) TEMP = TEMP*A(1,J)
00320 DO 150 I = J + 1,MIN(N,J+K)
00321 TEMP = TEMP + A(L+I,J)*X(IX)
00322 IX = IX + INCX
00323 150 CONTINUE
00324 X(JX) = TEMP
00325 JX = JX + INCX
00326 160 CONTINUE
00327 END IF
00328 END IF
00329 END IF
00330
00331 RETURN
00332
00333
00334
00335 END