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