LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ sgerfsx()

subroutine sgerfsx ( character trans,
character equed,
integer n,
integer nrhs,
real, dimension( lda, * ) a,
integer lda,
real, dimension( ldaf, * ) af,
integer ldaf,
integer, dimension( * ) ipiv,
real, dimension( * ) r,
real, dimension( * ) c,
real, dimension( ldb, * ) b,
integer ldb,
real, dimension( ldx , * ) x,
integer ldx,
real rcond,
real, dimension( * ) berr,
integer n_err_bnds,
real, dimension( nrhs, * ) err_bnds_norm,
real, dimension( nrhs, * ) err_bnds_comp,
integer nparams,
real, dimension( * ) params,
real, dimension( * ) work,
integer, dimension( * ) iwork,
integer info )

SGERFSX

Download SGERFSX + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!>    SGERFSX improves the computed solution to a system of linear
!>    equations and provides error bounds and backward error estimates
!>    for the solution.  In addition to normwise error bound, the code
!>    provides maximum componentwise error bound if possible.  See
!>    comments for ERR_BNDS_NORM and ERR_BNDS_COMP for details of the
!>    error bounds.
!>
!>    The original system of linear equations may have been equilibrated
!>    before calling this routine, as described by arguments EQUED, R
!>    and C below. In this case, the solution and error bounds returned
!>    are for the original unequilibrated system.
!> 
!>     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
[in]TRANS
!>          TRANS is CHARACTER*1
!>     Specifies the form of the system of equations:
!>       = 'N':  A * X = B     (No transpose)
!>       = 'T':  A**T * X = B  (Transpose)
!>       = 'C':  A**H * X = B  (Conjugate transpose = Transpose)
!> 
[in]EQUED
!>          EQUED is CHARACTER*1
!>     Specifies the form of equilibration that was done to A
!>     before calling this routine. This is needed to compute
!>     the solution and error bounds correctly.
!>       = 'N':  No equilibration
!>       = 'R':  Row equilibration, i.e., A has been premultiplied by
!>               diag(R).
!>       = 'C':  Column equilibration, i.e., A has been postmultiplied
!>               by diag(C).
!>       = 'B':  Both row and column equilibration, i.e., A has been
!>               replaced by diag(R) * A * diag(C).
!>               The right hand side B has been changed accordingly.
!> 
[in]N
!>          N is INTEGER
!>     The order of the matrix A.  N >= 0.
!> 
[in]NRHS
!>          NRHS is INTEGER
!>     The number of right hand sides, i.e., the number of columns
!>     of the matrices B and X.  NRHS >= 0.
!> 
[in]A
!>          A is REAL array, dimension (LDA,N)
!>     The original N-by-N matrix A.
!> 
[in]LDA
!>          LDA is INTEGER
!>     The leading dimension of the array A.  LDA >= max(1,N).
!> 
[in]AF
!>          AF is REAL array, dimension (LDAF,N)
!>     The factors L and U from the factorization A = P*L*U
!>     as computed by SGETRF.
!> 
[in]LDAF
!>          LDAF is INTEGER
!>     The leading dimension of the array AF.  LDAF >= max(1,N).
!> 
[in]IPIV
!>          IPIV is INTEGER array, dimension (N)
!>     The pivot indices from SGETRF; for 1<=i<=N, row i of the
!>     matrix was interchanged with row IPIV(i).
!> 
[in]R
!>          R is REAL array, dimension (N)
!>     The row scale factors for A.  If EQUED = 'R' or 'B', A is
!>     multiplied on the left by diag(R); if EQUED = 'N' or 'C', R
!>     is not accessed.
!>     If R is accessed, each element of R should be a power of the radix
!>     to ensure a reliable solution and error estimates. Scaling by
!>     powers of the radix does not cause rounding errors unless the
!>     result underflows or overflows. Rounding errors during scaling
!>     lead to refining with a matrix that is not equivalent to the
!>     input matrix, producing error estimates that may not be
!>     reliable.
!> 
[in]C
!>          C is REAL array, dimension (N)
!>     The column scale factors for A.  If EQUED = 'C' or 'B', A is
!>     multiplied on the right by diag(C); if EQUED = 'N' or 'R', C
!>     is not accessed.
!>     If C is accessed, each element of C should be a power of the radix
!>     to ensure a reliable solution and error estimates. Scaling by
!>     powers of the radix does not cause rounding errors unless the
!>     result underflows or overflows. Rounding errors during scaling
!>     lead to refining with a matrix that is not equivalent to the
!>     input matrix, producing error estimates that may not be
!>     reliable.
!> 
[in]B
!>          B is REAL array, dimension (LDB,NRHS)
!>     The right hand side matrix B.
!> 
[in]LDB
!>          LDB is INTEGER
!>     The leading dimension of the array B.  LDB >= max(1,N).
!> 
[in,out]X
!>          X is REAL array, dimension (LDX,NRHS)
!>     On entry, the solution matrix X, as computed by SGETRS.
!>     On exit, the improved solution matrix X.
!> 
[in]LDX
!>          LDX is INTEGER
!>     The leading dimension of the array X.  LDX >= max(1,N).
!> 
[out]RCOND
!>          RCOND is REAL
!>     Reciprocal scaled condition number.  This is an estimate of the
!>     reciprocal Skeel condition number of the matrix A after
!>     equilibration (if done).  If this is less than the machine
!>     precision (in particular, if it is zero), the matrix is singular
!>     to working precision.  Note that the error may still be small even
!>     if this number is very small and the matrix appears ill-
!>     conditioned.
!> 
[out]BERR
!>          BERR is REAL array, dimension (NRHS)
!>     Componentwise relative backward error.  This is the
!>     componentwise relative backward error of each solution vector X(j)
!>     (i.e., the smallest relative change in any element of A or B that
!>     makes X(j) an exact solution).
!> 
[in]N_ERR_BNDS
!>          N_ERR_BNDS is INTEGER
!>     Number of error bounds to return for each right hand side
!>     and each type (normwise or componentwise).  See ERR_BNDS_NORM and
!>     ERR_BNDS_COMP below.
!> 
[out]ERR_BNDS_NORM
!>          ERR_BNDS_NORM is REAL array, dimension (NRHS, N_ERR_BNDS)
!>     For each right-hand side, this array contains information about
!>     various error bounds and condition numbers corresponding to the
!>     normwise relative error, which is defined as follows:
!>
!>     Normwise relative error in the ith solution vector:
!>             max_j (abs(XTRUE(j,i) - X(j,i)))
!>            ------------------------------
!>                  max_j abs(X(j,i))
!>
!>     The array is indexed by the type of error information as described
!>     below. There currently are up to three pieces of information
!>     returned.
!>
!>     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
!>     right-hand side.
!>
!>     The second index in ERR_BNDS_NORM(:,err) contains the following
!>     three fields:
!>     err = 1  boolean. Trust the answer if the
!>              reciprocal condition number is less than the threshold
!>              sqrt(n) * slamch('Epsilon').
!>
!>     err = 2  error bound: The estimated forward error,
!>              almost certainly within a factor of 10 of the true error
!>              so long as the next entry is greater than the threshold
!>              sqrt(n) * slamch('Epsilon'). This error bound should only
!>              be trusted if the previous boolean is true.
!>
!>     err = 3  Reciprocal condition number: Estimated normwise
!>              reciprocal condition number.  Compared with the threshold
!>              sqrt(n) * slamch('Epsilon') to determine if the error
!>              estimate is . These reciprocal condition
!>              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
!>              appropriately scaled matrix Z.
!>              Let Z = S*A, where S scales each row by a power of the
!>              radix so all absolute row sums of Z are approximately 1.
!>
!>     See Lapack Working Note 165 for further details and extra
!>     cautions.
!> 
[out]ERR_BNDS_COMP
!>          ERR_BNDS_COMP is REAL array, dimension (NRHS, N_ERR_BNDS)
!>     For each right-hand side, this array contains information about
!>     various error bounds and condition numbers corresponding to the
!>     componentwise relative error, which is defined as follows:
!>
!>     Componentwise relative error in the ith solution vector:
!>                    abs(XTRUE(j,i) - X(j,i))
!>             max_j ----------------------
!>                         abs(X(j,i))
!>
!>     The array is indexed by the right-hand side i (on which the
!>     componentwise relative error depends), and the type of error
!>     information as described below. There currently are up to three
!>     pieces of information returned for each right-hand side. If
!>     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
!>     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS < 3, then at most
!>     the first (:,N_ERR_BNDS) entries are returned.
!>
!>     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
!>     right-hand side.
!>
!>     The second index in ERR_BNDS_COMP(:,err) contains the following
!>     three fields:
!>     err = 1  boolean. Trust the answer if the
!>              reciprocal condition number is less than the threshold
!>              sqrt(n) * slamch('Epsilon').
!>
!>     err = 2  error bound: The estimated forward error,
!>              almost certainly within a factor of 10 of the true error
!>              so long as the next entry is greater than the threshold
!>              sqrt(n) * slamch('Epsilon'). This error bound should only
!>              be trusted if the previous boolean is true.
!>
!>     err = 3  Reciprocal condition number: Estimated componentwise
!>              reciprocal condition number.  Compared with the threshold
!>              sqrt(n) * slamch('Epsilon') to determine if the error
!>              estimate is . These reciprocal condition
!>              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
!>              appropriately scaled matrix Z.
!>              Let Z = S*(A*diag(x)), where x is the solution for the
!>              current right-hand side and S scales each row of
!>              A*diag(x) by a power of the radix so all absolute row
!>              sums of Z are approximately 1.
!>
!>     See Lapack Working Note 165 for further details and extra
!>     cautions.
!> 
[in]NPARAMS
!>          NPARAMS is INTEGER
!>     Specifies the number of parameters set in PARAMS.  If <= 0, the
!>     PARAMS array is never referenced and default values are used.
!> 
[in,out]PARAMS
!>          PARAMS is REAL array, dimension NPARAMS
!>     Specifies algorithm parameters.  If an entry is < 0.0, then
!>     that entry will be filled with default value used for that
!>     parameter.  Only positions up to NPARAMS are accessed; defaults
!>     are used for higher-numbered parameters.
!>
!>       PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
!>            refinement or not.
!>         Default: 1.0
!>            = 0.0:  No refinement is performed, and no error bounds are
!>                    computed.
!>            = 1.0:  Use the double-precision refinement algorithm,
!>                    possibly with doubled-single computations if the
!>                    compilation environment does not support DOUBLE
!>                    PRECISION.
!>              (other values are reserved for future use)
!>
!>       PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
!>            computations allowed for refinement.
!>         Default: 10
!>         Aggressive: Set to 100 to permit convergence using approximate
!>                     factorizations or factorizations other than LU. If
!>                     the factorization uses a technique other than
!>                     Gaussian elimination, the guarantees in
!>                     err_bnds_norm and err_bnds_comp may no longer be
!>                     trustworthy.
!>
!>       PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code
!>            will attempt to find a solution with small componentwise
!>            relative error in the double-precision algorithm.  Positive
!>            is true, 0.0 is false.
!>         Default: 1.0 (attempt componentwise convergence)
!> 
[out]WORK
!>          WORK is REAL array, dimension (4*N)
!> 
[out]IWORK
!>          IWORK is INTEGER array, dimension (N)
!> 
[out]INFO
!>          INFO is INTEGER
!>       = 0:  Successful exit. The solution to every right-hand side is
!>         guaranteed.
!>       < 0:  If INFO = -i, the i-th argument had an illegal value
!>       > 0 and <= N:  U(INFO,INFO) is exactly zero.  The factorization
!>         has been completed, but the factor U is exactly singular, so
!>         the solution and error bounds could not be computed. RCOND = 0
!>         is returned.
!>       = N+J: The solution corresponding to the Jth right-hand side is
!>         not guaranteed. The solutions corresponding to other right-
!>         hand sides K with K > J may not be guaranteed as well, but
!>         only the first such right-hand side is reported. If a small
!>         componentwise error is not requested (PARAMS(3) = 0.0) then
!>         the Jth right-hand side is the first with a normwise error
!>         bound that is not guaranteed (the smallest J such
!>         that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)
!>         the Jth right-hand side is the first with either a normwise or
!>         componentwise error bound that is not guaranteed (the smallest
!>         J such that either ERR_BNDS_NORM(J,1) = 0.0 or
!>         ERR_BNDS_COMP(J,1) = 0.0). See the definition of
!>         ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information
!>         about all of the right-hand sides check ERR_BNDS_NORM or
!>         ERR_BNDS_COMP.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 408 of file sgerfsx.f.

