128 SUBROUTINE dsyequb( UPLO, N, A, LDA, S, SCOND, AMAX, WORK,
137 DOUBLE PRECISION AMAX, SCOND
141 DOUBLE PRECISION A( LDA, * ), S( * ), WORK( * )
147 DOUBLE PRECISION ONE, ZERO
148 parameter( one = 1.0d0, zero = 0.0d0 )
150 parameter( max_iter = 100 )
154 DOUBLE PRECISION AVG, STD, TOL, C0, C1, C2, T, U, SI, D, BASE,
155 $ smin, smax, smlnum, bignum, scale, sumsq
159 DOUBLE PRECISION DLAMCH
161 EXTERNAL dlamch, lsame
167 INTRINSIC abs, int, log, max, min, sqrt
174 IF ( .NOT. ( lsame( uplo,
'U' ) .OR.
175 $ lsame( uplo,
'L' ) ) )
THEN
177 ELSE IF ( n .LT. 0 )
THEN
179 ELSE IF ( lda .LT. max( 1, n ) )
THEN
182 IF ( info .NE. 0 )
THEN
183 CALL xerbla(
'DSYEQUB', -info )
187 up = lsame( uplo,
'U' )
205 s( i ) = max( s( i ), abs( a( i, j ) ) )
206 s( j ) = max( s( j ), abs( a( i, j ) ) )
207 amax = max( amax, abs( a( i, j ) ) )
209 s( j ) = max( s( j ), abs( a( j, j ) ) )
210 amax = max( amax, abs( a( j, j ) ) )
214 s( j ) = max( s( j ), abs( a( j, j ) ) )
215 amax = max( amax, abs( a( j, j ) ) )
217 s( i ) = max( s( i ), abs( a( i, j ) ) )
218 s( j ) = max( s( j ), abs( a( i, j ) ) )
219 amax = max( amax, abs( a( i, j ) ) )
224 s( j ) = 1.0d0 / s( j )
227 tol = one / sqrt( 2.0d0 * n )
229 DO iter = 1, max_iter
239 work( i ) = work( i ) + abs( a( i, j ) ) * s( j )
240 work( j ) = work( j ) + abs( a( i, j ) ) * s( i )
242 work( j ) = work( j ) + abs( a( j, j ) ) * s( j )
246 work( j ) = work( j ) + abs( a( j, j ) ) * s( j )
248 work( i ) = work( i ) + abs( a( i, j ) ) * s( j )
249 work( j ) = work( j ) + abs( a( i, j ) ) * s( i )
257 avg = avg + s( i )*work( i )
263 work( i ) = s( i-n ) * work( i-n ) - avg
265 CALL dlassq( n, work( n+1 ), 1, scale, sumsq )
266 std = scale * sqrt( sumsq / n )
268 IF ( std .LT. tol * avg )
GOTO 999
274 c1 = ( n-2 ) * ( work( i ) - t*si )
275 c0 = -(t*si)*si + 2*work( i )*si - n*avg
282 si = -2*c0 / ( c1 + sqrt( d ) )
290 work( j ) = work( j ) + d*t
295 work( j ) = work( j ) + d*t
301 work( j ) = work( j ) + d*t
306 work( j ) = work( j ) + d*t
310 avg = avg + ( u + work( i ) ) * d / n
317 smlnum = dlamch(
'SAFEMIN' )
318 bignum = one / smlnum
321 t = one / sqrt( avg )
323 u = one / log( base )
325 s( i ) = base ** int( u * log( s( i ) * t ) )
326 smin = min( smin, s( i ) )
327 smax = max( smax, s( i ) )
329 scond = max( smin, smlnum ) / min( smax, bignum )