131 SUBROUTINE cheequb( UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFO )
143 COMPLEX A( LDA, * ), WORK( * )
151 parameter( one = 1.0e0, zero = 0.0e0 )
153 parameter( max_iter = 100 )
157 REAL AVG, STD, TOL, C0, C1, C2, T, U, SI, D, BASE,
158 $ SMIN, SMAX, SMLNUM, BIGNUM, SCALE, SUMSQ
165 EXTERNAL lsame, slamch
171 INTRINSIC abs, aimag, int, log, max, min, real, sqrt
177 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( 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(
'CHEEQUB', -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.0e0 / s( j )
236 tol = one / sqrt( 2.0e0 * 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 + real( s( i )*work( i ) )
272 work( i ) = s( i-n ) * work( i-n ) - avg
274 CALL classq( 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 = real( ( n-2 ) * ( work( i ) - t*si ) )
284 c0 = real( -(t*si)*si + 2*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 + real( ( u + work( i ) ) * d / n )
326 smlnum = slamch(
'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 cheequb(uplo, n, a, lda, s, scond, amax, work, info)
CHEEQUB
subroutine classq(n, x, incx, scale, sumsq)
CLASSQ updates a sum of squares represented in scaled form.