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,
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 )
226 IF( lsame( job,
'N' ) )
THEN
233 IF( lsame( job,
'S' ) )
247 CALL sswap( l, a( 1, j ), 1, a( 1, m ), 1 )
248 CALL sswap( 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 = slamch(
'S' ) / slamch(
'P' )
310 sfmax1 = one / sfmin1
311 sfmin2 = sfmin1*sclfac
312 sfmax2 = one / sfmin2
318 c = snrm2( l-k+1, a( k, i ), 1 )
319 r = snrm2( l-k+1, a( i, k ), lda )
320 ica = isamax( l, a( 1, i ), 1 )
321 ca = abs( a( ica, i ) )
322 ira = isamax( n-k+1, a( i, k ), lda )
323 ra = abs( a( i, ira+k-1 ) )
327 IF( c.EQ.zero .OR. r.EQ.zero )
333 IF( c.GE.g .OR. max( f, c, ca ).GE.sfmax2 .OR.
334 $ min( r, g, ra ).LE.sfmin2 )
GO TO 170
346 IF( g.LT.r .OR. max( r, ra ).GE.sfmax2 .OR.
347 $ min( f, c, g, ca ).LE.sfmin2 )
GO TO 190
348 IF( sisnan( c+f+ca+r+g+ra ) )
THEN
353 CALL xerbla(
'SGEBAL', -info )
367 IF( ( c+r ).GE.factor*s )
369 IF( f.LT.one .AND. scale( i ).LT.one )
THEN
370 IF( f*scale( i ).LE.sfmin1 )
373 IF( f.GT.one .AND. scale( i ).GT.one )
THEN
374 IF( scale( i ).GE.sfmax1 / f )
378 scale( i ) = scale( i )*f
381 CALL sscal( n-k+1, g, a( i, k ), lda )
382 CALL sscal( l, f, a( 1, i ), 1 )
subroutine xerbla(SRNAME, INFO)
XERBLA
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