101 SUBROUTINE zlaghe( N, K, D, A, LDA, ISEED, WORK, INFO )
108 INTEGER INFO, K, LDA, N
112 DOUBLE PRECISION D( * )
113 COMPLEX*16 A( LDA, * ), WORK( * )
119 COMPLEX*16 ZERO, ONE, HALF
120 parameter( zero = ( 0.0d+0, 0.0d+0 ),
121 $ one = ( 1.0d+0, 0.0d+0 ),
122 $ half = ( 0.5d+0, 0.0d+0 ) )
127 COMPLEX*16 ALPHA, TAU, WA, WB
134 DOUBLE PRECISION DZNRM2
136 EXTERNAL dznrm2, zdotc
139 INTRINSIC abs, dble, dconjg, max
148 ELSE IF( k.LT.0 .OR. k.GT.n-1 )
THEN
150 ELSE IF( lda.LT.max( 1, n ) )
THEN
154 CALL xerbla(
'ZLAGHE', -info )
171 DO 40 i = n - 1, 1, -1
175 CALL zlarnv( 3, iseed, n-i+1, work )
176 wn = dznrm2( n-i+1, work, 1 )
177 wa = ( wn / abs( work( 1 ) ) )*work( 1 )
178 IF( wn.EQ.zero )
THEN
182 CALL zscal( n-i, one / wb, work( 2 ), 1 )
184 tau = dble( wb / wa )
192 CALL zhemv(
'Lower', n-i+1, tau, a( i, i ), lda, work, 1, zero,
197 alpha = -half*tau*zdotc( n-i+1, work( n+1 ), 1, work, 1 )
198 CALL zaxpy( n-i+1, alpha, work, 1, work( n+1 ), 1 )
202 CALL zher2(
'Lower', n-i+1, -one, work, 1, work( n+1 ), 1,
208 DO 60 i = 1, n - 1 - k
212 wn = dznrm2( n-k-i+1, a( k+i, i ), 1 )
213 wa = ( wn / abs( a( k+i, i ) ) )*a( k+i, i )
214 IF( wn.EQ.zero )
THEN
217 wb = a( k+i, i ) + wa
218 CALL zscal( n-k-i, one / wb, a( k+i+1, i ), 1 )
220 tau = dble( wb / wa )
225 CALL zgemv(
'Conjugate transpose', n-k-i+1, k-1, one,
226 $ a( k+i, i+1 ), lda, a( k+i, i ), 1, zero, work, 1 )
227 CALL zgerc( n-k-i+1, k-1, -tau, a( k+i, i ), 1, work, 1,
228 $ a( k+i, i+1 ), lda )
234 CALL zhemv(
'Lower', n-k-i+1, tau, a( k+i, k+i ), lda,
235 $ a( k+i, i ), 1, zero, work, 1 )
239 alpha = -half*tau*zdotc( n-k-i+1, work, 1, a( k+i, i ), 1 )
240 CALL zaxpy( n-k-i+1, alpha, a( k+i, i ), 1, work, 1 )
244 CALL zher2(
'Lower', n-k-i+1, -one, a( k+i, i ), 1, work, 1,
245 $ a( k+i, k+i ), lda )
248 DO 50 j = k + i + 1, n
257 a( j, i ) = dconjg( a( i, j ) )
subroutine xerbla(srname, info)
subroutine zaxpy(n, za, zx, incx, zy, incy)
ZAXPY
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
subroutine zgerc(m, n, alpha, x, incx, y, incy, a, lda)
ZGERC
subroutine zhemv(uplo, n, alpha, a, lda, x, incx, beta, y, incy)
ZHEMV
subroutine zher2(uplo, n, alpha, x, incx, y, incy, a, lda)
ZHER2
subroutine zlarnv(idist, iseed, n, x)
ZLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine zscal(n, za, zx, incx)
ZSCAL
subroutine zlaghe(n, k, d, a, lda, iseed, work, info)
ZLAGHE