413*
414* -- LAPACK computational routine --
415* -- LAPACK is a software package provided by Univ. of Tennessee, --
416* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
417*
418* .. Scalar Arguments ..
419 CHARACTER TRANS, EQUED
420 INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS,
421 $ N_ERR_BNDS
422 REAL RCOND
423* ..
424* .. Array Arguments ..
425 INTEGER IPIV( * ), IWORK( * )
426 REAL A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
427 $ X( LDX , * ), WORK( * )
428 REAL R( * ), C( * ), PARAMS( * ), BERR( * ),
429 $ ERR_BNDS_NORM( NRHS, * ),
430 $ ERR_BNDS_COMP( NRHS, * )
431* ..
432*
433* ==================================================================
434*
435* .. Parameters ..
436 REAL ZERO, ONE
437 parameter( zero = 0.0e+0, one = 1.0e+0 )
438 REAL ITREF_DEFAULT, ITHRESH_DEFAULT,
439 $ COMPONENTWISE_DEFAULT
440 REAL RTHRESH_DEFAULT, DZTHRESH_DEFAULT
441 parameter( itref_default = 1.0 )
442 parameter( ithresh_default = 10.0 )
443 parameter( componentwise_default = 1.0 )
444 parameter( rthresh_default = 0.5 )
445 parameter( dzthresh_default = 0.25 )
446 INTEGER LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
447 $ LA_LINRX_CWISE_I
448 parameter( la_linrx_itref_i = 1,
449 $ la_linrx_ithresh_i = 2 )
450 parameter( la_linrx_cwise_i = 3 )
451 INTEGER LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
452 $ LA_LINRX_RCOND_I
453 parameter( la_linrx_trust_i = 1, la_linrx_err_i = 2 )
454 parameter( la_linrx_rcond_i = 3 )
455* ..
456* .. Local Scalars ..
457 CHARACTER(1) NORM
458 LOGICAL ROWEQU, COLEQU, NOTRAN
459 INTEGER J, TRANS_TYPE, PREC_TYPE, REF_TYPE
460 INTEGER N_NORMS
461 REAL ANORM, RCOND_TMP
462 REAL ILLRCOND_THRESH, ERR_LBND, CWISE_WRONG
463 LOGICAL IGNORE_CWISE
464 INTEGER ITHRESH
465 REAL RTHRESH, UNSTABLE_THRESH
466* ..
467* .. External Subroutines ..
469* ..
470* .. Intrinsic Functions ..
471 INTRINSIC max, sqrt
472* ..
473* .. External Functions ..
474 EXTERNAL lsame, ilatrans, ilaprec
475 EXTERNAL slamch, slange, sla_gercond
476 REAL SLAMCH, SLANGE, SLA_GERCOND
477 LOGICAL LSAME
478 INTEGER ILATRANS, ILAPREC
479* ..
480* .. Executable Statements ..
481*
482* Check the input parameters.
483*
484 info = 0
485 trans_type = ilatrans( trans )
486 ref_type = int( itref_default )
487 IF ( nparams .GE. la_linrx_itref_i ) THEN
488 IF ( params( la_linrx_itref_i ) .LT. 0.0 ) THEN
489 params( la_linrx_itref_i ) = itref_default
490 ELSE
491 ref_type = params( la_linrx_itref_i )
492 END IF
493 END IF
494*
495* Set default parameters.
496*
497 illrcond_thresh = real( n ) * slamch( 'Epsilon' )
498 ithresh = int( ithresh_default )
499 rthresh = rthresh_default
500 unstable_thresh = dzthresh_default
501 ignore_cwise = componentwise_default .EQ. 0.0
502*
503 IF ( nparams.GE.la_linrx_ithresh_i ) THEN
504 IF ( params( la_linrx_ithresh_i ).LT.0.0 ) THEN
505 params( la_linrx_ithresh_i ) = ithresh
506 ELSE
507 ithresh = int( params( la_linrx_ithresh_i ) )
508 END IF
509 END IF
510 IF ( nparams.GE.la_linrx_cwise_i ) THEN
511 IF ( params( la_linrx_cwise_i ).LT.0.0 ) THEN
512 IF ( ignore_cwise ) THEN
513 params( la_linrx_cwise_i ) = 0.0
514 ELSE
515 params( la_linrx_cwise_i ) = 1.0
516 END IF
517 ELSE
518 ignore_cwise = params( la_linrx_cwise_i ) .EQ. 0.0
519 END IF
520 END IF
521 IF ( ref_type .EQ. 0 .OR. n_err_bnds .EQ. 0 ) THEN
522 n_norms = 0
523 ELSE IF ( ignore_cwise ) THEN
524 n_norms = 1
525 ELSE
526 n_norms = 2
527 END IF
528*
529 notran = lsame( trans, 'N' )
530 rowequ = lsame( equed, 'R' ) .OR. lsame( equed, 'B' )
531 colequ = lsame( equed, 'C' ) .OR. lsame( equed, 'B' )
532*
533* Test input parameters.
534*
535 IF( trans_type.EQ.-1 ) THEN
536 info = -1
537 ELSE IF( .NOT.rowequ .AND. .NOT.colequ .AND.
538 $ .NOT.lsame( equed, 'N' ) ) THEN
539 info = -2
540 ELSE IF( n.LT.0 ) THEN
541 info = -3
542 ELSE IF( nrhs.LT.0 ) THEN
543 info = -4
544 ELSE IF( lda.LT.max( 1, n ) ) THEN
545 info = -6
546 ELSE IF( ldaf.LT.max( 1, n ) ) THEN
547 info = -8
548 ELSE IF( ldb.LT.max( 1, n ) ) THEN
549 info = -13
550 ELSE IF( ldx.LT.max( 1, n ) ) THEN
551 info = -15
552 END IF
553 IF( info.NE.0 ) THEN
554 CALL xerbla( 'SGERFSX', -info )
555 RETURN
556 END IF
557*
558* Quick return if possible.
559*
560 IF( n.EQ.0 .OR. nrhs.EQ.0 ) THEN
561 rcond = 1.0
562 DO j = 1, nrhs
563 berr( j ) = 0.0
564 IF ( n_err_bnds .GE. 1 ) THEN
565 err_bnds_norm( j, la_linrx_trust_i) = 1.0
566 err_bnds_comp( j, la_linrx_trust_i ) = 1.0
567 END IF
568 IF ( n_err_bnds .GE. 2 ) THEN
569 err_bnds_norm( j, la_linrx_err_i) = 0.0
570 err_bnds_comp( j, la_linrx_err_i ) = 0.0
571 END IF
572 IF ( n_err_bnds .GE. 3 ) THEN
573 err_bnds_norm( j, la_linrx_rcond_i) = 1.0
574 err_bnds_comp( j, la_linrx_rcond_i ) = 1.0
575 END IF
576 END DO
577 RETURN
578 END IF
579*
580* Default to failure.
581*
582 rcond = 0.0
583 DO j = 1, nrhs
584 berr( j ) = 1.0
585 IF ( n_err_bnds .GE. 1 ) THEN
586 err_bnds_norm( j, la_linrx_trust_i ) = 1.0
587 err_bnds_comp( j, la_linrx_trust_i ) = 1.0
588 END IF
589 IF ( n_err_bnds .GE. 2 ) THEN
590 err_bnds_norm( j, la_linrx_err_i ) = 1.0
591 err_bnds_comp( j, la_linrx_err_i ) = 1.0
592 END IF
593 IF ( n_err_bnds .GE. 3 ) THEN
594 err_bnds_norm( j, la_linrx_rcond_i ) = 0.0
595 err_bnds_comp( j, la_linrx_rcond_i ) = 0.0
596 END IF
597 END DO
598*
599* Compute the norm of A and the reciprocal of the condition
600* number of A.
601*
602 IF( notran ) THEN
603 norm = 'I'
604 ELSE
605 norm = '1'
606 END IF
607 anorm = slange( norm, n, n, a, lda, work )
608 CALL sgecon( norm, n, af, ldaf, anorm, rcond, work, iwork,
609 $ info )
610*
611* Perform refinement on each right-hand side
612*
613 IF ( ref_type .NE. 0 ) THEN
614
615 prec_type = ilaprec( 'D' )
616
617 IF ( notran ) THEN
618 CALL sla_gerfsx_extended( prec_type, trans_type, n,
619 $ nrhs, a, lda, af, ldaf, ipiv, colequ, c, b,
620 $ ldb, x, ldx, berr, n_norms, err_bnds_norm,
621 $ err_bnds_comp, work(n+1), work(1), work(2*n+1),
622 $ work(1), rcond, ithresh, rthresh, unstable_thresh,
623 $ ignore_cwise, info )
624 ELSE
625 CALL sla_gerfsx_extended( prec_type, trans_type, n,
626 $ nrhs, a, lda, af, ldaf, ipiv, rowequ, r, b,
627 $ ldb, x, ldx, berr, n_norms, err_bnds_norm,
628 $ err_bnds_comp, work(n+1), work(1), work(2*n+1),
629 $ work(1), rcond, ithresh, rthresh, unstable_thresh,
630 $ ignore_cwise, info )
631 END IF
632 END IF
633
634 err_lbnd = max( 10.0, sqrt( real( n ) ) ) * slamch( 'Epsilon' )
635 IF ( n_err_bnds .GE. 1 .AND. n_norms .GE. 1 ) THEN
636*
637* Compute scaled normwise condition number cond(A*C).
638*
639 IF ( colequ .AND. notran ) THEN
640 rcond_tmp = sla_gercond( trans, n, a, lda, af, ldaf,
641 $ ipiv,
642 $ -1, c, info, work, iwork )
643 ELSE IF ( rowequ .AND. .NOT. notran ) THEN
644 rcond_tmp = sla_gercond( trans, n, a, lda, af, ldaf,
645 $ ipiv,
646 $ -1, r, info, work, iwork )
647 ELSE
648 rcond_tmp = sla_gercond( trans, n, a, lda, af, ldaf,
649 $ ipiv,
650 $ 0, r, info, work, iwork )
651 END IF
652 DO j = 1, nrhs
653*
654* Cap the error at 1.0.
655*
656 IF ( n_err_bnds .GE. la_linrx_err_i
657 $ .AND. err_bnds_norm( j, la_linrx_err_i ) .GT. 1.0 )
658 $ err_bnds_norm( j, la_linrx_err_i ) = 1.0
659*
660* Threshold the error (see LAWN).
661*
662 IF ( rcond_tmp .LT. illrcond_thresh ) THEN
663 err_bnds_norm( j, la_linrx_err_i ) = 1.0
664 err_bnds_norm( j, la_linrx_trust_i ) = 0.0
665 IF ( info .LE. n ) info = n + j
666 ELSE IF ( err_bnds_norm( j, la_linrx_err_i ) .LT. err_lbnd )
667 $ THEN
668 err_bnds_norm( j, la_linrx_err_i ) = err_lbnd
669 err_bnds_norm( j, la_linrx_trust_i ) = 1.0
670 END IF
671*
672* Save the condition number.
673*
674 IF ( n_err_bnds .GE. la_linrx_rcond_i ) THEN
675 err_bnds_norm( j, la_linrx_rcond_i ) = rcond_tmp
676 END IF
677 END DO
678 END IF
679
680 IF ( n_err_bnds .GE. 1 .AND. n_norms .GE. 2 ) THEN
681*
682* Compute componentwise condition number cond(A*diag(Y(:,J))) for
683* each right-hand side using the current solution as an estimate of
684* the true solution. If the componentwise error estimate is too
685* large, then the solution is a lousy estimate of truth and the
686* estimated RCOND may be too optimistic. To avoid misleading users,
687* the inverse condition number is set to 0.0 when the estimated
688* cwise error is at least CWISE_WRONG.
689*
690 cwise_wrong = sqrt( slamch( 'Epsilon' ) )
691 DO j = 1, nrhs
692 IF ( err_bnds_comp( j, la_linrx_err_i ) .LT. cwise_wrong )
693 $ THEN
694 rcond_tmp = sla_gercond( trans, n, a, lda, af, ldaf,
695 $ ipiv, 1, x(1,j), info, work, iwork )
696 ELSE
697 rcond_tmp = 0.0
698 END IF
699*
700* Cap the error at 1.0.
701*
702 IF ( n_err_bnds .GE. la_linrx_err_i
703 $ .AND. err_bnds_comp( j, la_linrx_err_i ) .GT. 1.0 )
704 $ err_bnds_comp( j, la_linrx_err_i ) = 1.0
705*
706* Threshold the error (see LAWN).
707*
708 IF ( rcond_tmp .LT. illrcond_thresh ) THEN
709 err_bnds_comp( j, la_linrx_err_i ) = 1.0
710 err_bnds_comp( j, la_linrx_trust_i ) = 0.0
711 IF ( params( la_linrx_cwise_i ) .EQ. 1.0
712 $ .AND. info.LT.n + j ) info = n + j
713 ELSE IF ( err_bnds_comp( j, la_linrx_err_i )
714 $ .LT. err_lbnd ) THEN
715 err_bnds_comp( j, la_linrx_err_i ) = err_lbnd
716 err_bnds_comp( j, la_linrx_trust_i ) = 1.0
717 END IF
718*
719* Save the condition number.
720*
721 IF ( n_err_bnds .GE. la_linrx_rcond_i ) THEN
722 err_bnds_comp( j, la_linrx_rcond_i ) = rcond_tmp
723 END IF
724 END DO
725 END IF
726*
727 RETURN
728*
729* End of SGERFSX
730*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine sgecon(norm, n, a, lda, anorm, rcond, work, iwork, info)
SGECON
Definition sgecon.f:130
integer function ilaprec(prec)
ILAPREC
Definition ilaprec.f:56
integer function ilatrans(trans)
ILATRANS
Definition ilatrans.f:56
real function sla_gercond(trans, n, a, lda, af, ldaf, ipiv, cmode, c, info, work, iwork)
SLA_GERCOND estimates the Skeel condition number for a general matrix.
subroutine sla_gerfsx_extended(prec_type, trans_type, n, nrhs, a, lda, af, ldaf, ipiv, colequ, c, b, ldb, y, ldy, berr_out, n_norms, errs_n, errs_c, res, ayb, dy, y_tail, rcond, ithresh, rthresh, dz_ub, ignore_cwise, info)
SLA_GERFSX_EXTENDED improves the computed solution to a system of linear equations for general matric...
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
real function slange(norm, m, n, a, lda, work)
SLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition slange.f:112
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: