164 SUBROUTINE cgebal( JOB, N, A, LDA, ILO, IHI, SCALE, INFO )
172 INTEGER IHI, ILO, INFO, LDA, N
183 parameter( zero = 0.0e+0, one = 1.0e+0 )
185 parameter( sclfac = 2.0e+0 )
187 parameter( factor = 0.95e+0 )
190 LOGICAL NOCONV, CANSWAP
191 INTEGER I, ICA, IRA, J, K, L
192 REAL C, CA, F, G, R, RA, S, SFMAX1, SFMAX2, SFMIN1,
196 LOGICAL SISNAN, LSAME
199 EXTERNAL sisnan, lsame, icamax, slamch, scnrm2
205 INTRINSIC abs, real, aimag, max, min
210 IF( .NOT.lsame( job,
'N' ) .AND. .NOT.lsame( job,
'P' ) .AND.
211 $ .NOT.lsame( job,
'S' ) .AND. .NOT.lsame( job,
'B' ) )
THEN
213 ELSE IF( n.LT.0 )
THEN
215 ELSE IF( lda.LT.max( 1, n ) )
THEN
219 CALL xerbla(
'CGEBAL', -info )
231 IF( lsame( job,
'N' ) )
THEN
245 IF( .NOT.lsame( job,
'S' ) )
THEN
258 IF( i.NE.j .AND. ( real( a( i, j ) ).NE.zero .OR.
259 $ aimag( a( i, j ) ).NE.zero ) )
THEN
268 CALL cswap( l, a( 1, i ), 1, a( 1, l ), 1 )
269 CALL cswap( n-k+1, a( i, k ), lda, a( l, k ), lda )
294 IF( i.NE.j .AND. ( real( a( i, j ) ).NE.zero .OR.
295 $ aimag( a( i, j ) ).NE.zero ) )
THEN
304 CALL cswap( l, a( 1, j ), 1, a( 1, k ), 1 )
305 CALL cswap( n-k+1, a( j, k ), lda, a( k, k ), lda )
325 IF( lsame( job,
'P' ) )
THEN
335 sfmin1 = slamch(
'S' ) / slamch(
'P' )
336 sfmax1 = one / sfmin1
337 sfmin2 = sfmin1*sclfac
338 sfmax2 = one / sfmin2
346 c = scnrm2( l-k+1, a( k, i ), 1 )
347 r = scnrm2( l-k+1, a( i, k ), lda )
348 ica = icamax( l, a( 1, i ), 1 )
349 ca = abs( a( ica, i ) )
350 ira = icamax( n-k+1, a( i, k ), lda )
351 ra = abs( a( i, ira+k-1 ) )
355 IF( c.EQ.zero .OR. r.EQ.zero ) cycle
359 IF( sisnan( c+ca+r+ra ) )
THEN
361 CALL xerbla(
'CGEBAL', -info )
369 DO WHILE( c.LT.g .AND. max( f, c, ca ).LT.sfmax2 .AND.
370 $ min( r, g, ra ).GT.sfmin2 )
381 DO WHILE( g.GE.r .AND. max( r, ra ).LT.sfmax2 .AND.
382 $ min( f, c, g, ca ).GT.sfmin2 )
393 IF( ( c+r ).GE.factor*s ) cycle
394 IF( f.LT.one .AND. scale( i ).LT.one )
THEN
395 IF( f*scale( i ).LE.sfmin1 ) cycle
397 IF( f.GT.one .AND. scale( i ).GT.one )
THEN
398 IF( scale( i ).GE.sfmax1 / f ) cycle
401 scale( i ) = scale( i )*f
404 CALL csscal( n-k+1, g, a( i, k ), lda )
405 CALL csscal( l, f, a( 1, i ), 1 )
subroutine xerbla(srname, info)
subroutine cgebal(job, n, a, lda, ilo, ihi, scale, info)
CGEBAL
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine cswap(n, cx, incx, cy, incy)
CSWAP