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