162 SUBROUTINE cgebal( JOB, N, A, LDA, ILO, IHI, SCALE, INFO )
171 INTEGER ihi, ilo, info, lda, n
182 parameter( zero = 0.0e+0, one = 1.0e+0 )
184 parameter( sclfac = 2.0e+0 )
186 parameter( factor = 0.95e+0 )
190 INTEGER i, ica, iexc, ira, j, k, l, m
191 REAL c, ca, f, g, r, ra, s, sfmax1, sfmax2, sfmin1,
205 INTRINSIC abs, aimag, max, min, real
211 cabs1( cdum ) = abs(
REAL( CDUM ) ) + abs( aimag( cdum ) )
218 IF( .NOT.
lsame( job,
'N' ) .AND. .NOT.
lsame( job,
'P' ) .AND.
219 $ .NOT.
lsame( job,
'S' ) .AND. .NOT.
lsame( job,
'B' ) )
THEN
221 ELSE IF( n.LT.0 )
THEN
223 ELSE IF( lda.LT.max( 1, n ) )
THEN
227 CALL
xerbla(
'CGEBAL', -info )
237 IF(
lsame( job,
'N' ) )
THEN
244 IF(
lsame( job,
'S' ) )
258 CALL
cswap( l, a( 1, j ), 1, a( 1, m ), 1 )
259 CALL
cswap( n-k+1, a( j, k ), lda, a( m, k ), lda )
277 IF(
REAL( A( J, I ) ).NE.zero .OR. aimag( a( j, i ) ).NE.
299 IF(
REAL( A( I, J ) ).NE.zero .OR. aimag( a( i, j ) ).NE.
313 IF(
lsame( job,
'P' ) )
321 sfmax1 = one / sfmin1
322 sfmin2 = sfmin1*sclfac
323 sfmax2 = one / sfmin2
334 c = c + cabs1( a( j, i ) )
335 r = r + cabs1( a( i, j ) )
337 ica =
icamax( l, a( 1, i ), 1 )
338 ca = abs( a( ica, i ) )
339 ira =
icamax( n-k+1, a( i, k ), lda )
340 ra = abs( a( i, ira+k-1 ) )
344 IF( c.EQ.zero .OR. r.EQ.zero )
350 IF( c.GE.g .OR. max( f, c, ca ).GE.sfmax2 .OR.
351 $ min( r, g, ra ).LE.sfmin2 )go to 170
352 IF(
sisnan( c+f+ca+r+g+ra ) )
THEN
357 CALL
xerbla(
'CGEBAL', -info )
371 IF( g.LT.r .OR. max( r, ra ).GE.sfmax2 .OR.
372 $ min( f, c, g, ca ).LE.sfmin2 )go to 190
384 IF( ( c+r ).GE.factor*s )
386 IF( f.LT.one .AND. scale( i ).LT.one )
THEN
387 IF( f*scale( i ).LE.sfmin1 )
390 IF( f.GT.one .AND. scale( i ).GT.one )
THEN
391 IF( scale( i ).GE.sfmax1 / f )
395 scale( i ) = scale( i )*f
398 CALL
csscal( n-k+1, g, a( i, k ), lda )
399 CALL
csscal( l, f, a( 1, i ), 1 )