162 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 )
188 LOGICAL NOCONV, CANSWAP
189 INTEGER I, ICA, IRA, J, K, L
190 DOUBLE PRECISION C, CA, F, G, R, RA, S, SFMAX1, SFMAX2, SFMIN1,
194 LOGICAL DISNAN, LSAME
196 DOUBLE PRECISION DLAMCH, DZNRM2
197 EXTERNAL disnan, lsame, izamax, dlamch,
204 INTRINSIC abs, dble, dimag, max, min
209 IF( .NOT.lsame( job,
'N' ) .AND.
210 $ .NOT.lsame( job,
'P' ) .AND.
211 $ .NOT.lsame( job,
'S' ) .AND.
212 $ .NOT.lsame( job,
'B' ) )
THEN
214 ELSE IF( n.LT.0 )
THEN
216 ELSE IF( lda.LT.max( 1, n ) )
THEN
220 CALL xerbla(
'ZGEBAL', -info )
232 IF( lsame( job,
'N' ) )
THEN
246 IF( .NOT.lsame( job,
'S' ) )
THEN
259 IF( i.NE.j .AND. ( dble( a( i, j ) ).NE.zero .OR.
260 $ dimag( a( i, j ) ).NE.zero ) )
THEN
269 CALL zswap( l, a( 1, i ), 1, a( 1, l ), 1 )
270 CALL zswap( n-k+1, a( i, k ), lda, a( l, k ),
296 IF( i.NE.j .AND. ( dble( a( i, j ) ).NE.zero .OR.
297 $ dimag( a( i, j ) ).NE.zero ) )
THEN
306 CALL zswap( l, a( 1, j ), 1, a( 1, k ), 1 )
307 CALL zswap( n-k+1, a( j, k ), lda, a( k, k ),
328 IF( lsame( job,
'P' ) )
THEN
338 sfmin1 = dlamch(
'S' ) / dlamch(
'P' )
339 sfmax1 = one / sfmin1
340 sfmin2 = sfmin1*sclfac
341 sfmax2 = one / sfmin2
349 c = dznrm2( l-k+1, a( k, i ), 1 )
350 r = dznrm2( l-k+1, a( i, k ), lda )
351 ica = izamax( l, a( 1, i ), 1 )
352 ca = abs( a( ica, i ) )
353 ira = izamax( n-k+1, a( i, k ), lda )
354 ra = abs( a( i, ira+k-1 ) )
358 IF( c.EQ.zero .OR. r.EQ.zero ) cycle
362 IF( disnan( c+ca+r+ra ) )
THEN
364 CALL xerbla(
'ZGEBAL', -info )
372 DO WHILE( c.LT.g .AND. max( f, c, ca ).LT.sfmax2 .AND.
373 $ min( r, g, ra ).GT.sfmin2 )
384 DO WHILE( g.GE.r .AND. max( r, ra ).LT.sfmax2 .AND.
385 $ min( f, c, g, ca ).GT.sfmin2 )
396 IF( ( c+r ).GE.factor*s ) cycle
397 IF( f.LT.one .AND. scale( i ).LT.one )
THEN
398 IF( f*scale( i ).LE.sfmin1 ) cycle
400 IF( f.GT.one .AND. scale( i ).GT.one )
THEN
401 IF( scale( i ).GE.sfmax1 / f ) cycle
404 scale( i ) = scale( i )*f
407 CALL zdscal( n-k+1, g, a( i, k ), lda )
408 CALL zdscal( l, f, a( 1, i ), 1 )