347 SUBROUTINE cgesvx( 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
362 REAL BERR( * ), C( * ), FERR( * ), R( * ),
364 COMPLEX A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
365 $ WORK( * ), X( LDX, * )
372 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0 )
375 LOGICAL COLEQU, EQUIL, NOFACT, NOTRAN, ROWEQU
378 REAL AMAX, ANORM, BIGNUM, COLCND, RCMAX, RCMIN,
379 $ rowcnd, rpvgrw, smlnum
383 REAL CLANGE, CLANTR, SLAMCH
384 EXTERNAL lsame, clange, clantr, slamch
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 = slamch(
'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(
'CGESVX', -info )
478 CALL cgeequ( n, n, a, lda, r, c, rowcnd, colcnd, amax, infequ )
479 IF( infequ.EQ.0 )
THEN
483 CALL claqge( 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 clacpy(
'Full', n, n, a, lda, af, ldaf )
513 CALL cgetrf( n, n, af, ldaf, ipiv, info )
522 rpvgrw = clantr(
'M',
'U',
'N', info, info, af, ldaf,
524 IF( rpvgrw.EQ.zero )
THEN
527 rpvgrw = clange(
'M', n, info, a, lda, rwork ) /
544 anorm = clange( norm, n, n, a, lda, rwork )
545 rpvgrw = clantr(
'M',
'U',
'N', n, n, af, ldaf, rwork )
546 IF( rpvgrw.EQ.zero )
THEN
549 rpvgrw = clange(
'M', n, n, a, lda, rwork ) / rpvgrw
554 CALL cgecon( norm, n, af, ldaf, anorm, rcond, work, rwork, info )
558 CALL clacpy(
'Full', n, nrhs, b, ldb, x, ldx )
559 CALL cgetrs( trans, n, nrhs, af, ldaf, ipiv, x, ldx, info )
564 CALL cgerfs( 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.slamch(
'Epsilon' ) )
subroutine xerbla(srname, info)
subroutine cgecon(norm, n, a, lda, anorm, rcond, work, rwork, info)
CGECON
subroutine cgeequ(m, n, a, lda, r, c, rowcnd, colcnd, amax, info)
CGEEQU
subroutine cgerfs(trans, n, nrhs, a, lda, af, ldaf, ipiv, b, ldb, x, ldx, ferr, berr, work, rwork, info)
CGERFS
subroutine cgesvx(fact, trans, n, nrhs, a, lda, af, ldaf, ipiv, equed, r, c, b, ldb, x, ldx, rcond, ferr, berr, work, rwork, info)
CGESVX computes the solution to system of linear equations A * X = B for GE matrices
subroutine cgetrf(m, n, a, lda, ipiv, info)
CGETRF
subroutine cgetrs(trans, n, nrhs, a, lda, ipiv, b, ldb, info)
CGETRS
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
subroutine claqge(m, n, a, lda, r, c, rowcnd, colcnd, amax, equed)
CLAQGE scales a general rectangular matrix, using row and column scaling factors computed by sgeequ.