LAPACK  3.6.1 LAPACK: Linear Algebra PACKage
 subroutine cgesvxx ( character FACT, character TRANS, integer N, integer NRHS, complex, dimension( lda, * ) A, integer LDA, complex, dimension( ldaf, * ) AF, integer LDAF, integer, dimension( * ) IPIV, character EQUED, real, dimension( * ) R, real, dimension( * ) C, complex, dimension( ldb, * ) B, integer LDB, complex, dimension( ldx , * ) X, integer LDX, real RCOND, real RPVGRW, real, dimension( * ) BERR, integer N_ERR_BNDS, real, dimension( nrhs, * ) ERR_BNDS_NORM, real, dimension( nrhs, * ) ERR_BNDS_COMP, integer NPARAMS, real, dimension( * ) PARAMS, complex, dimension( * ) WORK, real, dimension( * ) RWORK, integer INFO )

CGESVXX computes the solution to system of linear equations A * X = B for GE matrices

Purpose:
CGESVXX uses the LU factorization to compute the solution to a
complex system of linear equations  A * X = B,  where A is an
N-by-N matrix and X and B are N-by-NRHS matrices.

If requested, both normwise and maximum componentwise error bounds
are returned. CGESVXX will return a solution with a tiny
guaranteed error (O(eps) where eps is the working machine
precision) unless the matrix is very ill-conditioned, in which
case a warning is returned. Relevant condition numbers also are
calculated and returned.

CGESVXX accepts user-provided factorizations and equilibration
factors; see the definitions of the FACT and EQUED options.
Solving with refinement and using a factorization from a previous
CGESVXX call will also produce a solution with either O(eps)
errors or warnings, but we cannot make that claim for general
user-provided factorizations and equilibration factors if they
differ from what CGESVXX would itself produce.
Description:
The following steps are performed:

1. If FACT = 'E', real scaling factors are computed to equilibrate
the system:

TRANS = 'N':  diag(R)*A*diag(C)     *inv(diag(C))*X = diag(R)*B
TRANS = 'T': (diag(R)*A*diag(C))**T *inv(diag(R))*X = diag(C)*B
TRANS = 'C': (diag(R)*A*diag(C))**H *inv(diag(R))*X = diag(C)*B

Whether or not the system will be equilibrated depends on the
scaling of the matrix A, but if equilibration is used, A is
overwritten by diag(R)*A*diag(C) and B by diag(R)*B (if TRANS='N')
or diag(C)*B (if TRANS = 'T' or 'C').

2. If FACT = 'N' or 'E', the LU decomposition is used to factor
the matrix A (after equilibration if FACT = 'E') as

A = P * L * U,

where P is a permutation matrix, L is a unit lower triangular
matrix, and U is upper triangular.

3. If some U(i,i)=0, so that U is exactly singular, then the
routine returns with INFO = i. Otherwise, the factored form of A
is used to estimate the condition number of the matrix A (see
argument RCOND). If the reciprocal of the condition number is less
than machine precision, the routine still goes on to solve for X
and compute error bounds as described below.

4. The system of equations is solved for X using the factored form
of A.

5. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero),
the routine will use iterative refinement to try to get a small
error and error bounds.  Refinement calculates the residual to at
least twice the working precision.

6. If equilibration was used, the matrix X is premultiplied by
diag(C) (if TRANS = 'N') or diag(R) (if TRANS = 'T' or 'C') so
that it solves the original system before equilibration.
Some optional parameters are bundled in the PARAMS array.  These
settings determine how refinement is performed, but often the
defaults are acceptable.  If the defaults are acceptable, users
can pass NPARAMS = 0 which prevents the source code from accessing
the PARAMS argument.
Parameters
Date
April 2012

Definition at line 545 of file cgesvxx.f.

