00001 SUBROUTINE DTPSV(UPLO,TRANS,DIAG,N,AP,X,INCX)
00002
00003 INTEGER INCX,N
00004 CHARACTER DIAG,TRANS,UPLO
00005
00006
00007 DOUBLE PRECISION AP(*),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 DOUBLE PRECISION ZERO
00106 PARAMETER (ZERO=0.0D+0)
00107
00108
00109 DOUBLE PRECISION TEMP
00110 INTEGER I,INFO,IX,J,JX,K,KK,KX
00111 LOGICAL NOUNIT
00112
00113
00114 LOGICAL LSAME
00115 EXTERNAL LSAME
00116
00117
00118 EXTERNAL XERBLA
00119
00120
00121
00122
00123 INFO = 0
00124 IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
00125 INFO = 1
00126 ELSE IF (.NOT.LSAME(TRANS,'N') .AND. .NOT.LSAME(TRANS,'T') .AND.
00127 + .NOT.LSAME(TRANS,'C')) THEN
00128 INFO = 2
00129 ELSE IF (.NOT.LSAME(DIAG,'U') .AND. .NOT.LSAME(DIAG,'N')) THEN
00130 INFO = 3
00131 ELSE IF (N.LT.0) THEN
00132 INFO = 4
00133 ELSE IF (INCX.EQ.0) THEN
00134 INFO = 7
00135 END IF
00136 IF (INFO.NE.0) THEN
00137 CALL XERBLA('DTPSV ',INFO)
00138 RETURN
00139 END IF
00140
00141
00142
00143 IF (N.EQ.0) RETURN
00144
00145 NOUNIT = LSAME(DIAG,'N')
00146
00147
00148
00149
00150 IF (INCX.LE.0) THEN
00151 KX = 1 - (N-1)*INCX
00152 ELSE IF (INCX.NE.1) THEN
00153 KX = 1
00154 END IF
00155
00156
00157
00158
00159 IF (LSAME(TRANS,'N')) THEN
00160
00161
00162
00163 IF (LSAME(UPLO,'U')) THEN
00164 KK = (N* (N+1))/2
00165 IF (INCX.EQ.1) THEN
00166 DO 20 J = N,1,-1
00167 IF (X(J).NE.ZERO) THEN
00168 IF (NOUNIT) X(J) = X(J)/AP(KK)
00169 TEMP = X(J)
00170 K = KK - 1
00171 DO 10 I = J - 1,1,-1
00172 X(I) = X(I) - TEMP*AP(K)
00173 K = K - 1
00174 10 CONTINUE
00175 END IF
00176 KK = KK - J
00177 20 CONTINUE
00178 ELSE
00179 JX = KX + (N-1)*INCX
00180 DO 40 J = N,1,-1
00181 IF (X(JX).NE.ZERO) THEN
00182 IF (NOUNIT) X(JX) = X(JX)/AP(KK)
00183 TEMP = X(JX)
00184 IX = JX
00185 DO 30 K = KK - 1,KK - J + 1,-1
00186 IX = IX - INCX
00187 X(IX) = X(IX) - TEMP*AP(K)
00188 30 CONTINUE
00189 END IF
00190 JX = JX - INCX
00191 KK = KK - J
00192 40 CONTINUE
00193 END IF
00194 ELSE
00195 KK = 1
00196 IF (INCX.EQ.1) THEN
00197 DO 60 J = 1,N
00198 IF (X(J).NE.ZERO) THEN
00199 IF (NOUNIT) X(J) = X(J)/AP(KK)
00200 TEMP = X(J)
00201 K = KK + 1
00202 DO 50 I = J + 1,N
00203 X(I) = X(I) - TEMP*AP(K)
00204 K = K + 1
00205 50 CONTINUE
00206 END IF
00207 KK = KK + (N-J+1)
00208 60 CONTINUE
00209 ELSE
00210 JX = KX
00211 DO 80 J = 1,N
00212 IF (X(JX).NE.ZERO) THEN
00213 IF (NOUNIT) X(JX) = X(JX)/AP(KK)
00214 TEMP = X(JX)
00215 IX = JX
00216 DO 70 K = KK + 1,KK + N - J
00217 IX = IX + INCX
00218 X(IX) = X(IX) - TEMP*AP(K)
00219 70 CONTINUE
00220 END IF
00221 JX = JX + INCX
00222 KK = KK + (N-J+1)
00223 80 CONTINUE
00224 END IF
00225 END IF
00226 ELSE
00227
00228
00229
00230 IF (LSAME(UPLO,'U')) THEN
00231 KK = 1
00232 IF (INCX.EQ.1) THEN
00233 DO 100 J = 1,N
00234 TEMP = X(J)
00235 K = KK
00236 DO 90 I = 1,J - 1
00237 TEMP = TEMP - AP(K)*X(I)
00238 K = K + 1
00239 90 CONTINUE
00240 IF (NOUNIT) TEMP = TEMP/AP(KK+J-1)
00241 X(J) = TEMP
00242 KK = KK + J
00243 100 CONTINUE
00244 ELSE
00245 JX = KX
00246 DO 120 J = 1,N
00247 TEMP = X(JX)
00248 IX = KX
00249 DO 110 K = KK,KK + J - 2
00250 TEMP = TEMP - AP(K)*X(IX)
00251 IX = IX + INCX
00252 110 CONTINUE
00253 IF (NOUNIT) TEMP = TEMP/AP(KK+J-1)
00254 X(JX) = TEMP
00255 JX = JX + INCX
00256 KK = KK + J
00257 120 CONTINUE
00258 END IF
00259 ELSE
00260 KK = (N* (N+1))/2
00261 IF (INCX.EQ.1) THEN
00262 DO 140 J = N,1,-1
00263 TEMP = X(J)
00264 K = KK
00265 DO 130 I = N,J + 1,-1
00266 TEMP = TEMP - AP(K)*X(I)
00267 K = K - 1
00268 130 CONTINUE
00269 IF (NOUNIT) TEMP = TEMP/AP(KK-N+J)
00270 X(J) = TEMP
00271 KK = KK - (N-J+1)
00272 140 CONTINUE
00273 ELSE
00274 KX = KX + (N-1)*INCX
00275 JX = KX
00276 DO 160 J = N,1,-1
00277 TEMP = X(JX)
00278 IX = KX
00279 DO 150 K = KK,KK - (N- (J+1)),-1
00280 TEMP = TEMP - AP(K)*X(IX)
00281 IX = IX - INCX
00282 150 CONTINUE
00283 IF (NOUNIT) TEMP = TEMP/AP(KK-N+J)
00284 X(JX) = TEMP
00285 JX = JX - INCX
00286 KK = KK - (N-J+1)
00287 160 CONTINUE
00288 END IF
00289 END IF
00290 END IF
00291
00292 RETURN
00293
00294
00295
00296 END