349 SUBROUTINE zgesvx( FACT, TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV,
350 $ equed, r, c, b, ldb, x, ldx, rcond, ferr, berr,
351 $ work, rwork, info )
359 CHARACTER equed, fact, trans
360 INTEGER info, lda, ldaf, ldb, ldx, n, nrhs
361 DOUBLE PRECISION rcond
365 DOUBLE PRECISION berr( * ), c( * ), ferr( * ), r( * ),
367 COMPLEX*16 a( lda, * ), af( ldaf, * ), b( ldb, * ),
368 $ work( * ), x( ldx, * )
374 DOUBLE PRECISION zero, one
375 parameter( zero = 0.0d+0, one = 1.0d+0 )
378 LOGICAL colequ, equil, nofact, notran, rowequ
381 DOUBLE PRECISION amax, anorm, bignum, colcnd, rcmax, rcmin,
382 $ rowcnd, rpvgrw, smlnum
399 nofact =
lsame( fact,
'N' )
400 equil =
lsame( fact,
'E' )
401 notran =
lsame( trans,
'N' )
402 IF( nofact .OR. equil )
THEN
407 rowequ =
lsame( equed,
'R' ) .OR.
lsame( equed,
'B' )
408 colequ =
lsame( equed,
'C' ) .OR.
lsame( equed,
'B' )
409 smlnum =
dlamch(
'Safe minimum' )
410 bignum = one / smlnum
415 IF( .NOT.nofact .AND. .NOT.equil .AND. .NOT.
lsame( fact,
'F' ) )
418 ELSE IF( .NOT.notran .AND. .NOT.
lsame( trans,
'T' ) .AND. .NOT.
419 $
lsame( trans,
'C' ) )
THEN
421 ELSE IF( n.LT.0 )
THEN
423 ELSE IF( nrhs.LT.0 )
THEN
425 ELSE IF( lda.LT.max( 1, n ) )
THEN
427 ELSE IF( ldaf.LT.max( 1, n ) )
THEN
429 ELSE IF(
lsame( fact,
'F' ) .AND. .NOT.
430 $ ( rowequ .OR. colequ .OR.
lsame( equed,
'N' ) ) )
THEN
437 rcmin = min( rcmin, r( j ) )
438 rcmax = max( rcmax, r( j ) )
440 IF( rcmin.LE.zero )
THEN
442 ELSE IF( n.GT.0 )
THEN
443 rowcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
448 IF( colequ .AND. info.EQ.0 )
THEN
452 rcmin = min( rcmin, c( j ) )
453 rcmax = max( rcmax, c( j ) )
455 IF( rcmin.LE.zero )
THEN
457 ELSE IF( n.GT.0 )
THEN
458 colcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
464 IF( ldb.LT.max( 1, n ) )
THEN
466 ELSE IF( ldx.LT.max( 1, n ) )
THEN
473 CALL
xerbla(
'ZGESVX', -info )
481 CALL
zgeequ( n, n, a, lda, r, c, rowcnd, colcnd, amax, infequ )
482 IF( infequ.EQ.0 )
THEN
486 CALL
zlaqge( n, n, a, lda, r, c, rowcnd, colcnd, amax,
488 rowequ =
lsame( equed,
'R' ) .OR.
lsame( equed,
'B' )
489 colequ =
lsame( equed,
'C' ) .OR.
lsame( equed,
'B' )
499 b( i, j ) = r( i )*b( i, j )
503 ELSE IF( colequ )
THEN
506 b( i, j ) = c( i )*b( i, j )
511 IF( nofact .OR. equil )
THEN
515 CALL
zlacpy(
'Full', n, n, a, lda, af, ldaf )
516 CALL
zgetrf( n, n, af, ldaf, ipiv, info )
525 rpvgrw =
zlantr(
'M',
'U',
'N', info, info, af, ldaf,
527 IF( rpvgrw.EQ.zero )
THEN
530 rpvgrw =
zlange(
'M', n, info, a, lda, rwork ) /
547 anorm =
zlange( norm, n, n, a, lda, rwork )
548 rpvgrw =
zlantr(
'M',
'U',
'N', n, n, af, ldaf, rwork )
549 IF( rpvgrw.EQ.zero )
THEN
552 rpvgrw =
zlange(
'M', n, n, a, lda, rwork ) / rpvgrw
557 CALL
zgecon( norm, n, af, ldaf, anorm, rcond, work, rwork, info )
561 CALL
zlacpy(
'Full', n, nrhs, b, ldb, x, ldx )
562 CALL
zgetrs( trans, n, nrhs, af, ldaf, ipiv, x, ldx, info )
567 CALL
zgerfs( trans, n, nrhs, a, lda, af, ldaf, ipiv, b, ldb, x,
568 $ ldx, ferr, berr, work, rwork, info )
577 x( i, j ) = c( i )*x( i, j )
581 ferr( j ) = ferr( j ) / colcnd
584 ELSE IF( rowequ )
THEN
587 x( i, j ) = r( i )*x( i, j )
591 ferr( j ) = ferr( j ) / rowcnd
597 IF( rcond.LT.
dlamch(
'Epsilon' ) )