136 SUBROUTINE dsyequb( UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFO )
145 DOUBLE PRECISION AMAX, SCOND
149 DOUBLE PRECISION A( lda, * ), S( * ), WORK( * )
155 DOUBLE PRECISION ONE, ZERO
156 parameter ( one = 1.0d+0, zero = 0.0d+0 )
158 parameter ( max_iter = 100 )
162 DOUBLE PRECISION AVG, STD, TOL, C0, C1, C2, T, U, SI, D, BASE,
163 $ smin, smax, smlnum, bignum, scale, sumsq
167 DOUBLE PRECISION DLAMCH
169 EXTERNAL dlamch, lsame
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(
'DSYEQUB', -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.0d+0 / s( j )
234 tol = one / sqrt(2.0d0 * 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 dlassq( 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 = dlamch(
'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 )
subroutine xerbla(SRNAME, INFO)
XERBLA
subroutine dsyequb(UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFO)
DSYEQUB
subroutine dlassq(N, X, INCX, SCALE, SUMSQ)
DLASSQ updates a sum of squares represented in scaled form.