LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zhpr.f
Go to the documentation of this file.
1*> \brief \b ZHPR
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 ZHPR(UPLO,N,ALPHA,X,INCX,AP)
12*
13* .. Scalar Arguments ..
14* DOUBLE PRECISION ALPHA
15* INTEGER INCX,N
16* CHARACTER UPLO
17* ..
18* .. Array Arguments ..
19* COMPLEX*16 AP(*),X(*)
20* ..
21*
22*
23*> \par Purpose:
24* =============
25*>
26*> \verbatim
27*>
28*> ZHPR performs the hermitian rank 1 operation
29*>
30*> A := alpha*x*x**H + A,
31*>
32*> where alpha is a real scalar, x is an n element vector and A is an
33*> n by n hermitian matrix, supplied in packed form.
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 matrix A is supplied in the packed
44*> array AP as follows:
45*>
46*> UPLO = 'U' or 'u' The upper triangular part of A is
47*> supplied in AP.
48*>
49*> UPLO = 'L' or 'l' The lower triangular part of A is
50*> supplied in AP.
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 DOUBLE PRECISION.
63*> On entry, ALPHA specifies the scalar alpha.
64*> \endverbatim
65*>
66*> \param[in] X
67*> \verbatim
68*> X is COMPLEX*16 array, dimension at least
69*> ( 1 + ( n - 1 )*abs( INCX ) ).
70*> Before entry, the incremented array X must contain the n
71*> element vector x.
72*> \endverbatim
73*>
74*> \param[in] INCX
75*> \verbatim
76*> INCX is INTEGER
77*> On entry, INCX specifies the increment for the elements of
78*> X. INCX must not be zero.
79*> \endverbatim
80*>
81*> \param[in,out] AP
82*> \verbatim
83*> AP is COMPLEX*16 array, dimension at least
84*> ( ( n*( n + 1 ) )/2 ).
85*> Before entry with UPLO = 'U' or 'u', the array AP must
86*> contain the upper triangular part of the hermitian matrix
87*> packed sequentially, column by column, so that AP( 1 )
88*> contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 )
89*> and a( 2, 2 ) respectively, and so on. On exit, the array
90*> AP is overwritten by the upper triangular part of the
91*> updated matrix.
92*> Before entry with UPLO = 'L' or 'l', the array AP must
93*> contain the lower triangular part of the hermitian matrix
94*> packed sequentially, column by column, so that AP( 1 )
95*> contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 )
96*> and a( 3, 1 ) respectively, and so on. On exit, the array
97*> AP is overwritten by the lower triangular part of the
98*> updated matrix.
99*> Note that the imaginary parts of the diagonal elements need
100*> not be set, they are assumed to be zero, and on exit they
101*> are set to zero.
102*> \endverbatim
103*
104* Authors:
105* ========
106*
107*> \author Univ. of Tennessee
108*> \author Univ. of California Berkeley
109*> \author Univ. of Colorado Denver
110*> \author NAG Ltd.
111*
112*> \ingroup hpr
113*
114*> \par Further Details:
115* =====================
116*>
117*> \verbatim
118*>
119*> Level 2 Blas routine.
120*>
121*> -- Written on 22-October-1986.
122*> Jack Dongarra, Argonne National Lab.
123*> Jeremy Du Croz, Nag Central Office.
124*> Sven Hammarling, Nag Central Office.
125*> Richard Hanson, Sandia National Labs.
126*> \endverbatim
127*>
128* =====================================================================
129 SUBROUTINE zhpr(UPLO,N,ALPHA,X,INCX,AP)
130*
131* -- Reference BLAS level2 routine --
132* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
133* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
134*
135* .. Scalar Arguments ..
136 DOUBLE PRECISION ALPHA
137 INTEGER INCX,N
138 CHARACTER UPLO
139* ..
140* .. Array Arguments ..
141 COMPLEX*16 AP(*),X(*)
142* ..
143*
144* =====================================================================
145*
146* .. Parameters ..
147 COMPLEX*16 ZERO
148 parameter(zero= (0.0d+0,0.0d+0))
149* ..
150* .. Local Scalars ..
151 COMPLEX*16 TEMP
152 INTEGER I,INFO,IX,J,JX,K,KK,KX
153* ..
154* .. External Functions ..
155 LOGICAL LSAME
156 EXTERNAL lsame
157* ..
158* .. External Subroutines ..
159 EXTERNAL xerbla
160* ..
161* .. Intrinsic Functions ..
162 INTRINSIC dble,dconjg
163* ..
164*
165* Test the input parameters.
166*
167 info = 0
168 IF (.NOT.lsame(uplo,'U') .AND. .NOT.lsame(uplo,'L')) THEN
169 info = 1
170 ELSE IF (n.LT.0) THEN
171 info = 2
172 ELSE IF (incx.EQ.0) THEN
173 info = 5
174 END IF
175 IF (info.NE.0) THEN
176 CALL xerbla('ZHPR ',info)
177 RETURN
178 END IF
179*
180* Quick return if possible.
181*
182 IF ((n.EQ.0) .OR. (alpha.EQ.dble(zero))) RETURN
183*
184* Set the start point in X if the increment is not unity.
185*
186 IF (incx.LE.0) THEN
187 kx = 1 - (n-1)*incx
188 ELSE IF (incx.NE.1) THEN
189 kx = 1
190 END IF
191*
192* Start the operations. In this version the elements of the array AP
193* are accessed sequentially with one pass through AP.
194*
195 kk = 1
196 IF (lsame(uplo,'U')) THEN
197*
198* Form A when upper triangle is stored in AP.
199*
200 IF (incx.EQ.1) THEN
201 DO 20 j = 1,n
202 IF (x(j).NE.zero) THEN
203 temp = alpha*dconjg(x(j))
204 k = kk
205 DO 10 i = 1,j - 1
206 ap(k) = ap(k) + x(i)*temp
207 k = k + 1
208 10 CONTINUE
209 ap(kk+j-1) = dble(ap(kk+j-1)) + dble(x(j)*temp)
210 ELSE
211 ap(kk+j-1) = dble(ap(kk+j-1))
212 END IF
213 kk = kk + j
214 20 CONTINUE
215 ELSE
216 jx = kx
217 DO 40 j = 1,n
218 IF (x(jx).NE.zero) THEN
219 temp = alpha*dconjg(x(jx))
220 ix = kx
221 DO 30 k = kk,kk + j - 2
222 ap(k) = ap(k) + x(ix)*temp
223 ix = ix + incx
224 30 CONTINUE
225 ap(kk+j-1) = dble(ap(kk+j-1)) + dble(x(jx)*temp)
226 ELSE
227 ap(kk+j-1) = dble(ap(kk+j-1))
228 END IF
229 jx = jx + incx
230 kk = kk + j
231 40 CONTINUE
232 END IF
233 ELSE
234*
235* Form A when lower triangle is stored in AP.
236*
237 IF (incx.EQ.1) THEN
238 DO 60 j = 1,n
239 IF (x(j).NE.zero) THEN
240 temp = alpha*dconjg(x(j))
241 ap(kk) = dble(ap(kk)) + dble(temp*x(j))
242 k = kk + 1
243 DO 50 i = j + 1,n
244 ap(k) = ap(k) + x(i)*temp
245 k = k + 1
246 50 CONTINUE
247 ELSE
248 ap(kk) = dble(ap(kk))
249 END IF
250 kk = kk + n - j + 1
251 60 CONTINUE
252 ELSE
253 jx = kx
254 DO 80 j = 1,n
255 IF (x(jx).NE.zero) THEN
256 temp = alpha*dconjg(x(jx))
257 ap(kk) = dble(ap(kk)) + dble(temp*x(jx))
258 ix = jx
259 DO 70 k = kk + 1,kk + n - j
260 ix = ix + incx
261 ap(k) = ap(k) + x(ix)*temp
262 70 CONTINUE
263 ELSE
264 ap(kk) = dble(ap(kk))
265 END IF
266 jx = jx + incx
267 kk = kk + n - j + 1
268 80 CONTINUE
269 END IF
270 END IF
271*
272 RETURN
273*
274* End of ZHPR
275*
276 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zhpr(uplo, n, alpha, x, incx, ap)
ZHPR
Definition zhpr.f:130