LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zhemv.f
Go to the documentation of this file.
1*> \brief \b ZHEMV
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8* Definition:
9* ===========
10*
11* SUBROUTINE ZHEMV(UPLO,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
12*
13* .. Scalar Arguments ..
14* COMPLEX*16 ALPHA,BETA
15* INTEGER INCX,INCY,LDA,N
16* CHARACTER UPLO
17* ..
18* .. Array Arguments ..
19* COMPLEX*16 A(LDA,*),X(*),Y(*)
20* ..
21*
22*
23*> \par Purpose:
24* =============
25*>
26*> \verbatim
27*>
28*> ZHEMV performs the matrix-vector operation
29*>
30*> y := alpha*A*x + beta*y,
31*>
32*> where alpha and beta are scalars, x and y are n element vectors and
33*> A is an n by n hermitian matrix.
34*> \endverbatim
35*
36* Arguments:
37* ==========
38*
39*> \param[in] UPLO
40*> \verbatim
41*> UPLO is CHARACTER*1
42*> On entry, UPLO specifies whether the upper or lower
43*> triangular part of the array A is to be referenced as
44*> follows:
45*>
46*> UPLO = 'U' or 'u' Only the upper triangular part of A
47*> is to be referenced.
48*>
49*> UPLO = 'L' or 'l' Only the lower triangular part of A
50*> is to be referenced.
51*> \endverbatim
52*>
53*> \param[in] N
54*> \verbatim
55*> N is INTEGER
56*> On entry, N specifies the order of the matrix A.
57*> N must be at least zero.
58*> \endverbatim
59*>
60*> \param[in] ALPHA
61*> \verbatim
62*> ALPHA is COMPLEX*16
63*> On entry, ALPHA specifies the scalar alpha.
64*> \endverbatim
65*>
66*> \param[in] A
67*> \verbatim
68*> A is COMPLEX*16 array, dimension ( LDA, N )
69*> Before entry with UPLO = 'U' or 'u', the leading n by n
70*> upper triangular part of the array A must contain the upper
71*> triangular part of the hermitian matrix and the strictly
72*> lower triangular part of A is not referenced.
73*> Before entry with UPLO = 'L' or 'l', the leading n by n
74*> lower triangular part of the array A must contain the lower
75*> triangular part of the hermitian matrix and the strictly
76*> upper triangular part of A is not referenced.
77*> Note that the imaginary parts of the diagonal elements need
78*> not be set and are assumed to be zero.
79*> \endverbatim
80*>
81*> \param[in] LDA
82*> \verbatim
83*> LDA is INTEGER
84*> On entry, LDA specifies the first dimension of A as declared
85*> in the calling (sub) program. LDA must be at least
86*> max( 1, n ).
87*> \endverbatim
88*>
89*> \param[in] X
90*> \verbatim
91*> X is COMPLEX*16 array, dimension at least
92*> ( 1 + ( n - 1 )*abs( INCX ) ).
93*> Before entry, the incremented array X must contain the n
94*> element vector x.
95*> \endverbatim
96*>
97*> \param[in] INCX
98*> \verbatim
99*> INCX is INTEGER
100*> On entry, INCX specifies the increment for the elements of
101*> X. INCX must not be zero.
102*> \endverbatim
103*>
104*> \param[in] BETA
105*> \verbatim
106*> BETA is COMPLEX*16
107*> On entry, BETA specifies the scalar beta. When BETA is
108*> supplied as zero then Y need not be set on input.
109*> \endverbatim
110*>
111*> \param[in,out] Y
112*> \verbatim
113*> Y is COMPLEX*16 array, dimension at least
114*> ( 1 + ( n - 1 )*abs( INCY ) ).
115*> Before entry, the incremented array Y must contain the n
116*> element vector y. On exit, Y is overwritten by the updated
117*> vector y.
118*> \endverbatim
119*>
120*> \param[in] INCY
121*> \verbatim
122*> INCY is INTEGER
123*> On entry, INCY specifies the increment for the elements of
124*> Y. INCY must not be zero.
125*> \endverbatim
126*
127* Authors:
128* ========
129*
130*> \author Univ. of Tennessee
131*> \author Univ. of California Berkeley
132*> \author Univ. of Colorado Denver
133*> \author NAG Ltd.
134*
135*> \ingroup hemv
136*
137*> \par Further Details:
138* =====================
139*>
140*> \verbatim
141*>
142*> Level 2 Blas routine.
143*> The vector and matrix arguments are not referenced when N = 0, or M = 0
144*>
145*> -- Written on 22-October-1986.
146*> Jack Dongarra, Argonne National Lab.
147*> Jeremy Du Croz, Nag Central Office.
148*> Sven Hammarling, Nag Central Office.
149*> Richard Hanson, Sandia National Labs.
150*> \endverbatim
151*>
152* =====================================================================
153 SUBROUTINE zhemv(UPLO,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
154*
155* -- Reference BLAS level2 routine --
156* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
157* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
158*
159* .. Scalar Arguments ..
160 COMPLEX*16 ALPHA,BETA
161 INTEGER INCX,INCY,LDA,N
162 CHARACTER UPLO
163* ..
164* .. Array Arguments ..
165 COMPLEX*16 A(LDA,*),X(*),Y(*)
166* ..
167*
168* =====================================================================
169*
170* .. Parameters ..
171 COMPLEX*16 ONE
172 parameter(one= (1.0d+0,0.0d+0))
173 COMPLEX*16 ZERO
174 parameter(zero= (0.0d+0,0.0d+0))
175* ..
176* .. Local Scalars ..
177 COMPLEX*16 TEMP1,TEMP2
178 INTEGER I,INFO,IX,IY,J,JX,JY,KX,KY
179* ..
180* .. External Functions ..
181 LOGICAL LSAME
182 EXTERNAL lsame
183* ..
184* .. External Subroutines ..
185 EXTERNAL xerbla
186* ..
187* .. Intrinsic Functions ..
188 INTRINSIC dble,dconjg,max
189* ..
190*
191* Test the input parameters.
192*
193 info = 0
194 IF (.NOT.lsame(uplo,'U') .AND. .NOT.lsame(uplo,'L')) THEN
195 info = 1
196 ELSE IF (n.LT.0) THEN
197 info = 2
198 ELSE IF (lda.LT.max(1,n)) THEN
199 info = 5
200 ELSE IF (incx.EQ.0) THEN
201 info = 7
202 ELSE IF (incy.EQ.0) THEN
203 info = 10
204 END IF
205 IF (info.NE.0) THEN
206 CALL xerbla('ZHEMV ',info)
207 RETURN
208 END IF
209*
210* Quick return if possible.
211*
212 IF ((n.EQ.0) .OR. ((alpha.EQ.zero).AND. (beta.EQ.one))) RETURN
213*
214* Set up the start points in X and Y.
215*
216 IF (incx.GT.0) THEN
217 kx = 1
218 ELSE
219 kx = 1 - (n-1)*incx
220 END IF
221 IF (incy.GT.0) THEN
222 ky = 1
223 ELSE
224 ky = 1 - (n-1)*incy
225 END IF
226*
227* Start the operations. In this version the elements of A are
228* accessed sequentially with one pass through the triangular part
229* of A.
230*
231* First form y := beta*y.
232*
233 IF (beta.NE.one) THEN
234 IF (incy.EQ.1) THEN
235 IF (beta.EQ.zero) THEN
236 DO 10 i = 1,n
237 y(i) = zero
238 10 CONTINUE
239 ELSE
240 DO 20 i = 1,n
241 y(i) = beta*y(i)
242 20 CONTINUE
243 END IF
244 ELSE
245 iy = ky
246 IF (beta.EQ.zero) THEN
247 DO 30 i = 1,n
248 y(iy) = zero
249 iy = iy + incy
250 30 CONTINUE
251 ELSE
252 DO 40 i = 1,n
253 y(iy) = beta*y(iy)
254 iy = iy + incy
255 40 CONTINUE
256 END IF
257 END IF
258 END IF
259 IF (alpha.EQ.zero) RETURN
260 IF (lsame(uplo,'U')) THEN
261*
262* Form y when A is stored in upper triangle.
263*
264 IF ((incx.EQ.1) .AND. (incy.EQ.1)) THEN
265 DO 60 j = 1,n
266 temp1 = alpha*x(j)
267 temp2 = zero
268 DO 50 i = 1,j - 1
269 y(i) = y(i) + temp1*a(i,j)
270 temp2 = temp2 + dconjg(a(i,j))*x(i)
271 50 CONTINUE
272 y(j) = y(j) + temp1*dble(a(j,j)) + alpha*temp2
273 60 CONTINUE
274 ELSE
275 jx = kx
276 jy = ky
277 DO 80 j = 1,n
278 temp1 = alpha*x(jx)
279 temp2 = zero
280 ix = kx
281 iy = ky
282 DO 70 i = 1,j - 1
283 y(iy) = y(iy) + temp1*a(i,j)
284 temp2 = temp2 + dconjg(a(i,j))*x(ix)
285 ix = ix + incx
286 iy = iy + incy
287 70 CONTINUE
288 y(jy) = y(jy) + temp1*dble(a(j,j)) + alpha*temp2
289 jx = jx + incx
290 jy = jy + incy
291 80 CONTINUE
292 END IF
293 ELSE
294*
295* Form y when A is stored in lower triangle.
296*
297 IF ((incx.EQ.1) .AND. (incy.EQ.1)) THEN
298 DO 100 j = 1,n
299 temp1 = alpha*x(j)
300 temp2 = zero
301 y(j) = y(j) + temp1*dble(a(j,j))
302 DO 90 i = j + 1,n
303 y(i) = y(i) + temp1*a(i,j)
304 temp2 = temp2 + dconjg(a(i,j))*x(i)
305 90 CONTINUE
306 y(j) = y(j) + alpha*temp2
307 100 CONTINUE
308 ELSE
309 jx = kx
310 jy = ky
311 DO 120 j = 1,n
312 temp1 = alpha*x(jx)
313 temp2 = zero
314 y(jy) = y(jy) + temp1*dble(a(j,j))
315 ix = jx
316 iy = jy
317 DO 110 i = j + 1,n
318 ix = ix + incx
319 iy = iy + incy
320 y(iy) = y(iy) + temp1*a(i,j)
321 temp2 = temp2 + dconjg(a(i,j))*x(ix)
322 110 CONTINUE
323 y(jy) = y(jy) + alpha*temp2
324 jx = jx + incx
325 jy = jy + incy
326 120 CONTINUE
327 END IF
328 END IF
329*
330 RETURN
331*
332* End of ZHEMV
333*
334 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zhemv(uplo, n, alpha, a, lda, x, incx, beta, y, incy)
ZHEMV
Definition zhemv.f:154