162 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 )
187 LOGICAL NOCONV, CANSWAP
188 INTEGER I, ICA, IRA, J, K, L
189 REAL C, CA, F, G, R, RA, S, SFMAX1, SFMAX2, SFMIN1,
193 LOGICAL SISNAN, LSAME
196 EXTERNAL sisnan, lsame, isamax, slamch, snrm2
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(
'SGEBAL', -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 sswap( l, a( 1, i ), 1, a( 1, l ), 1 )
265 CALL sswap( 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 sswap( l, a( 1, j ), 1, a( 1, k ), 1 )
300 CALL sswap( n-k+1, a( j, k ), lda, a( k, k ), lda )
320 IF( lsame( job,
'P' ) )
THEN
330 sfmin1 = slamch(
'S' ) / slamch(
'P' )
331 sfmax1 = one / sfmin1
332 sfmin2 = sfmin1*sclfac
333 sfmax2 = one / sfmin2
341 c = snrm2( l-k+1, a( k, i ), 1 )
342 r = snrm2( l-k+1, a( i, k ), lda )
343 ica = isamax( l, a( 1, i ), 1 )
344 ca = abs( a( ica, i ) )
345 ira = isamax( 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( sisnan( c+ca+r+ra ) )
THEN
356 CALL xerbla(
'SGEBAL', -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 sscal( n-k+1, g, a( i, k ), lda )
400 CALL sscal( l, f, a( 1, i ), 1 )
subroutine xerbla(srname, info)
subroutine sgebal(job, n, a, lda, ilo, ihi, scale, info)
SGEBAL
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine sswap(n, sx, incx, sy, incy)
SSWAP