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