345 SUBROUTINE zgesvx( FACT, TRANS, N, NRHS, A, LDA, AF, LDAF,
347 $ EQUED, R, C, B, LDB, X, LDX, RCOND, FERR, BERR,
348 $ WORK, RWORK, INFO )
355 CHARACTER EQUED, FACT, TRANS
356 INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS
357 DOUBLE PRECISION RCOND
361 DOUBLE PRECISION BERR( * ), C( * ), FERR( * ), R( * ),
363 COMPLEX*16 A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
364 $ work( * ), x( ldx, * )
370 DOUBLE PRECISION ZERO, ONE
371 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0 )
374 LOGICAL COLEQU, EQUIL, NOFACT, NOTRAN, ROWEQU
377 DOUBLE PRECISION AMAX, ANORM, BIGNUM, COLCND, RCMAX, RCMIN,
378 $ rowcnd, rpvgrw, smlnum
382 DOUBLE PRECISION DLAMCH, ZLANGE, ZLANTR
383 EXTERNAL LSAME, DLAMCH, ZLANGE, ZLANTR
396 nofact = lsame( fact,
'N' )
397 equil = lsame( fact,
'E' )
398 notran = lsame( trans,
'N' )
399 IF( nofact .OR. equil )
THEN
404 rowequ = lsame( equed,
'R' ) .OR. lsame( equed,
'B' )
405 colequ = lsame( equed,
'C' ) .OR. lsame( equed,
'B' )
406 smlnum = dlamch(
'Safe minimum' )
407 bignum = one / smlnum
412 IF( .NOT.nofact .AND.
414 $ .NOT.lsame( fact,
'F' ) )
417 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
418 $ lsame( trans,
'C' ) )
THEN
420 ELSE IF( n.LT.0 )
THEN
422 ELSE IF( nrhs.LT.0 )
THEN
424 ELSE IF( lda.LT.max( 1, n ) )
THEN
426 ELSE IF( ldaf.LT.max( 1, n ) )
THEN
428 ELSE IF( lsame( fact,
'F' ) .AND. .NOT.
429 $ ( rowequ .OR. colequ .OR. lsame( equed,
'N' ) ) )
THEN
436 rcmin = min( rcmin, r( j ) )
437 rcmax = max( rcmax, r( j ) )
439 IF( rcmin.LE.zero )
THEN
441 ELSE IF( n.GT.0 )
THEN
442 rowcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
447 IF( colequ .AND. info.EQ.0 )
THEN
451 rcmin = min( rcmin, c( j ) )
452 rcmax = max( rcmax, c( j ) )
454 IF( rcmin.LE.zero )
THEN
456 ELSE IF( n.GT.0 )
THEN
457 colcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
463 IF( ldb.LT.max( 1, n ) )
THEN
465 ELSE IF( ldx.LT.max( 1, n ) )
THEN
472 CALL xerbla(
'ZGESVX', -info )
480 CALL zgeequ( n, n, a, lda, r, c, rowcnd, colcnd, amax,
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,
562 CALL zlacpy(
'Full', n, nrhs, b, ldb, x, ldx )
563 CALL zgetrs( trans, n, nrhs, af, ldaf, ipiv, x, ldx, info )
568 CALL zgerfs( trans, n, nrhs, a, lda, af, ldaf, ipiv, b, ldb, x,
569 $ ldx, ferr, berr, work, rwork, info )
578 x( i, j ) = c( i )*x( i, j )
582 ferr( j ) = ferr( j ) / colcnd
585 ELSE IF( rowequ )
THEN
588 x( i, j ) = r( i )*x( i, j )
592 ferr( j ) = ferr( j ) / rowcnd
598 IF( rcond.LT.dlamch(
'Epsilon' ) )
subroutine zgesvx(fact, trans, n, nrhs, a, lda, af, ldaf, ipiv, equed, r, c, b, ldb, x, ldx, rcond, ferr, berr, work, rwork, info)
ZGESVX computes the solution to system of linear equations A * X = B for GE matrices