161 SUBROUTINE zgebal( JOB, N, A, LDA, ILO, IHI, SCALE, INFO )
170 INTEGER ihi, ilo, info, lda, n
173 DOUBLE PRECISION scale( * )
174 COMPLEX*16 a( lda, * )
180 DOUBLE PRECISION zero, one
181 parameter( zero = 0.0d+0, one = 1.0d+0 )
182 DOUBLE PRECISION sclfac
183 parameter( sclfac = 2.0d+0 )
184 DOUBLE PRECISION factor
185 parameter( factor = 0.95d+0 )
189 INTEGER i, ica, iexc, ira, j, k, l, m
190 DOUBLE PRECISION c, ca, f, g, r, ra, s, sfmax1, sfmax2, sfmin1,
204 INTRINSIC abs, dble, dimag, max, min
207 DOUBLE PRECISION cabs1
210 cabs1( cdum ) = abs( dble( cdum ) ) + abs( dimag( cdum ) )
217 IF( .NOT.
lsame( job,
'N' ) .AND. .NOT.
lsame( job,
'P' ) .AND.
218 $ .NOT.
lsame( job,
'S' ) .AND. .NOT.
lsame( job,
'B' ) )
THEN
220 ELSE IF( n.LT.0 )
THEN
222 ELSE IF( lda.LT.max( 1, n ) )
THEN
226 CALL
xerbla(
'ZGEBAL', -info )
236 IF(
lsame( job,
'N' ) )
THEN
243 IF(
lsame( job,
'S' ) )
257 CALL
zswap( l, a( 1, j ), 1, a( 1, m ), 1 )
258 CALL
zswap( n-k+1, a( j, k ), lda, a( m, k ), lda )
276 IF( dble( a( j, i ) ).NE.zero .OR. dimag( a( j, i ) ).NE.
298 IF( dble( a( i, j ) ).NE.zero .OR. dimag( a( i, j ) ).NE.
312 IF(
lsame( job,
'P' ) )
320 sfmax1 = one / sfmin1
321 sfmin2 = sfmin1*sclfac
322 sfmax2 = one / sfmin2
333 c = c + cabs1( a( j, i ) )
334 r = r + cabs1( a( i, j ) )
336 ica =
izamax( l, a( 1, i ), 1 )
337 ca = abs( a( ica, i ) )
338 ira =
izamax( n-k+1, a( i, k ), lda )
339 ra = abs( a( i, ira+k-1 ) )
343 IF( c.EQ.zero .OR. r.EQ.zero )
349 IF( c.GE.g .OR. max( f, c, ca ).GE.sfmax2 .OR.
350 $ min( r, g, ra ).LE.sfmin2 )go to 170
351 IF(
disnan( c+f+ca+r+g+ra ) )
THEN
356 CALL
xerbla(
'ZGEBAL', -info )
370 IF( g.LT.r .OR. max( r, ra ).GE.sfmax2 .OR.
371 $ min( f, c, g, ca ).LE.sfmin2 )go to 190
383 IF( ( c+r ).GE.factor*s )
385 IF( f.LT.one .AND. scale( i ).LT.one )
THEN
386 IF( f*scale( i ).LE.sfmin1 )
389 IF( f.GT.one .AND. scale( i ).GT.one )
THEN
390 IF( scale( i ).GE.sfmax1 / f )
394 scale( i ) = scale( i )*f
397 CALL
zdscal( n-k+1, g, a( i, k ), lda )
398 CALL
zdscal( l, f, a( 1, i ), 1 )