345 SUBROUTINE cgesvx( 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
361 REAL BERR( * ), C( * ), FERR( * ), R( * ),
363 COMPLEX A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
364 $ work( * ), x( ldx, * )
371 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0 )
374 LOGICAL COLEQU, EQUIL, NOFACT, NOTRAN, ROWEQU
377 REAL AMAX, ANORM, BIGNUM, COLCND, RCMAX, RCMIN,
378 $ rowcnd, rpvgrw, smlnum
382 REAL CLANGE, CLANTR, SLAMCH
383 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.
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(
'CGESVX', -info )
480 CALL cgeequ( n, n, a, lda, r, c, rowcnd, colcnd, amax,
482 IF( infequ.EQ.0 )
THEN
486 CALL claqge( 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 clacpy(
'Full', n, n, a, lda, af, ldaf )
516 CALL cgetrf( n, n, af, ldaf, ipiv, info )
525 rpvgrw = clantr(
'M',
'U',
'N', info, info, af, ldaf,
527 IF( rpvgrw.EQ.zero )
THEN
530 rpvgrw = clange(
'M', n, info, a, lda, rwork ) /
547 anorm = clange( norm, n, n, a, lda, rwork )
548 rpvgrw = clantr(
'M',
'U',
'N', n, n, af, ldaf, rwork )
549 IF( rpvgrw.EQ.zero )
THEN
552 rpvgrw = clange(
'M', n, n, a, lda, rwork ) / rpvgrw
557 CALL cgecon( norm, n, af, ldaf, anorm, rcond, work, rwork,
562 CALL clacpy(
'Full', n, nrhs, b, ldb, x, ldx )
563 CALL cgetrs( trans, n, nrhs, af, ldaf, ipiv, x, ldx, info )
568 CALL cgerfs( 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.slamch(
'Epsilon' ) )
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