161 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 )
188 INTEGER I, ICA, IEXC, IRA, J, K, L, M
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 )
226 IF( lsame( job,
'N' ) )
THEN
233 IF( lsame( job,
'S' ) )
247 CALL dswap( l, a( 1, j ), 1, a( 1, m ), 1 )
248 CALL dswap( n-k+1, a( j, k ), lda, a( m, k ), lda )
266 IF( a( j, i ).NE.zero )
288 IF( a( i, j ).NE.zero )
302 IF( lsame( job,
'P' ) )
309 sfmin1 = dlamch(
'S' ) / dlamch(
'P' )
310 sfmax1 = one / sfmin1
311 sfmin2 = sfmin1*sclfac
312 sfmax2 = one / sfmin2
319 c = dnrm2( l-k+1, a( k, i ), 1 )
320 r = dnrm2( l-k+1, a( i, k ), lda )
321 ica = idamax( l, a( 1, i ), 1 )
322 ca = abs( a( ica, i ) )
323 ira = idamax( n-k+1, a( i, k ), lda )
324 ra = abs( a( i, ira+k-1 ) )
328 IF( c.EQ.zero .OR. r.EQ.zero )
334 IF( c.GE.g .OR. max( f, c, ca ).GE.sfmax2 .OR.
335 $ min( r, g, ra ).LE.sfmin2 )
GO TO 170
336 IF( disnan( c+f+ca+r+g+ra ) )
THEN
341 CALL xerbla(
'DGEBAL', -info )
355 IF( g.LT.r .OR. max( r, ra ).GE.sfmax2 .OR.
356 $ min( f, c, g, ca ).LE.sfmin2 )
GO TO 190
368 IF( ( c+r ).GE.factor*s )
370 IF( f.LT.one .AND. scale( i ).LT.one )
THEN
371 IF( f*scale( i ).LE.sfmin1 )
374 IF( f.GT.one .AND. scale( i ).GT.one )
THEN
375 IF( scale( i ).GE.sfmax1 / f )
379 scale( i ) = scale( i )*f
382 CALL dscal( n-k+1, g, a( i, k ), lda )
383 CALL dscal( l, f, a( 1, i ), 1 )
subroutine xerbla(SRNAME, INFO)
XERBLA
subroutine dswap(N, DX, INCX, DY, INCY)
DSWAP
subroutine dgebal(JOB, N, A, LDA, ILO, IHI, SCALE, INFO)
DGEBAL
subroutine dscal(N, DA, DX, INCX)
DSCAL