00001 SUBROUTINE DTRMV(UPLO,TRANS,DIAG,N,A,LDA,X,INCX)
00002
00003 INTEGER INCX,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 DOUBLE PRECISION ZERO
00106 PARAMETER (ZERO=0.0D+0)
00107
00108
00109 DOUBLE PRECISION TEMP
00110 INTEGER I,INFO,IX,J,JX,KX
00111 LOGICAL NOUNIT
00112
00113
00114 LOGICAL LSAME
00115 EXTERNAL LSAME
00116
00117
00118 EXTERNAL XERBLA
00119
00120
00121 INTRINSIC 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('DTRMV ',INFO)
00143 RETURN
00144 END IF
00145
00146
00147
00148 IF (N.EQ.0) RETURN
00149
00150 NOUNIT = LSAME(DIAG,'N')
00151
00152
00153
00154
00155 IF (INCX.LE.0) THEN
00156 KX = 1 - (N-1)*INCX
00157 ELSE IF (INCX.NE.1) THEN
00158 KX = 1
00159 END IF
00160
00161
00162
00163
00164 IF (LSAME(TRANS,'N')) THEN
00165
00166
00167
00168 IF (LSAME(UPLO,'U')) THEN
00169 IF (INCX.EQ.1) THEN
00170 DO 20 J = 1,N
00171 IF (X(J).NE.ZERO) THEN
00172 TEMP = X(J)
00173 DO 10 I = 1,J - 1
00174 X(I) = X(I) + TEMP*A(I,J)
00175 10 CONTINUE
00176 IF (NOUNIT) X(J) = X(J)*A(J,J)
00177 END IF
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 I = 1,J - 1
00186 X(IX) = X(IX) + TEMP*A(I,J)
00187 IX = IX + INCX
00188 30 CONTINUE
00189 IF (NOUNIT) X(JX) = X(JX)*A(J,J)
00190 END IF
00191 JX = JX + INCX
00192 40 CONTINUE
00193 END IF
00194 ELSE
00195 IF (INCX.EQ.1) THEN
00196 DO 60 J = N,1,-1
00197 IF (X(J).NE.ZERO) THEN
00198 TEMP = X(J)
00199 DO 50 I = N,J + 1,-1
00200 X(I) = X(I) + TEMP*A(I,J)
00201 50 CONTINUE
00202 IF (NOUNIT) X(J) = X(J)*A(J,J)
00203 END IF
00204 60 CONTINUE
00205 ELSE
00206 KX = KX + (N-1)*INCX
00207 JX = KX
00208 DO 80 J = N,1,-1
00209 IF (X(JX).NE.ZERO) THEN
00210 TEMP = X(JX)
00211 IX = KX
00212 DO 70 I = N,J + 1,-1
00213 X(IX) = X(IX) + TEMP*A(I,J)
00214 IX = IX - INCX
00215 70 CONTINUE
00216 IF (NOUNIT) X(JX) = X(JX)*A(J,J)
00217 END IF
00218 JX = JX - INCX
00219 80 CONTINUE
00220 END IF
00221 END IF
00222 ELSE
00223
00224
00225
00226 IF (LSAME(UPLO,'U')) THEN
00227 IF (INCX.EQ.1) THEN
00228 DO 100 J = N,1,-1
00229 TEMP = X(J)
00230 IF (NOUNIT) TEMP = TEMP*A(J,J)
00231 DO 90 I = J - 1,1,-1
00232 TEMP = TEMP + A(I,J)*X(I)
00233 90 CONTINUE
00234 X(J) = TEMP
00235 100 CONTINUE
00236 ELSE
00237 JX = KX + (N-1)*INCX
00238 DO 120 J = N,1,-1
00239 TEMP = X(JX)
00240 IX = JX
00241 IF (NOUNIT) TEMP = TEMP*A(J,J)
00242 DO 110 I = J - 1,1,-1
00243 IX = IX - INCX
00244 TEMP = TEMP + A(I,J)*X(IX)
00245 110 CONTINUE
00246 X(JX) = TEMP
00247 JX = JX - INCX
00248 120 CONTINUE
00249 END IF
00250 ELSE
00251 IF (INCX.EQ.1) THEN
00252 DO 140 J = 1,N
00253 TEMP = X(J)
00254 IF (NOUNIT) TEMP = TEMP*A(J,J)
00255 DO 130 I = J + 1,N
00256 TEMP = TEMP + A(I,J)*X(I)
00257 130 CONTINUE
00258 X(J) = TEMP
00259 140 CONTINUE
00260 ELSE
00261 JX = KX
00262 DO 160 J = 1,N
00263 TEMP = X(JX)
00264 IX = JX
00265 IF (NOUNIT) TEMP = TEMP*A(J,J)
00266 DO 150 I = J + 1,N
00267 IX = IX + INCX
00268 TEMP = TEMP + A(I,J)*X(IX)
00269 150 CONTINUE
00270 X(JX) = TEMP
00271 JX = JX + INCX
00272 160 CONTINUE
00273 END IF
00274 END IF
00275 END IF
00276
00277 RETURN
00278
00279
00280
00281 END