100 SUBROUTINE dlagsy( N, K, D, A, LDA, ISEED, WORK, INFO )
107 INTEGER INFO, K, LDA, N
111 DOUBLE PRECISION A( LDA, * ), D( * ), WORK( * )
117 DOUBLE PRECISION ZERO, ONE, HALF
118 parameter( zero = 0.0d+0, one = 1.0d+0, half = 0.5d+0 )
122 DOUBLE PRECISION ALPHA, TAU, WA, WB, WN
129 DOUBLE PRECISION DDOT, DNRM2
142 ELSE IF( k.LT.0 .OR. k.GT.n-1 )
THEN
144 ELSE IF( lda.LT.max( 1, n ) )
THEN
148 CALL xerbla(
'DLAGSY', -info )
165 DO 40 i = n - 1, 1, -1
169 CALL dlarnv( 3, iseed, n-i+1, work )
170 wn = dnrm2( n-i+1, work, 1 )
171 wa = sign( wn, work( 1 ) )
172 IF( wn.EQ.zero )
THEN
176 CALL dscal( n-i, one / wb, work( 2 ), 1 )
186 CALL dsymv(
'Lower', n-i+1, tau, a( i, i ), lda, work, 1, zero,
191 alpha = -half*tau*ddot( n-i+1, work( n+1 ), 1, work, 1 )
192 CALL daxpy( n-i+1, alpha, work, 1, work( n+1 ), 1 )
196 CALL dsyr2(
'Lower', n-i+1, -one, work, 1, work( n+1 ), 1,
202 DO 60 i = 1, n - 1 - k
206 wn = dnrm2( n-k-i+1, a( k+i, i ), 1 )
207 wa = sign( wn, a( k+i, i ) )
208 IF( wn.EQ.zero )
THEN
211 wb = a( k+i, i ) + wa
212 CALL dscal( n-k-i, one / wb, a( k+i+1, i ), 1 )
219 CALL dgemv(
'Transpose', n-k-i+1, k-1, one, a( k+i, i+1 ), lda,
220 $ a( k+i, i ), 1, zero, work, 1 )
221 CALL dger( n-k-i+1, k-1, -tau, a( k+i, i ), 1, work, 1,
222 $ a( k+i, i+1 ), lda )
228 CALL dsymv(
'Lower', n-k-i+1, tau, a( k+i, k+i ), lda,
229 $ a( k+i, i ), 1, zero, work, 1 )
233 alpha = -half*tau*ddot( n-k-i+1, work, 1, a( k+i, i ), 1 )
234 CALL daxpy( n-k-i+1, alpha, a( k+i, i ), 1, work, 1 )
238 CALL dsyr2(
'Lower', n-k-i+1, -one, a( k+i, i ), 1, work, 1,
239 $ a( k+i, k+i ), lda )
242 DO 50 j = k + i + 1, n
251 a( j, i ) = a( i, j )