347 SUBROUTINE zgesvx( FACT, TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV,
348 $ EQUED, R, C, B, LDB, X, LDX, RCOND, FERR, BERR,
349 $ WORK, RWORK, INFO )
356 CHARACTER EQUED, FACT, TRANS
357 INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS
358 DOUBLE PRECISION RCOND
362 DOUBLE PRECISION BERR( * ), C( * ), FERR( * ), R( * ),
364 COMPLEX*16 A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
365 $ WORK( * ), X( LDX, * )
371 DOUBLE PRECISION ZERO, ONE
372 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0 )
375 LOGICAL COLEQU, EQUIL, NOFACT, NOTRAN, ROWEQU
378 DOUBLE PRECISION AMAX, ANORM, BIGNUM, COLCND, RCMAX, RCMIN,
379 $ rowcnd, rpvgrw, smlnum
383 DOUBLE PRECISION DLAMCH, ZLANGE, ZLANTR
384 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. .NOT.equil .AND. .NOT.lsame( fact,
'F' ) )
415 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
416 $ lsame( trans,
'C' ) )
THEN
418 ELSE IF( n.LT.0 )
THEN
420 ELSE IF( nrhs.LT.0 )
THEN
422 ELSE IF( lda.LT.max( 1, n ) )
THEN
424 ELSE IF( ldaf.LT.max( 1, n ) )
THEN
426 ELSE IF( lsame( fact,
'F' ) .AND. .NOT.
427 $ ( rowequ .OR. colequ .OR. lsame( equed,
'N' ) ) )
THEN
434 rcmin = min( rcmin, r( j ) )
435 rcmax = max( rcmax, r( j ) )
437 IF( rcmin.LE.zero )
THEN
439 ELSE IF( n.GT.0 )
THEN
440 rowcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
445 IF( colequ .AND. info.EQ.0 )
THEN
449 rcmin = min( rcmin, c( j ) )
450 rcmax = max( rcmax, c( j ) )
452 IF( rcmin.LE.zero )
THEN
454 ELSE IF( n.GT.0 )
THEN
455 colcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
461 IF( ldb.LT.max( 1, n ) )
THEN
463 ELSE IF( ldx.LT.max( 1, n ) )
THEN
470 CALL xerbla(
'ZGESVX', -info )
478 CALL zgeequ( n, n, a, lda, r, c, rowcnd, colcnd, amax, infequ )
479 IF( infequ.EQ.0 )
THEN
483 CALL zlaqge( n, n, a, lda, r, c, rowcnd, colcnd, amax,
485 rowequ = lsame( equed,
'R' ) .OR. lsame( equed,
'B' )
486 colequ = lsame( equed,
'C' ) .OR. lsame( equed,
'B' )
496 b( i, j ) = r( i )*b( i, j )
500 ELSE IF( colequ )
THEN
503 b( i, j ) = c( i )*b( i, j )
508 IF( nofact .OR. equil )
THEN
512 CALL zlacpy(
'Full', n, n, a, lda, af, ldaf )
513 CALL zgetrf( n, n, af, ldaf, ipiv, info )
522 rpvgrw = zlantr(
'M',
'U',
'N', info, info, af, ldaf,
524 IF( rpvgrw.EQ.zero )
THEN
527 rpvgrw = zlange(
'M', n, info, a, lda, rwork ) /
544 anorm = zlange( norm, n, n, a, lda, rwork )
545 rpvgrw = zlantr(
'M',
'U',
'N', n, n, af, ldaf, rwork )
546 IF( rpvgrw.EQ.zero )
THEN
549 rpvgrw = zlange(
'M', n, n, a, lda, rwork ) / rpvgrw
554 CALL zgecon( norm, n, af, ldaf, anorm, rcond, work, rwork, info )
558 CALL zlacpy(
'Full', n, nrhs, b, ldb, x, ldx )
559 CALL zgetrs( trans, n, nrhs, af, ldaf, ipiv, x, ldx, info )
564 CALL zgerfs( trans, n, nrhs, a, lda, af, ldaf, ipiv, b, ldb, x,
565 $ ldx, ferr, berr, work, rwork, info )
574 x( i, j ) = c( i )*x( i, j )
578 ferr( j ) = ferr( j ) / colcnd
581 ELSE IF( rowequ )
THEN
584 x( i, j ) = r( i )*x( i, j )
588 ferr( j ) = ferr( j ) / rowcnd
594 IF( rcond.LT.dlamch(
'Epsilon' ) )
subroutine xerbla(srname, info)
subroutine zgecon(norm, n, a, lda, anorm, rcond, work, rwork, info)
ZGECON
subroutine zgeequ(m, n, a, lda, r, c, rowcnd, colcnd, amax, info)
ZGEEQU
subroutine zgerfs(trans, n, nrhs, a, lda, af, ldaf, ipiv, b, ldb, x, ldx, ferr, berr, work, rwork, info)
ZGERFS
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
subroutine zgetrf(m, n, a, lda, ipiv, info)
ZGETRF
subroutine zgetrs(trans, n, nrhs, a, lda, ipiv, b, ldb, info)
ZGETRS
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine zlaqge(m, n, a, lda, r, c, rowcnd, colcnd, amax, equed)
ZLAQGE scales a general rectangular matrix, using row and column scaling factors computed by sgeequ.