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