3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE ZHER(UPLO,N,ALPHA,X,INCX,A,LDA)
13 * .. Scalar Arguments ..
14 * DOUBLE PRECISION ALPHA
18 * .. Array Arguments ..
19 * COMPLEX*16 A(LDA,*),X(*)
28 *> ZHER performs the hermitian rank 1 operation
30 *> A := alpha*x*x**H + A,
32 *> where alpha is a real scalar, x is an n element vector and A is an
33 *> n by n hermitian matrix.
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
46 *> UPLO = 'U' or 'u' Only the upper triangular part of A
47 *> is to be referenced.
49 *> UPLO = 'L' or 'l' Only the lower triangular part of A
50 *> is to be referenced.
56 *> On entry, N specifies the order of the matrix A.
57 *> N must be at least zero.
62 *> ALPHA is DOUBLE PRECISION.
63 *> On entry, ALPHA specifies the scalar alpha.
68 *> X is COMPLEX*16 array of dimension at least
69 *> ( 1 + ( n - 1 )*abs( INCX ) ).
70 *> Before entry, the incremented array X must contain the n
77 *> On entry, INCX specifies the increment for the elements of
78 *> X. INCX must not be zero.
83 *> A is COMPLEX*16 array of DIMENSION ( LDA, n ).
84 *> Before entry with UPLO = 'U' or 'u', the leading n by n
85 *> upper triangular part of the array A must contain the upper
86 *> triangular part of the hermitian matrix and the strictly
87 *> lower triangular part of A is not referenced. On exit, the
88 *> upper triangular part of the array A is overwritten by the
89 *> upper triangular part of the updated matrix.
90 *> Before entry with UPLO = 'L' or 'l', the leading n by n
91 *> lower triangular part of the array A must contain the lower
92 *> triangular part of the hermitian matrix and the strictly
93 *> upper triangular part of A is not referenced. On exit, the
94 *> lower triangular part of the array A is overwritten by the
95 *> lower triangular part of the updated matrix.
96 *> Note that the imaginary parts of the diagonal elements need
97 *> not be set, they are assumed to be zero, and on exit they
104 *> On entry, LDA specifies the first dimension of A as declared
105 *> in the calling (sub) program. LDA must be at least
112 *> \author Univ. of Tennessee
113 *> \author Univ. of California Berkeley
114 *> \author Univ. of Colorado Denver
117 *> \date November 2011
119 *> \ingroup complex16_blas_level2
121 *> \par Further Details:
122 * =====================
126 *> Level 2 Blas routine.
128 *> -- Written on 22-October-1986.
129 *> Jack Dongarra, Argonne National Lab.
130 *> Jeremy Du Croz, Nag Central Office.
131 *> Sven Hammarling, Nag Central Office.
132 *> Richard Hanson, Sandia National Labs.
135 * =====================================================================
136 SUBROUTINE ZHER(UPLO,N,ALPHA,X,INCX,A,LDA)
138 * -- Reference BLAS level2 routine (version 3.4.0) --
139 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
140 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
143 * .. Scalar Arguments ..
144 DOUBLE PRECISION ALPHA
148 * .. Array Arguments ..
149 COMPLEX*16 A(LDA,*),X(*)
152 * =====================================================================
156 PARAMETER (ZERO= (0.0D+0,0.0D+0))
158 * .. Local Scalars ..
160 INTEGER I,INFO,IX,J,JX,KX
162 * .. External Functions ..
166 * .. External Subroutines ..
169 * .. Intrinsic Functions ..
170 INTRINSIC DBLE,DCONJG,MAX
173 * Test the input parameters.
176 IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
178 ELSE IF (N.LT.0) THEN
180 ELSE IF (INCX.EQ.0) THEN
182 ELSE IF (LDA.LT.MAX(1,N)) THEN
186 CALL XERBLA('ZHER ',INFO)
190 * Quick return if possible.
192 IF ((N.EQ.0) .OR. (ALPHA.EQ.DBLE(ZERO))) RETURN
194 * Set the start point in X if the increment is not unity.
198 ELSE IF (INCX.NE.1) THEN
202 * Start the operations. In this version the elements of A are
203 * accessed sequentially with one pass through the triangular part
206 IF (LSAME(UPLO,'U')) THEN
208 * Form A when A is stored in upper triangle.
212 IF (X(J).NE.ZERO) THEN
213 TEMP = ALPHA*DCONJG(X(J))
215 A(I,J) = A(I,J) + X(I)*TEMP
217 A(J,J) = DBLE(A(J,J)) + DBLE(X(J)*TEMP)
219 A(J,J) = DBLE(A(J,J))
225 IF (X(JX).NE.ZERO) THEN
226 TEMP = ALPHA*DCONJG(X(JX))
229 A(I,J) = A(I,J) + X(IX)*TEMP
232 A(J,J) = DBLE(A(J,J)) + DBLE(X(JX)*TEMP)
234 A(J,J) = DBLE(A(J,J))
241 * Form A when A is stored in lower triangle.
245 IF (X(J).NE.ZERO) THEN
246 TEMP = ALPHA*DCONJG(X(J))
247 A(J,J) = DBLE(A(J,J)) + DBLE(TEMP*X(J))
249 A(I,J) = A(I,J) + X(I)*TEMP
252 A(J,J) = DBLE(A(J,J))
258 IF (X(JX).NE.ZERO) THEN
259 TEMP = ALPHA*DCONJG(X(JX))
260 A(J,J) = DBLE(A(J,J)) + DBLE(TEMP*X(JX))
264 A(I,J) = A(I,J) + X(IX)*TEMP
267 A(J,J) = DBLE(A(J,J))