1 SUBROUTINE zlagsy( N, K, D, A, LDA, ISEED, WORK, INFO )
8 INTEGER INFO, K, LDA, N
12 DOUBLE PRECISION D( * )
13 COMPLEX*16 A( LDA, * ), WORK( * )
59 COMPLEX*16 ZERO, ONE, HALF
60 parameter( zero = ( 0.0d+0, 0.0d+0 ),
61 $ one = ( 1.0d+0, 0.0d+0 ),
62 $ half = ( 0.5d+0, 0.0d+0 ) )
67 COMPLEX*16 ALPHA, TAU, WA, WB
70 EXTERNAL xerbla, zaxpy, zgemv, zgerc, zlacgv,
zlarnv,
74 DOUBLE PRECISION DZNRM2
76 EXTERNAL dznrm2, zdotc
79 INTRINSIC abs, dble,
max
88 ELSE IF( k.LT.0 .OR. k.GT.n-1 )
THEN
90 ELSE IF( lda.LT.
max( 1, n ) )
THEN
94 CALL xerbla(
'ZLAGSY', -info )
111 DO 60 i = n - 1, 1, -1
115 CALL zlarnv( 3, iseed, n-i+1, work )
116 wn = dznrm2( n-i+1, work, 1 )
117 wa = ( wn / abs( work( 1 ) ) )*work( 1 )
118 IF( wn.EQ.zero )
THEN
122 CALL zscal( n-i, one / wb, work( 2 ), 1 )
124 tau = dble( wb / wa )
132 CALL zlacgv( n-i+1, work, 1 )
133 CALL zsymv(
'Lower', n-i+1, tau, a( i, i ), lda, work, 1, zero,
135 CALL zlacgv( n-i+1, work, 1 )
139 alpha = -half*tau*zdotc( n-i+1, work, 1, work( n+1 ), 1 )
140 CALL zaxpy( n-i+1, alpha, work, 1, work( n+1 ), 1 )
149 a( ii, jj ) = a( ii, jj ) -
150 $ work( ii-i+1 )*work( n+jj-i+1 ) -
151 $ work( n+ii-i+1 )*work( jj-i+1 )
158 DO 100 i = 1, n - 1 - k
162 wn = dznrm2( n-k-i+1, a( k+i, i ), 1 )
163 wa = ( wn / abs( a( k+i, i ) ) )*a( k+i, i )
164 IF( wn.EQ.zero )
THEN
167 wb = a( k+i, i ) + wa
168 CALL zscal( n-k-i, one / wb, a( k+i+1, i ), 1 )
170 tau = dble( wb / wa )
175 CALL zgemv(
'Conjugate transpose', n-k-i+1, k-1, one,
176 $ a( k+i, i+1 ), lda, a( k+i, i ), 1, zero, work, 1 )
177 CALL zgerc( n-k-i+1, k-1, -tau, a( k+i, i ), 1, work, 1,
178 $ a( k+i, i+1 ), lda )
184 CALL zlacgv( n-k-i+1, a( k+i, i ), 1 )
185 CALL zsymv(
'Lower', n-k-i+1, tau, a( k+i, k+i ), lda,
186 $ a( k+i, i ), 1, zero, work, 1 )
187 CALL zlacgv( n-k-i+1, a( k+i, i ), 1 )
191 alpha = -half*tau*zdotc( n-k-i+1, a( k+i, i ), 1, work, 1 )
192 CALL zaxpy( n-k-i+1, alpha, a( k+i, i ), 1, work, 1 )
201 a( ii, jj ) = a( ii, jj ) - a( ii, i )*work( jj-k-i+1 ) -
202 $ work( ii-k-i+1 )*a( jj, i )
207 DO 90 j = k + i + 1, n
216 a( j, i ) = a( i, j )