161 SUBROUTINE sgebal( JOB, N, A, LDA, ILO, IHI, SCALE, INFO )
170 INTEGER ihi, ilo, info, lda, n
173 REAL a( lda, * ), scale( * )
180 parameter( zero = 0.0e+0, one = 1.0e+0 )
182 parameter( sclfac = 2.0e+0 )
184 parameter( factor = 0.95e+0 )
188 INTEGER i, ica, iexc, ira, j, k, l, m
189 REAL c, ca, f, g, r, ra, s, sfmax1, sfmax2, sfmin1,
202 INTRINSIC abs, max, min
209 IF( .NOT.
lsame( job,
'N' ) .AND. .NOT.
lsame( job,
'P' ) .AND.
210 $ .NOT.
lsame( job,
'S' ) .AND. .NOT.
lsame( job,
'B' ) )
THEN
212 ELSE IF( n.LT.0 )
THEN
214 ELSE IF( lda.LT.max( 1, n ) )
THEN
218 CALL
xerbla(
'SGEBAL', -info )
228 IF(
lsame( job,
'N' ) )
THEN
235 IF(
lsame( job,
'S' ) )
249 CALL
sswap( l, a( 1, j ), 1, a( 1, m ), 1 )
250 CALL
sswap( n-k+1, a( j, k ), lda, a( m, k ), lda )
268 IF( a( j, i ).NE.zero )
290 IF( a( i, j ).NE.zero )
304 IF(
lsame( job,
'P' ) )
312 sfmax1 = one / sfmin1
313 sfmin2 = sfmin1*sclfac
314 sfmax2 = one / sfmin2
325 c = c + abs( a( j, i ) )
326 r = r + abs( a( i, j ) )
328 ica =
isamax( l, a( 1, i ), 1 )
329 ca = abs( a( ica, i ) )
330 ira =
isamax( n-k+1, a( i, k ), lda )
331 ra = abs( a( i, ira+k-1 ) )
335 IF( c.EQ.zero .OR. r.EQ.zero )
341 IF( c.GE.g .OR. max( f, c, ca ).GE.sfmax2 .OR.
342 $ min( r, g, ra ).LE.sfmin2 )go to 170
354 IF( g.LT.r .OR. max( r, ra ).GE.sfmax2 .OR.
355 $ min( f, c, g, ca ).LE.sfmin2 )go to 190
356 IF(
sisnan( c+f+ca+r+g+ra ) )
THEN
361 CALL
xerbla(
'SGEBAL', -info )
375 IF( ( c+r ).GE.factor*s )
377 IF( f.LT.one .AND. scale( i ).LT.one )
THEN
378 IF( f*scale( i ).LE.sfmin1 )
381 IF( f.GT.one .AND. scale( i ).GT.one )
THEN
382 IF( scale( i ).GE.sfmax1 / f )
386 scale( i ) = scale( i )*f
389 CALL
sscal( n-k+1, g, a( i, k ), lda )
390 CALL
sscal( l, f, a( 1, i ), 1 )