137 SUBROUTINE csyequb( UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFO )
150 COMPLEX A( lda, * ), WORK( * )
158 parameter ( one = 1.0e0, zero = 0.0e0 )
160 parameter ( max_iter = 100 )
164 REAL AVG, STD, TOL, C0, C1, C2, T, U, SI, D, BASE,
165 $ smin, smax, smlnum, bignum, scale, sumsq
172 EXTERNAL lsame, slamch
178 INTRINSIC abs, aimag, int, log, max, min,
REAL, SQRT
184 cabs1( zdum ) = abs(
REAL( ZDUM ) ) + abs( AIMAG( 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(
'CSYEQUB', -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.0 / s( j )
243 tol = one / sqrt( 2.0e0 * 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 classq( 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 = slamch(
'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 classq(N, X, INCX, SCALE, SUMSQ)
CLASSQ updates a sum of squares represented in scaled form.
subroutine csyequb(UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFO)
CSYEQUB
subroutine xerbla(SRNAME, INFO)
XERBLA