131 SUBROUTINE zheequb( UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFO )
139 DOUBLE PRECISION AMAX, SCOND
143 COMPLEX*16 A( LDA, * ), WORK( * )
144 DOUBLE PRECISION S( * )
150 DOUBLE PRECISION ONE, ZERO
151 parameter( one = 1.0d0, zero = 0.0d0 )
153 parameter( max_iter = 100 )
157 DOUBLE PRECISION AVG, STD, TOL, C0, C1, C2, T, U, SI, D, BASE,
158 $ SMIN, SMAX, SMLNUM, BIGNUM, SCALE, SUMSQ
163 DOUBLE PRECISION DLAMCH
165 EXTERNAL dlamch, lsame
171 INTRINSIC abs, dble, dimag, int, log, max, min, sqrt
174 DOUBLE PRECISION CABS1
177 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
184 IF ( .NOT. ( lsame( uplo,
'U' ) .OR. lsame( uplo,
'L' ) ) )
THEN
186 ELSE IF ( n .LT. 0 )
THEN
188 ELSE IF ( lda .LT. max( 1, n ) )
THEN
191 IF ( info .NE. 0 )
THEN
192 CALL xerbla(
'ZHEEQUB', -info )
196 up = lsame( uplo,
'U' )
214 s( i ) = max( s( i ), cabs1( a( i, j ) ) )
215 s( j ) = max( s( j ), cabs1( a( i, j ) ) )
216 amax = max( amax, cabs1( a( i, j ) ) )
218 s( j ) = max( s( j ), cabs1( a( j, j ) ) )
219 amax = max( amax, cabs1( a( j, j ) ) )
223 s( j ) = max( s( j ), cabs1( a( j, j ) ) )
224 amax = max( amax, cabs1( a( j, j ) ) )
226 s( i ) = max( s( i ), cabs1( a( i, j ) ) )
227 s( j ) = max( s( j ), cabs1( a( i, j ) ) )
228 amax = max( amax, cabs1( a( i, j ) ) )
233 s( j ) = 1.0d0 / s( j )
236 tol = one / sqrt( 2.0d0 * n )
238 DO iter = 1, max_iter
248 work( i ) = work( i ) + cabs1( a( i, j ) ) * s( j )
249 work( j ) = work( j ) + cabs1( a( i, j ) ) * s( i )
251 work( j ) = work( j ) + cabs1( a( j, j ) ) * s( j )
255 work( j ) = work( j ) + cabs1( a( j, j ) ) * s( j )
257 work( i ) = work( i ) + cabs1( a( i, j ) ) * s( j )
258 work( j ) = work( j ) + cabs1( a( i, j ) ) * s( i )
266 avg = avg + dble( s( i )*work( i ) )
272 work( i ) = s( i-n ) * work( i-n ) - avg
274 CALL zlassq( n, work( n+1 ), 1, scale, sumsq )
275 std = scale * sqrt( sumsq / n )
277 IF ( std .LT. tol * avg )
GOTO 999
280 t = cabs1( a( i, i ) )
283 c1 = ( n-2 ) * ( dble( work( i ) ) - t*si )
284 c0 = -(t*si)*si + 2 * dble( work( i ) ) * si - n*avg
291 si = -2*c0 / ( c1 + sqrt( d ) )
297 t = cabs1( a( j, i ) )
299 work( j ) = work( j ) + d*t
302 t = cabs1( a( i, j ) )
304 work( j ) = work( j ) + d*t
308 t = cabs1( a( i, j ) )
310 work( j ) = work( j ) + d*t
313 t = cabs1( a( j, i ) )
315 work( j ) = work( j ) + d*t
319 avg = avg + ( u + dble( work( i ) ) ) * d / n
326 smlnum = dlamch(
'SAFEMIN' )
327 bignum = one / smlnum
330 t = one / sqrt( avg )
332 u = one / log( base )
334 s( i ) = base ** int( u * log( s( i ) * t ) )
335 smin = min( smin, s( i ) )
336 smax = max( smax, s( i ) )
338 scond = max( smin, smlnum ) / min( smax, bignum )
subroutine xerbla(srname, info)
subroutine zheequb(uplo, n, a, lda, s, scond, amax, work, info)
ZHEEQUB
subroutine zlassq(n, x, incx, scale, sumsq)
ZLASSQ updates a sum of squares represented in scaled form.