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