133 SUBROUTINE csyequb( UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFO )
146 COMPLEX A( lda, * ), WORK( * )
154 parameter ( one = 1.0e0, zero = 0.0e0 )
156 parameter ( max_iter = 100 )
160 REAL AVG, STD, TOL, C0, C1, C2, T, U, SI, D, BASE,
161 $ smin, smax, smlnum, bignum, scale, sumsq
168 EXTERNAL lsame, slamch
174 INTRINSIC abs, aimag, int, log, max, min,
REAL, SQRT
180 cabs1( zdum ) = abs(
REAL( ZDUM ) ) + abs( AIMAG( zdum ) )
187 IF ( .NOT. ( lsame( uplo,
'U' ) .OR. lsame( uplo,
'L' ) ) )
THEN
189 ELSE IF ( n .LT. 0 )
THEN
191 ELSE IF ( lda .LT. max( 1, n ) )
THEN
194 IF ( info .NE. 0 )
THEN
195 CALL xerbla(
'CSYEQUB', -info )
199 up = lsame( uplo,
'U' )
217 s( i ) = max( s( i ), cabs1( a( i, j ) ) )
218 s( j ) = max( s( j ), cabs1( a( i, j ) ) )
219 amax = max( amax, cabs1( a( i, j ) ) )
221 s( j ) = max( s( j ), cabs1( a( j, j ) ) )
222 amax = max( amax, cabs1( a( j, j ) ) )
226 s( j ) = max( s( j ), cabs1( a( j, j ) ) )
227 amax = max( amax, cabs1( a( j, j ) ) )
229 s( i ) = max( s( i ), cabs1( a( i, j ) ) )
230 s( j ) = max( s( j ), cabs1( a( i, j ) ) )
231 amax = max( amax, cabs1( a( i, j ) ) )
236 s( j ) = 1.0 / s( j )
239 tol = one / sqrt( 2.0e0 * n )
241 DO iter = 1, max_iter
251 work( i ) = work( i ) + cabs1( a( i, j ) ) * s( j )
252 work( j ) = work( j ) + cabs1( a( i, j ) ) * s( i )
254 work( j ) = work( j ) + cabs1( a( j, j ) ) * s( j )
258 work( j ) = work( j ) + cabs1( a( j, j ) ) * s( j )
260 work( i ) = work( i ) + cabs1( a( i, j ) ) * s( j )
261 work( j ) = work( j ) + cabs1( a( i, j ) ) * s( i )
269 avg = avg + s( i )*work( i )
275 work( i ) = s( i-n ) * work( i-n ) - avg
277 CALL classq( n, work( n+1 ), 1, scale, sumsq )
278 std = scale * sqrt( sumsq / n )
280 IF ( std .LT. tol * avg )
GOTO 999
283 t = cabs1( a( i, i ) )
286 c1 = ( n-2 ) * ( work( i ) - t*si )
287 c0 = -(t*si)*si + 2*work( i )*si - n*avg
294 si = -2*c0 / ( c1 + sqrt( d ) )
300 t = cabs1( a( j, i ) )
302 work( j ) = work( j ) + d*t
305 t = cabs1( a( i, j ) )
307 work( j ) = work( j ) + d*t
311 t = cabs1( a( i, j ) )
313 work( j ) = work( j ) + d*t
316 t = cabs1( a( j, i ) )
318 work( j ) = work( j ) + d*t
322 avg = avg + ( u + work( i ) ) * d / n
329 smlnum = slamch(
'SAFEMIN' )
330 bignum = one / smlnum
333 t = one / sqrt( avg )
335 u = one / log( base )
337 s( i ) = base ** int( u * log( s( i ) * t ) )
338 smin = min( smin, s( i ) )
339 smax = max( smax, s( i ) )
341 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