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