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