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,
196 LOGICAL SISNAN, LSAME
199 EXTERNAL sisnan, lsame, icamax, slamch, scnrm2
205 INTRINSIC abs, aimag, max, min, real
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 )
229 IF( lsame( job,
'N' ) )
THEN
236 IF( lsame( job,
'S' ) )
250 CALL cswap( l, a( 1, j ), 1, a( 1, m ), 1 )
251 CALL cswap( n-k+1, a( j, k ), lda, a( m, k ), lda )
269 IF(
REAL( A( J, I ) ).NE.zero .OR. aimag( A( j, i ) ).NE.
291 IF(
REAL( A( I, J ) ).NE.zero .OR. aimag( A( i, j ) ).NE.
305 IF( lsame( job,
'P' ) )
312 sfmin1 = slamch(
'S' ) / slamch(
'P' )
313 sfmax1 = one / sfmin1
314 sfmin2 = sfmin1*sclfac
315 sfmax2 = one / sfmin2
321 c = scnrm2( l-k+1, a( k, i ), 1 )
322 r = scnrm2( l-k+1, a( i , k ), lda )
323 ica = icamax( l, a( 1, i ), 1 )
324 ca = abs( a( ica, i ) )
325 ira = icamax( n-k+1, a( i, k ), lda )
326 ra = abs( a( i, ira+k-1 ) )
330 IF( c.EQ.zero .OR. r.EQ.zero )
336 IF( c.GE.g .OR. max( f, c, ca ).GE.sfmax2 .OR.
337 $ min( r, g, ra ).LE.sfmin2 )
GO TO 170
338 IF( sisnan( c+f+ca+r+g+ra ) )
THEN
343 CALL xerbla(
'CGEBAL', -info )
357 IF( g.LT.r .OR. max( r, ra ).GE.sfmax2 .OR.
358 $ min( f, c, g, ca ).LE.sfmin2 )
GO TO 190
370 IF( ( c+r ).GE.factor*s )
372 IF( f.LT.one .AND. scale( i ).LT.one )
THEN
373 IF( f*scale( i ).LE.sfmin1 )
376 IF( f.GT.one .AND. scale( i ).GT.one )
THEN
377 IF( scale( i ).GE.sfmax1 / f )
381 scale( i ) = scale( i )*f
384 CALL csscal( n-k+1, g, a( i, k ), lda )
385 CALL csscal( l, f, a( 1, i ), 1 )
subroutine xerbla(SRNAME, INFO)
XERBLA
subroutine cgebal(JOB, N, A, LDA, ILO, IHI, SCALE, INFO)
CGEBAL
subroutine cswap(N, CX, INCX, CY, INCY)
CSWAP
subroutine csscal(N, SA, CX, INCX)
CSSCAL