source: pacpussensors/trunk/Vislab/lib3dv-1.2.0/lib3dv/eigen/blas/chpmv.f

Last change on this file was 136, checked in by ldecherf, 8 years ago

Doc

File size: 8.1 KB
Line 
1 SUBROUTINE CHPMV(UPLO,N,ALPHA,AP,X,INCX,BETA,Y,INCY)
2* .. Scalar Arguments ..
3 COMPLEX ALPHA,BETA
4 INTEGER INCX,INCY,N
5 CHARACTER UPLO
6* ..
7* .. Array Arguments ..
8 COMPLEX AP(*),X(*),Y(*)
9* ..
10*
11* Purpose
12* =======
13*
14* CHPMV performs the matrix-vector operation
15*
16* y := alpha*A*x + beta*y,
17*
18* where alpha and beta are scalars, x and y are n element vectors and
19* A is an n by n hermitian matrix, supplied in packed form.
20*
21* Arguments
22* ==========
23*
24* UPLO - CHARACTER*1.
25* On entry, UPLO specifies whether the upper or lower
26* triangular part of the matrix A is supplied in the packed
27* array AP as follows:
28*
29* UPLO = 'U' or 'u' The upper triangular part of A is
30* supplied in AP.
31*
32* UPLO = 'L' or 'l' The lower triangular part of A is
33* supplied in AP.
34*
35* Unchanged on exit.
36*
37* N - INTEGER.
38* On entry, N specifies the order of the matrix A.
39* N must be at least zero.
40* Unchanged on exit.
41*
42* ALPHA - COMPLEX .
43* On entry, ALPHA specifies the scalar alpha.
44* Unchanged on exit.
45*
46* AP - COMPLEX array of DIMENSION at least
47* ( ( n*( n + 1 ) )/2 ).
48* Before entry with UPLO = 'U' or 'u', the array AP must
49* contain the upper triangular part of the hermitian matrix
50* packed sequentially, column by column, so that AP( 1 )
51* contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 )
52* and a( 2, 2 ) respectively, and so on.
53* Before entry with UPLO = 'L' or 'l', the array AP must
54* contain the lower triangular part of the hermitian matrix
55* packed sequentially, column by column, so that AP( 1 )
56* contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 )
57* and a( 3, 1 ) respectively, and so on.
58* Note that the imaginary parts of the diagonal elements need
59* not be set and are assumed to be zero.
60* Unchanged on exit.
61*
62* X - COMPLEX array of dimension at least
63* ( 1 + ( n - 1 )*abs( INCX ) ).
64* Before entry, the incremented array X must contain the n
65* element vector x.
66* Unchanged on exit.
67*
68* INCX - INTEGER.
69* On entry, INCX specifies the increment for the elements of
70* X. INCX must not be zero.
71* Unchanged on exit.
72*
73* BETA - COMPLEX .
74* On entry, BETA specifies the scalar beta. When BETA is
75* supplied as zero then Y need not be set on input.
76* Unchanged on exit.
77*
78* Y - COMPLEX array of dimension at least
79* ( 1 + ( n - 1 )*abs( INCY ) ).
80* Before entry, the incremented array Y must contain the n
81* element vector y. On exit, Y is overwritten by the updated
82* vector y.
83*
84* INCY - INTEGER.
85* On entry, INCY specifies the increment for the elements of
86* Y. INCY must not be zero.
87* Unchanged on exit.
88*
89* Further Details
90* ===============
91*
92* Level 2 Blas routine.
93*
94* -- Written on 22-October-1986.
95* Jack Dongarra, Argonne National Lab.
96* Jeremy Du Croz, Nag Central Office.
97* Sven Hammarling, Nag Central Office.
98* Richard Hanson, Sandia National Labs.
99*
100* =====================================================================
101*
102* .. Parameters ..
103 COMPLEX ONE
104 PARAMETER (ONE= (1.0E+0,0.0E+0))
105 COMPLEX ZERO
106 PARAMETER (ZERO= (0.0E+0,0.0E+0))
107* ..
108* .. Local Scalars ..
109 COMPLEX TEMP1,TEMP2
110 INTEGER I,INFO,IX,IY,J,JX,JY,K,KK,KX,KY
111* ..
112* .. External Functions ..
113 LOGICAL LSAME
114 EXTERNAL LSAME
115* ..
116* .. External Subroutines ..
117 EXTERNAL XERBLA
118* ..
119* .. Intrinsic Functions ..
120 INTRINSIC CONJG,REAL
121* ..
122*
123* Test the input parameters.
124*
125 INFO = 0
126 IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
127 INFO = 1
128 ELSE IF (N.LT.0) THEN
129 INFO = 2
130 ELSE IF (INCX.EQ.0) THEN
131 INFO = 6
132 ELSE IF (INCY.EQ.0) THEN
133 INFO = 9
134 END IF
135 IF (INFO.NE.0) THEN
136 CALL XERBLA('CHPMV ',INFO)
137 RETURN
138 END IF
139*
140* Quick return if possible.
141*
142 IF ((N.EQ.0) .OR. ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN
143*
144* Set up the start points in X and Y.
145*
146 IF (INCX.GT.0) THEN
147 KX = 1
148 ELSE
149 KX = 1 - (N-1)*INCX
150 END IF
151 IF (INCY.GT.0) THEN
152 KY = 1
153 ELSE
154 KY = 1 - (N-1)*INCY
155 END IF
156*
157* Start the operations. In this version the elements of the array AP
158* are accessed sequentially with one pass through AP.
159*
160* First form y := beta*y.
161*
162 IF (BETA.NE.ONE) THEN
163 IF (INCY.EQ.1) THEN
164 IF (BETA.EQ.ZERO) THEN
165 DO 10 I = 1,N
166 Y(I) = ZERO
167 10 CONTINUE
168 ELSE
169 DO 20 I = 1,N
170 Y(I) = BETA*Y(I)
171 20 CONTINUE
172 END IF
173 ELSE
174 IY = KY
175 IF (BETA.EQ.ZERO) THEN
176 DO 30 I = 1,N
177 Y(IY) = ZERO
178 IY = IY + INCY
179 30 CONTINUE
180 ELSE
181 DO 40 I = 1,N
182 Y(IY) = BETA*Y(IY)
183 IY = IY + INCY
184 40 CONTINUE
185 END IF
186 END IF
187 END IF
188 IF (ALPHA.EQ.ZERO) RETURN
189 KK = 1
190 IF (LSAME(UPLO,'U')) THEN
191*
192* Form y when AP contains the upper triangle.
193*
194 IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
195 DO 60 J = 1,N
196 TEMP1 = ALPHA*X(J)
197 TEMP2 = ZERO
198 K = KK
199 DO 50 I = 1,J - 1
200 Y(I) = Y(I) + TEMP1*AP(K)
201 TEMP2 = TEMP2 + CONJG(AP(K))*X(I)
202 K = K + 1
203 50 CONTINUE
204 Y(J) = Y(J) + TEMP1*REAL(AP(KK+J-1)) + ALPHA*TEMP2
205 KK = KK + J
206 60 CONTINUE
207 ELSE
208 JX = KX
209 JY = KY
210 DO 80 J = 1,N
211 TEMP1 = ALPHA*X(JX)
212 TEMP2 = ZERO
213 IX = KX
214 IY = KY
215 DO 70 K = KK,KK + J - 2
216 Y(IY) = Y(IY) + TEMP1*AP(K)
217 TEMP2 = TEMP2 + CONJG(AP(K))*X(IX)
218 IX = IX + INCX
219 IY = IY + INCY
220 70 CONTINUE
221 Y(JY) = Y(JY) + TEMP1*REAL(AP(KK+J-1)) + ALPHA*TEMP2
222 JX = JX + INCX
223 JY = JY + INCY
224 KK = KK + J
225 80 CONTINUE
226 END IF
227 ELSE
228*
229* Form y when AP contains the lower triangle.
230*
231 IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
232 DO 100 J = 1,N
233 TEMP1 = ALPHA*X(J)
234 TEMP2 = ZERO
235 Y(J) = Y(J) + TEMP1*REAL(AP(KK))
236 K = KK + 1
237 DO 90 I = J + 1,N
238 Y(I) = Y(I) + TEMP1*AP(K)
239 TEMP2 = TEMP2 + CONJG(AP(K))*X(I)
240 K = K + 1
241 90 CONTINUE
242 Y(J) = Y(J) + ALPHA*TEMP2
243 KK = KK + (N-J+1)
244 100 CONTINUE
245 ELSE
246 JX = KX
247 JY = KY
248 DO 120 J = 1,N
249 TEMP1 = ALPHA*X(JX)
250 TEMP2 = ZERO
251 Y(JY) = Y(JY) + TEMP1*REAL(AP(KK))
252 IX = JX
253 IY = JY
254 DO 110 K = KK + 1,KK + N - J
255 IX = IX + INCX
256 IY = IY + INCY
257 Y(IY) = Y(IY) + TEMP1*AP(K)
258 TEMP2 = TEMP2 + CONJG(AP(K))*X(IX)
259 110 CONTINUE
260 Y(JY) = Y(JY) + ALPHA*TEMP2
261 JX = JX + INCX
262 JY = JY + INCY
263 KK = KK + (N-J+1)
264 120 CONTINUE
265 END IF
266 END IF
267*
268 RETURN
269*
270* End of CHPMV .
271*
272 END
Note: See TracBrowser for help on using the repository browser.