162 SUBROUTINE dgebal( JOB, N, A, LDA, ILO, IHI, SCALE, INFO )
170 INTEGER IHI, ILO, INFO, LDA, N
173 DOUBLE PRECISION A( LDA, * ), SCALE( * )
179 DOUBLE PRECISION ZERO, ONE
180 parameter( zero = 0.0d+0, one = 1.0d+0 )
181 DOUBLE PRECISION SCLFAC
182 parameter( sclfac = 2.0d+0 )
183 DOUBLE PRECISION FACTOR
184 parameter( factor = 0.95d+0 )
187 LOGICAL NOCONV, CANSWAP
188 INTEGER I, ICA, IRA, J, K, L
189 DOUBLE PRECISION C, CA, F, G, R, RA, S, SFMAX1, SFMAX2, SFMIN1,
193 LOGICAL DISNAN, LSAME
195 DOUBLE PRECISION DLAMCH, DNRM2
196 EXTERNAL disnan, lsame, idamax, dlamch, dnrm2
202 INTRINSIC abs, max, min
207 IF( .NOT.lsame( job,
'N' ) .AND. .NOT.lsame( job,
'P' ) .AND.
208 $ .NOT.lsame( job,
'S' ) .AND. .NOT.lsame( job,
'B' ) )
THEN
210 ELSE IF( n.LT.0 )
THEN
212 ELSE IF( lda.LT.max( 1, n ) )
THEN
216 CALL xerbla(
'DGEBAL', -info )
228 IF( lsame( job,
'N' ) )
THEN
242 IF( .NOT.lsame( job,
'S' ) )
THEN
255 IF( i.NE.j .AND. a( i, j ).NE.zero )
THEN
264 CALL dswap( l, a( 1, i ), 1, a( 1, l ), 1 )
265 CALL dswap( n-k+1, a( i, k ), lda, a( l, k ), lda )
290 IF( i.NE.j .AND. a( i, j ).NE.zero )
THEN
299 CALL dswap( l, a( 1, j ), 1, a( 1, k ), 1 )
300 CALL dswap( n-k+1, a( j, k ), lda, a( k, k ), lda )
320 IF( lsame( job,
'P' ) )
THEN
330 sfmin1 = dlamch(
'S' ) / dlamch(
'P' )
331 sfmax1 = one / sfmin1
332 sfmin2 = sfmin1*sclfac
333 sfmax2 = one / sfmin2
341 c = dnrm2( l-k+1, a( k, i ), 1 )
342 r = dnrm2( l-k+1, a( i, k ), lda )
343 ica = idamax( l, a( 1, i ), 1 )
344 ca = abs( a( ica, i ) )
345 ira = idamax( n-k+1, a( i, k ), lda )
346 ra = abs( a( i, ira+k-1 ) )
350 IF( c.EQ.zero .OR. r.EQ.zero ) cycle
354 IF( disnan( c+ca+r+ra ) )
THEN
356 CALL xerbla(
'DGEBAL', -info )
364 DO WHILE( c.LT.g .AND. max( f, c, ca ).LT.sfmax2 .AND.
365 $ min( r, g, ra ).GT.sfmin2 )
376 DO WHILE( g.GE.r .AND. max( r, ra ).LT.sfmax2 .AND.
377 $ min( f, c, g, ca ).GT.sfmin2 )
388 IF( ( c+r ).GE.factor*s ) cycle
389 IF( f.LT.one .AND. scale( i ).LT.one )
THEN
390 IF( f*scale( i ).LE.sfmin1 ) cycle
392 IF( f.GT.one .AND. scale( i ).GT.one )
THEN
393 IF( scale( i ).GE.sfmax1 / f ) cycle
396 scale( i ) = scale( i )*f
399 CALL dscal( n-k+1, g, a( i, k ), lda )
400 CALL dscal( l, f, a( 1, i ), 1 )
subroutine xerbla(srname, info)
subroutine dgebal(job, n, a, lda, ilo, ihi, scale, info)
DGEBAL
subroutine dscal(n, da, dx, incx)
DSCAL
subroutine dswap(n, dx, incx, dy, incy)
DSWAP