1
SUBROUTINE ZHPMV(UPLO,N,ALPHA,AP,X,INCX,BETA,Y,INCY)
2
* .. Scalar Arguments ..
3
DOUBLE COMPLEX ALPHA,BETA
7
* .. Array Arguments ..
8
DOUBLE COMPLEX AP(*),X(*),Y(*)
14
* ZHPMV performs the matrix-vector operation
16
* y := alpha*A*x + beta*y,
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.
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:
29
* UPLO = 'U' or 'u' The upper triangular part of A is
32
* UPLO = 'L' or 'l' The lower triangular part of A is
38
* On entry, N specifies the order of the matrix A.
39
* N must be at least zero.
42
* ALPHA - COMPLEX*16 .
43
* On entry, ALPHA specifies the scalar alpha.
46
* AP - COMPLEX*16 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.
62
* X - COMPLEX*16 array of dimension at least
63
* ( 1 + ( n - 1 )*abs( INCX ) ).
64
* Before entry, the incremented array X must contain the n
69
* On entry, INCX specifies the increment for the elements of
70
* X. INCX must not be zero.
74
* On entry, BETA specifies the scalar beta. When BETA is
75
* supplied as zero then Y need not be set on input.
78
* Y - COMPLEX*16 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
85
* On entry, INCY specifies the increment for the elements of
86
* Y. INCY must not be zero.
90
* Level 2 Blas routine.
92
* -- Written on 22-October-1986.
93
* Jack Dongarra, Argonne National Lab.
94
* Jeremy Du Croz, Nag Central Office.
95
* Sven Hammarling, Nag Central Office.
96
* Richard Hanson, Sandia National Labs.
101
PARAMETER (ONE= (1.0D+0,0.0D+0))
103
PARAMETER (ZERO= (0.0D+0,0.0D+0))
105
* .. Local Scalars ..
106
DOUBLE COMPLEX TEMP1,TEMP2
107
INTEGER I,INFO,IX,IY,J,JX,JY,K,KK,KX,KY
109
* .. External Functions ..
113
* .. External Subroutines ..
116
* .. Intrinsic Functions ..
117
INTRINSIC DBLE,DCONJG
120
* Test the input parameters.
123
IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
125
ELSE IF (N.LT.0) THEN
127
ELSE IF (INCX.EQ.0) THEN
129
ELSE IF (INCY.EQ.0) THEN
133
CALL XERBLA('ZHPMV ',INFO)
137
* Quick return if possible.
139
IF ((N.EQ.0) .OR. ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN
141
* Set up the start points in X and Y.
154
* Start the operations. In this version the elements of the array AP
155
* are accessed sequentially with one pass through AP.
157
* First form y := beta*y.
159
IF (BETA.NE.ONE) THEN
161
IF (BETA.EQ.ZERO) THEN
172
IF (BETA.EQ.ZERO) THEN
185
IF (ALPHA.EQ.ZERO) RETURN
187
IF (LSAME(UPLO,'U')) THEN
189
* Form y when AP contains the upper triangle.
191
IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
197
Y(I) = Y(I) + TEMP1*AP(K)
198
TEMP2 = TEMP2 + DCONJG(AP(K))*X(I)
201
Y(J) = Y(J) + TEMP1*DBLE(AP(KK+J-1)) + ALPHA*TEMP2
212
DO 70 K = KK,KK + J - 2
213
Y(IY) = Y(IY) + TEMP1*AP(K)
214
TEMP2 = TEMP2 + DCONJG(AP(K))*X(IX)
218
Y(JY) = Y(JY) + TEMP1*DBLE(AP(KK+J-1)) + ALPHA*TEMP2
226
* Form y when AP contains the lower triangle.
228
IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
232
Y(J) = Y(J) + TEMP1*DBLE(AP(KK))
235
Y(I) = Y(I) + TEMP1*AP(K)
236
TEMP2 = TEMP2 + DCONJG(AP(K))*X(I)
239
Y(J) = Y(J) + ALPHA*TEMP2
248
Y(JY) = Y(JY) + TEMP1*DBLE(AP(KK))
251
DO 110 K = KK + 1,KK + N - J
254
Y(IY) = Y(IY) + TEMP1*AP(K)
255
TEMP2 = TEMP2 + DCONJG(AP(K))*X(IX)
257
Y(JY) = Y(JY) + ALPHA*TEMP2