00001 SUBROUTINE ZTBMV(UPLO,TRANS,DIAG,N,K,A,LDA,X,INCX)
00002
00003 INTEGER INCX,K,LDA,N
00004 CHARACTER DIAG,TRANS,UPLO
00005
00006
00007 DOUBLE COMPLEX 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 DOUBLE COMPLEX ZERO
00143 PARAMETER (ZERO= (0.0D+0,0.0D+0))
00144
00145
00146 DOUBLE COMPLEX TEMP
00147 INTEGER I,INFO,IX,J,JX,KPLUS1,KX,L
00148 LOGICAL NOCONJ,NOUNIT
00149
00150
00151 LOGICAL LSAME
00152 EXTERNAL LSAME
00153
00154
00155 EXTERNAL XERBLA
00156
00157
00158 INTRINSIC DCONJG,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('ZTBMV ',INFO)
00182 RETURN
00183 END IF
00184
00185
00186
00187 IF (N.EQ.0) RETURN
00188
00189 NOCONJ = LSAME(TRANS,'T')
00190 NOUNIT = LSAME(DIAG,'N')
00191
00192
00193
00194
00195 IF (INCX.LE.0) THEN
00196 KX = 1 - (N-1)*INCX
00197 ELSE IF (INCX.NE.1) THEN
00198 KX = 1
00199 END IF
00200
00201
00202
00203
00204 IF (LSAME(TRANS,'N')) THEN
00205
00206
00207
00208 IF (LSAME(UPLO,'U')) THEN
00209 KPLUS1 = K + 1
00210 IF (INCX.EQ.1) THEN
00211 DO 20 J = 1,N
00212 IF (X(J).NE.ZERO) THEN
00213 TEMP = X(J)
00214 L = KPLUS1 - J
00215 DO 10 I = MAX(1,J-K),J - 1
00216 X(I) = X(I) + TEMP*A(L+I,J)
00217 10 CONTINUE
00218 IF (NOUNIT) X(J) = X(J)*A(KPLUS1,J)
00219 END IF
00220 20 CONTINUE
00221 ELSE
00222 JX = KX
00223 DO 40 J = 1,N
00224 IF (X(JX).NE.ZERO) THEN
00225 TEMP = X(JX)
00226 IX = KX
00227 L = KPLUS1 - J
00228 DO 30 I = MAX(1,J-K),J - 1
00229 X(IX) = X(IX) + TEMP*A(L+I,J)
00230 IX = IX + INCX
00231 30 CONTINUE
00232 IF (NOUNIT) X(JX) = X(JX)*A(KPLUS1,J)
00233 END IF
00234 JX = JX + INCX
00235 IF (J.GT.K) KX = KX + INCX
00236 40 CONTINUE
00237 END IF
00238 ELSE
00239 IF (INCX.EQ.1) THEN
00240 DO 60 J = N,1,-1
00241 IF (X(J).NE.ZERO) THEN
00242 TEMP = X(J)
00243 L = 1 - J
00244 DO 50 I = MIN(N,J+K),J + 1,-1
00245 X(I) = X(I) + TEMP*A(L+I,J)
00246 50 CONTINUE
00247 IF (NOUNIT) X(J) = X(J)*A(1,J)
00248 END IF
00249 60 CONTINUE
00250 ELSE
00251 KX = KX + (N-1)*INCX
00252 JX = KX
00253 DO 80 J = N,1,-1
00254 IF (X(JX).NE.ZERO) THEN
00255 TEMP = X(JX)
00256 IX = KX
00257 L = 1 - J
00258 DO 70 I = MIN(N,J+K),J + 1,-1
00259 X(IX) = X(IX) + TEMP*A(L+I,J)
00260 IX = IX - INCX
00261 70 CONTINUE
00262 IF (NOUNIT) X(JX) = X(JX)*A(1,J)
00263 END IF
00264 JX = JX - INCX
00265 IF ((N-J).GE.K) KX = KX - INCX
00266 80 CONTINUE
00267 END IF
00268 END IF
00269 ELSE
00270
00271
00272
00273 IF (LSAME(UPLO,'U')) THEN
00274 KPLUS1 = K + 1
00275 IF (INCX.EQ.1) THEN
00276 DO 110 J = N,1,-1
00277 TEMP = X(J)
00278 L = KPLUS1 - J
00279 IF (NOCONJ) THEN
00280 IF (NOUNIT) TEMP = TEMP*A(KPLUS1,J)
00281 DO 90 I = J - 1,MAX(1,J-K),-1
00282 TEMP = TEMP + A(L+I,J)*X(I)
00283 90 CONTINUE
00284 ELSE
00285 IF (NOUNIT) TEMP = TEMP*DCONJG(A(KPLUS1,J))
00286 DO 100 I = J - 1,MAX(1,J-K),-1
00287 TEMP = TEMP + DCONJG(A(L+I,J))*X(I)
00288 100 CONTINUE
00289 END IF
00290 X(J) = TEMP
00291 110 CONTINUE
00292 ELSE
00293 KX = KX + (N-1)*INCX
00294 JX = KX
00295 DO 140 J = N,1,-1
00296 TEMP = X(JX)
00297 KX = KX - INCX
00298 IX = KX
00299 L = KPLUS1 - J
00300 IF (NOCONJ) THEN
00301 IF (NOUNIT) TEMP = TEMP*A(KPLUS1,J)
00302 DO 120 I = J - 1,MAX(1,J-K),-1
00303 TEMP = TEMP + A(L+I,J)*X(IX)
00304 IX = IX - INCX
00305 120 CONTINUE
00306 ELSE
00307 IF (NOUNIT) TEMP = TEMP*DCONJG(A(KPLUS1,J))
00308 DO 130 I = J - 1,MAX(1,J-K),-1
00309 TEMP = TEMP + DCONJG(A(L+I,J))*X(IX)
00310 IX = IX - INCX
00311 130 CONTINUE
00312 END IF
00313 X(JX) = TEMP
00314 JX = JX - INCX
00315 140 CONTINUE
00316 END IF
00317 ELSE
00318 IF (INCX.EQ.1) THEN
00319 DO 170 J = 1,N
00320 TEMP = X(J)
00321 L = 1 - J
00322 IF (NOCONJ) THEN
00323 IF (NOUNIT) TEMP = TEMP*A(1,J)
00324 DO 150 I = J + 1,MIN(N,J+K)
00325 TEMP = TEMP + A(L+I,J)*X(I)
00326 150 CONTINUE
00327 ELSE
00328 IF (NOUNIT) TEMP = TEMP*DCONJG(A(1,J))
00329 DO 160 I = J + 1,MIN(N,J+K)
00330 TEMP = TEMP + DCONJG(A(L+I,J))*X(I)
00331 160 CONTINUE
00332 END IF
00333 X(J) = TEMP
00334 170 CONTINUE
00335 ELSE
00336 JX = KX
00337 DO 200 J = 1,N
00338 TEMP = X(JX)
00339 KX = KX + INCX
00340 IX = KX
00341 L = 1 - J
00342 IF (NOCONJ) THEN
00343 IF (NOUNIT) TEMP = TEMP*A(1,J)
00344 DO 180 I = J + 1,MIN(N,J+K)
00345 TEMP = TEMP + A(L+I,J)*X(IX)
00346 IX = IX + INCX
00347 180 CONTINUE
00348 ELSE
00349 IF (NOUNIT) TEMP = TEMP*DCONJG(A(1,J))
00350 DO 190 I = J + 1,MIN(N,J+K)
00351 TEMP = TEMP + DCONJG(A(L+I,J))*X(IX)
00352 IX = IX + INCX
00353 190 CONTINUE
00354 END IF
00355 X(JX) = TEMP
00356 JX = JX + INCX
00357 200 CONTINUE
00358 END IF
00359 END IF
00360 END IF
00361
00362 RETURN
00363
00364
00365
00366 END