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