137 SUBROUTINE zsyequb( UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFO )
146 DOUBLE PRECISION AMAX, SCOND
150 COMPLEX*16 A( lda, * ), WORK( * )
151 DOUBLE PRECISION S( * )
157 DOUBLE PRECISION ONE, ZERO
158 parameter ( one = 1.0d0, zero = 0.0d0 )
160 parameter ( max_iter = 100 )
164 DOUBLE PRECISION AVG, STD, TOL, C0, C1, C2, T, U, SI, D, BASE,
165 $ smin, smax, smlnum, bignum, scale, sumsq
170 DOUBLE PRECISION DLAMCH
172 EXTERNAL dlamch, lsame
178 INTRINSIC abs, dble, dimag, int, log, max, min, sqrt
181 DOUBLE PRECISION CABS1
184 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
191 IF ( .NOT. ( lsame( uplo,
'U' ) .OR. lsame( uplo,
'L' ) ) )
THEN
193 ELSE IF ( n .LT. 0 )
THEN
195 ELSE IF ( lda .LT. max( 1, n ) )
THEN
198 IF ( info .NE. 0 )
THEN
199 CALL xerbla(
'ZSYEQUB', -info )
203 up = lsame( uplo,
'U' )
221 s( i ) = max( s( i ), cabs1( a( i, j ) ) )
222 s( j ) = max( s( j ), cabs1( a( i, j ) ) )
223 amax = max( amax, cabs1( a( i, j ) ) )
225 s( j ) = max( s( j ), cabs1( a( j, j) ) )
226 amax = max( amax, cabs1( a( j, j ) ) )
230 s( j ) = max( s( j ), cabs1( a( j, j ) ) )
231 amax = max( amax, cabs1( a( j, j ) ) )
233 s( i ) = max( s( i ), cabs1( a( i, j ) ) )
234 s( j ) = max( s( j ), cabs1(a( i, j ) ) )
235 amax = max( amax, cabs1( a( i, j ) ) )
240 s( j ) = 1.0d+0 / s( j )
243 tol = one / sqrt( 2.0d0 * n )
245 DO iter = 1, max_iter
255 t = cabs1( a( i, j ) )
256 work( i ) = work( i ) + cabs1( a( i, j ) ) * s( j )
257 work( j ) = work( j ) + cabs1( a( i, j ) ) * s( i )
259 work( j ) = work( j ) + cabs1( a( j, j ) ) * s( j )
263 work( j ) = work( j ) + cabs1( a( j, j ) ) * s( j )
265 t = cabs1( a( i, j ) )
266 work( i ) = work( i ) + cabs1( a( i, j ) ) * s( j )
267 work( j ) = work( j ) + cabs1( a( i, j ) ) * s( i )
275 avg = avg + s( i )*work( i )
281 work( i ) = s( i-n ) * work( i-n ) - avg
283 CALL zlassq( n, work( n+1 ), 1, scale, sumsq )
284 std = scale * sqrt( sumsq / n )
286 IF ( std .LT. tol * avg )
GOTO 999
289 t = cabs1( a( i, i ) )
292 c1 = ( n-2 ) * ( work( i ) - t*si )
293 c0 = -(t*si)*si + 2*work( i )*si - n*avg
300 si = -2*c0 / ( c1 + sqrt( d ) )
306 t = cabs1( a( j, i ) )
308 work( j ) = work( j ) + d*t
311 t = cabs1( a( i, j ) )
313 work( j ) = work( j ) + d*t
317 t = cabs1( a( i, j ) )
319 work( j ) = work( j ) + d*t
322 t = cabs1( a( j, i ) )
324 work( j ) = work( j ) + d*t
327 avg = avg + ( u + work( i ) ) * d / n
334 smlnum = dlamch(
'SAFEMIN' )
335 bignum = one / smlnum
338 t = one / sqrt( avg )
340 u = one / log( base )
342 s( i ) = base ** int( u * log( s( i ) * t ) )
343 smin = min( smin, s( i ) )
344 smax = max( smax, s( i ) )
346 scond = max( smin, smlnum ) / min( smax, bignum )
subroutine zsyequb(UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFO)
ZSYEQUB
subroutine xerbla(SRNAME, INFO)
XERBLA
subroutine zlassq(N, X, INCX, SCALE, SUMSQ)
ZLASSQ updates a sum of squares represented in scaled form.