136 SUBROUTINE ssyequb( UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFO )
149 REAL a( lda, * ), s( * ), work( * )
156 parameter( one = 1.0e+0, zero = 0.0e+0 )
158 parameter( max_iter = 100 )
162 REAL avg, std, tol, c0, c1, c2, t, u, si, d, base,
163 $ smin, smax, smlnum, bignum, scale, sumsq
175 INTRINSIC abs, int, log, max, min, sqrt
182 IF ( .NOT. (
lsame( uplo,
'U' ) .OR.
lsame( uplo,
'L' ) ) )
THEN
184 ELSE IF ( n .LT. 0 )
THEN
186 ELSE IF ( lda .LT. max( 1, n ) )
THEN
189 IF ( info .NE. 0 )
THEN
190 CALL
xerbla(
'SSYEQUB', -info )
194 up =
lsame( uplo,
'U' )
212 s( i ) = max( s( i ), abs( a( i, j ) ) )
213 s( j ) = max( s( j ), abs( a( i, j ) ) )
214 amax = max( amax, abs( a(i, j) ) )
216 s( j ) = max( s( j ), abs( a( j, j ) ) )
217 amax = max( amax, abs( a( j, j ) ) )
221 s( j ) = max( s( j ), abs( a( j, j ) ) )
222 amax = max( amax, abs( a( j, j ) ) )
224 s( i ) = max( s( i ), abs( a( i, j ) ) )
225 s( j ) = max( s( j ), abs( a( i, j ) ) )
226 amax = max( amax, abs( a( i, j ) ) )
231 s( j ) = 1.0 / s( j )
234 tol = one / sqrt(2.0e0 * n)
236 DO iter = 1, max_iter
247 work( i ) = work( i ) + abs( a( i, j ) ) * s( j )
248 work( j ) = work( j ) + abs( a( i, j ) ) * s( i )
250 work( j ) = work( j ) + abs( a( j, j ) ) * s( j )
254 work( j ) = work( j ) + abs( a( j, j ) ) * s( j )
257 work( i ) = work( i ) + abs( a( i, j ) ) * s( j )
258 work( j ) = work( j ) + abs( a( i, j ) ) * s( i )
266 avg = avg + s( i )*work( i )
272 work( i ) = s( i-2*n ) * work( i-2*n ) - avg
274 CALL
slassq( n, work( 2*n+1 ), 1, scale, sumsq )
275 std = scale * sqrt( sumsq / n )
277 IF ( std .LT. tol * avg ) goto 999
283 c1 = ( n-2 ) * ( work( i ) - t*si )
284 c0 = -(t*si)*si + 2*work( i )*si - n*avg
291 si = -2*c0 / ( c1 + sqrt( d ) )
299 work( j ) = work( j ) + d*t
304 work( j ) = work( j ) + d*t
310 work( j ) = work( j ) + d*t
315 work( j ) = work( j ) + d*t
319 avg = avg + ( u + work( i ) ) * d / n
328 smlnum =
slamch(
'SAFEMIN' )
329 bignum = one / smlnum
334 u = one / log( base )
336 s( i ) = base ** int( u * log( s( i ) * t ) )
337 smin = min( smin, s( i ) )
338 smax = max( smax, s( i ) )
340 scond = max( smin, smlnum ) / min( smax, bignum )