545 *
546 * -- LAPACK driver routine (version 3.4.1) --
547 * -- LAPACK is a software package provided by Univ. of Tennessee, --
548 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
549 * April 2012
550 *
551 * .. Scalar Arguments ..
552  CHARACTER equed, fact, trans
553  INTEGER info, lda, ldaf, ldb, ldx, n, nrhs, nparams,
554  \$ n_err_bnds
555  REAL rcond, rpvgrw
556 * ..
557 * .. Array Arguments ..
558  INTEGER ipiv( * )
559  COMPLEX a( lda, * ), af( ldaf, * ), b( ldb, * ),
560  \$ x( ldx , * ),work( * )
561  REAL r( * ), c( * ), params( * ), berr( * ),
562  \$ err_bnds_norm( nrhs, * ),
563  \$ err_bnds_comp( nrhs, * ), rwork( * )
564 * ..
565 *
566 * ==================================================================
567 *
568 * .. Parameters ..
569  REAL zero, one
570  parameter ( zero = 0.0e+0, one = 1.0e+0 )
571  INTEGER final_nrm_err_i, final_cmp_err_i, berr_i
572  INTEGER rcond_i, nrm_rcond_i, nrm_err_i, cmp_rcond_i
573  INTEGER cmp_err_i, piv_growth_i
574  parameter ( final_nrm_err_i = 1, final_cmp_err_i = 2,
575  \$ berr_i = 3 )
576  parameter ( rcond_i = 4, nrm_rcond_i = 5, nrm_err_i = 6 )
577  parameter ( cmp_rcond_i = 7, cmp_err_i = 8,
578  \$ piv_growth_i = 9 )
579 * ..
580 * .. Local Scalars ..
581  LOGICAL colequ, equil, nofact, notran, rowequ
582  INTEGER infequ, j
583  REAL amax, bignum, colcnd, rcmax, rcmin,
584  \$ rowcnd, smlnum
585 * ..
586 * .. External Functions ..
587  EXTERNAL lsame, slamch, cla_gerpvgrw
588  LOGICAL lsame
589  REAL slamch, cla_gerpvgrw
590 * ..
591 * .. External Subroutines ..
592  EXTERNAL cgeequb, cgetrf, cgetrs, clacpy, claqge,
594 * ..
595 * .. Intrinsic Functions ..
596  INTRINSIC max, min
597 * ..
598 * .. Executable Statements ..
599 *
600  info = 0
601  nofact = lsame( fact, 'N' )
602  equil = lsame( fact, 'E' )
603  notran = lsame( trans, 'N' )
604  smlnum = slamch( 'Safe minimum' )
605  bignum = one / smlnum
606  IF( nofact .OR. equil ) THEN
607  equed = 'N'
608  rowequ = .false.
609  colequ = .false.
610  ELSE
611  rowequ = lsame( equed, 'R' ) .OR. lsame( equed, 'B' )
612  colequ = lsame( equed, 'C' ) .OR. lsame( equed, 'B' )
613  END IF
614 *
615 * Default is failure. If an input parameter is wrong or
616 * factorization fails, make everything look horrible. Only the
617 * pivot growth is set here, the rest is initialized in CGERFSX.
618 *
619  rpvgrw = zero
620 *
621 * Test the input parameters. PARAMS is not tested until CGERFSX.
622 *
623  IF( .NOT.nofact .AND. .NOT.equil .AND. .NOT.
624  \$ lsame( fact, 'F' ) ) THEN
625  info = -1
626  ELSE IF( .NOT.notran .AND. .NOT.lsame( trans, 'T' ) .AND. .NOT.
627  \$ lsame( trans, 'C' ) ) THEN
628  info = -2
629  ELSE IF( n.LT.0 ) THEN
630  info = -3
631  ELSE IF( nrhs.LT.0 ) THEN
632  info = -4
633  ELSE IF( lda.LT.max( 1, n ) ) THEN
634  info = -6
635  ELSE IF( ldaf.LT.max( 1, n ) ) THEN
636  info = -8
637  ELSE IF( lsame( fact, 'F' ) .AND. .NOT.
638  \$ ( rowequ .OR. colequ .OR. lsame( equed, 'N' ) ) ) THEN
639  info = -10
640  ELSE
641  IF( rowequ ) THEN
642  rcmin = bignum
643  rcmax = zero
644  DO 10 j = 1, n
645  rcmin = min( rcmin, r( j ) )
646  rcmax = max( rcmax, r( j ) )
647  10 CONTINUE
648  IF( rcmin.LE.zero ) THEN
649  info = -11
650  ELSE IF( n.GT.0 ) THEN
651  rowcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
652  ELSE
653  rowcnd = one
654  END IF
655  END IF
656  IF( colequ .AND. info.EQ.0 ) THEN
657  rcmin = bignum
658  rcmax = zero
659  DO 20 j = 1, n
660  rcmin = min( rcmin, c( j ) )
661  rcmax = max( rcmax, c( j ) )
662  20 CONTINUE
663  IF( rcmin.LE.zero ) THEN
664  info = -12
665  ELSE IF( n.GT.0 ) THEN
666  colcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
667  ELSE
668  colcnd = one
669  END IF
670  END IF
671  IF( info.EQ.0 ) THEN
672  IF( ldb.LT.max( 1, n ) ) THEN
673  info = -14
674  ELSE IF( ldx.LT.max( 1, n ) ) THEN
675  info = -16
676  END IF
677  END IF
678  END IF
679 *
680  IF( info.NE.0 ) THEN
681  CALL xerbla( 'CGESVXX', -info )
682  RETURN
683  END IF
684 *
685  IF( equil ) THEN
686 *
687 * Compute row and column scalings to equilibrate the matrix A.
688 *
689  CALL cgeequb( n, n, a, lda, r, c, rowcnd, colcnd, amax,
690  \$ infequ )
691  IF( infequ.EQ.0 ) THEN
692 *
693 * Equilibrate the matrix.
694 *
695  CALL claqge( n, n, a, lda, r, c, rowcnd, colcnd, amax,
696  \$ equed )
697  rowequ = lsame( equed, 'R' ) .OR. lsame( equed, 'B' )
698  colequ = lsame( equed, 'C' ) .OR. lsame( equed, 'B' )
699  END IF
700 *
701 * If the scaling factors are not applied, set them to 1.0.
702 *
703  IF ( .NOT.rowequ ) THEN
704  DO j = 1, n
705  r( j ) = 1.0
706  END DO
707  END IF
708  IF ( .NOT.colequ ) THEN
709  DO j = 1, n
710  c( j ) = 1.0
711  END DO
712  END IF
713  END IF
714 *
715 * Scale the right-hand side.
716 *
717  IF( notran ) THEN
718  IF( rowequ ) CALL clascl2( n, nrhs, r, b, ldb )
719  ELSE
720  IF( colequ ) CALL clascl2( n, nrhs, c, b, ldb )
721  END IF
722 *
723  IF( nofact .OR. equil ) THEN
724 *
725 * Compute the LU factorization of A.
726 *
727  CALL clacpy( 'Full', n, n, a, lda, af, ldaf )
728  CALL cgetrf( n, n, af, ldaf, ipiv, info )
729 *
730 * Return if INFO is non-zero.
731 *
732  IF( info.GT.0 ) THEN
733 *
734 * Pivot in column INFO is exactly 0
735 * Compute the reciprocal pivot growth factor of the
736 * leading rank-deficient INFO columns of A.
737 *
738  rpvgrw = cla_gerpvgrw( n, info, a, lda, af, ldaf )
739  RETURN
740  END IF
741  END IF
742 *
743 * Compute the reciprocal pivot growth factor RPVGRW.
744 *
745  rpvgrw = cla_gerpvgrw( n, n, a, lda, af, ldaf )
746 *
747 * Compute the solution matrix X.
748 *
749  CALL clacpy( 'Full', n, nrhs, b, ldb, x, ldx )
750  CALL cgetrs( trans, n, nrhs, af, ldaf, ipiv, x, ldx, info )
751 *
752 * Use iterative refinement to improve the computed solution and
753 * compute error bounds and backward error estimates for it.
754 *
755  CALL cgerfsx( trans, equed, n, nrhs, a, lda, af, ldaf,
756  \$ ipiv, r, c, b, ldb, x, ldx, rcond, berr,
757  \$ n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params,
758  \$ work, rwork, info )
759 *
760 * Scale solutions.
761 *
762  IF ( colequ .AND. notran ) THEN
763  CALL clascl2 ( n, nrhs, c, x, ldx )
764  ELSE IF ( rowequ .AND. .NOT.notran ) THEN
765  CALL clascl2 ( n, nrhs, r, x, ldx )
766  END IF
767 *
768  RETURN
769 *
770 * End of CGESVXX
771 *
subroutine cgerfsx(TRANS, EQUED, N, NRHS, A, LDA, AF, LDAF, IPIV, R, C, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, RWORK, INFO)
CGERFSX
Definition: cgerfsx.f:416
subroutine cgetrs(TRANS, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
CGETRS
Definition: cgetrs.f:123
real function cla_gerpvgrw(N, NCOLS, A, LDA, AF, LDAF)
CLA_GERPVGRW multiplies a square real matrix by a complex matrix.
Definition: cla_gerpvgrw.f:100
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine cgeequb(M, N, A, LDA, R, C, ROWCND, COLCND, AMAX, INFO)
CGEEQUB
Definition: cgeequb.f:149
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...
Definition: claqge.f:145
subroutine clascl2(M, N, D, X, LDX)
CLASCL2 performs diagonal scaling on a vector.
Definition: clascl2.f:93
subroutine cgetrf(M, N, A, LDA, IPIV, INFO)
CGETRF
Definition: cgetrf.f:110
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:105
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function: