File:  [local] / rpl / lapack / lapack / dla_gbrfsx_extended.f
Revision 1.17: download - view: text, annotated - select for diffs - revision graph
Mon Aug 7 08:38:52 2023 UTC (8 months, 3 weeks ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_35, rpl-4_1_34, HEAD
Première mise à jour de lapack et blas.

    1: *> \brief \b DLA_GBRFSX_EXTENDED improves the computed solution to a system of linear equations for general banded matrices by performing extra-precise iterative refinement and provides error bounds and backward error estimates for the solution.
    2: *
    3: *  =========== DOCUMENTATION ===========
    4: *
    5: * Online html documentation available at
    6: *            http://www.netlib.org/lapack/explore-html/
    7: *
    8: *> \htmlonly
    9: *> Download DLA_GBRFSX_EXTENDED + dependencies
   10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dla_gbrfsx_extended.f">
   11: *> [TGZ]</a>
   12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dla_gbrfsx_extended.f">
   13: *> [ZIP]</a>
   14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dla_gbrfsx_extended.f">
   15: *> [TXT]</a>
   16: *> \endhtmlonly
   17: *
   18: *  Definition:
   19: *  ===========
   20: *
   21: *       SUBROUTINE DLA_GBRFSX_EXTENDED( PREC_TYPE, TRANS_TYPE, N, KL, KU,
   22: *                                       NRHS, AB, LDAB, AFB, LDAFB, IPIV,
   23: *                                       COLEQU, C, B, LDB, Y, LDY,
   24: *                                       BERR_OUT, N_NORMS, ERR_BNDS_NORM,
   25: *                                       ERR_BNDS_COMP, RES, AYB, DY,
   26: *                                       Y_TAIL, RCOND, ITHRESH, RTHRESH,
   27: *                                       DZ_UB, IGNORE_CWISE, INFO )
   28: *
   29: *       .. Scalar Arguments ..
   30: *       INTEGER            INFO, LDAB, LDAFB, LDB, LDY, N, KL, KU, NRHS,
   31: *      $                   PREC_TYPE, TRANS_TYPE, N_NORMS, ITHRESH
   32: *       LOGICAL            COLEQU, IGNORE_CWISE
   33: *       DOUBLE PRECISION   RTHRESH, DZ_UB
   34: *       ..
   35: *       .. Array Arguments ..
   36: *       INTEGER            IPIV( * )
   37: *       DOUBLE PRECISION   AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
   38: *      $                   Y( LDY, * ), RES(*), DY(*), Y_TAIL(*)
   39: *       DOUBLE PRECISION   C( * ), AYB(*), RCOND, BERR_OUT(*),
   40: *      $                   ERR_BNDS_NORM( NRHS, * ),
   41: *      $                   ERR_BNDS_COMP( NRHS, * )
   42: *       ..
   43: *
   44: *
   45: *> \par Purpose:
   46: *  =============
   47: *>
   48: *> \verbatim
   49: *>
   50: *>
   51: *> DLA_GBRFSX_EXTENDED improves the computed solution to a system of
   52: *> linear equations by performing extra-precise iterative refinement
   53: *> and provides error bounds and backward error estimates for the solution.
   54: *> This subroutine is called by DGBRFSX to perform iterative refinement.
   55: *> In addition to normwise error bound, the code provides maximum
   56: *> componentwise error bound if possible. See comments for ERR_BNDS_NORM
   57: *> and ERR_BNDS_COMP for details of the error bounds. Note that this
   58: *> subroutine is only responsible for setting the second fields of
   59: *> ERR_BNDS_NORM and ERR_BNDS_COMP.
   60: *> \endverbatim
   61: *
   62: *  Arguments:
   63: *  ==========
   64: *
   65: *> \param[in] PREC_TYPE
   66: *> \verbatim
   67: *>          PREC_TYPE is INTEGER
   68: *>     Specifies the intermediate precision to be used in refinement.
   69: *>     The value is defined by ILAPREC(P) where P is a CHARACTER and P
   70: *>          = 'S':  Single
   71: *>          = 'D':  Double
   72: *>          = 'I':  Indigenous
   73: *>          = 'X' or 'E':  Extra
   74: *> \endverbatim
   75: *>
   76: *> \param[in] TRANS_TYPE
   77: *> \verbatim
   78: *>          TRANS_TYPE is INTEGER
   79: *>     Specifies the transposition operation on A.
   80: *>     The value is defined by ILATRANS(T) where T is a CHARACTER and T
   81: *>          = 'N':  No transpose
   82: *>          = 'T':  Transpose
   83: *>          = 'C':  Conjugate transpose
   84: *> \endverbatim
   85: *>
   86: *> \param[in] N
   87: *> \verbatim
   88: *>          N is INTEGER
   89: *>     The number of linear equations, i.e., the order of the
   90: *>     matrix A.  N >= 0.
   91: *> \endverbatim
   92: *>
   93: *> \param[in] KL
   94: *> \verbatim
   95: *>          KL is INTEGER
   96: *>     The number of subdiagonals within the band of A.  KL >= 0.
   97: *> \endverbatim
   98: *>
   99: *> \param[in] KU
  100: *> \verbatim
  101: *>          KU is INTEGER
  102: *>     The number of superdiagonals within the band of A.  KU >= 0
  103: *> \endverbatim
  104: *>
  105: *> \param[in] NRHS
  106: *> \verbatim
  107: *>          NRHS is INTEGER
  108: *>     The number of right-hand-sides, i.e., the number of columns of the
  109: *>     matrix B.
  110: *> \endverbatim
  111: *>
  112: *> \param[in] AB
  113: *> \verbatim
  114: *>          AB is DOUBLE PRECISION array, dimension (LDAB,N)
  115: *>          On entry, the N-by-N matrix AB.
  116: *> \endverbatim
  117: *>
  118: *> \param[in] LDAB
  119: *> \verbatim
  120: *>          LDAB is INTEGER
  121: *>          The leading dimension of the array AB.  LDBA >= max(1,N).
  122: *> \endverbatim
  123: *>
  124: *> \param[in] AFB
  125: *> \verbatim
  126: *>          AFB is DOUBLE PRECISION array, dimension (LDAFB,N)
  127: *>     The factors L and U from the factorization
  128: *>     A = P*L*U as computed by DGBTRF.
  129: *> \endverbatim
  130: *>
  131: *> \param[in] LDAFB
  132: *> \verbatim
  133: *>          LDAFB is INTEGER
  134: *>     The leading dimension of the array AF.  LDAFB >= max(1,N).
  135: *> \endverbatim
  136: *>
  137: *> \param[in] IPIV
  138: *> \verbatim
  139: *>          IPIV is INTEGER array, dimension (N)
  140: *>     The pivot indices from the factorization A = P*L*U
  141: *>     as computed by DGBTRF; row i of the matrix was interchanged
  142: *>     with row IPIV(i).
  143: *> \endverbatim
  144: *>
  145: *> \param[in] COLEQU
  146: *> \verbatim
  147: *>          COLEQU is LOGICAL
  148: *>     If .TRUE. then column equilibration was done to A before calling
  149: *>     this routine. This is needed to compute the solution and error
  150: *>     bounds correctly.
  151: *> \endverbatim
  152: *>
  153: *> \param[in] C
  154: *> \verbatim
  155: *>          C is DOUBLE PRECISION array, dimension (N)
  156: *>     The column scale factors for A. If COLEQU = .FALSE., C
  157: *>     is not accessed. If C is input, each element of C should be a power
  158: *>     of the radix to ensure a reliable solution and error estimates.
  159: *>     Scaling by powers of the radix does not cause rounding errors unless
  160: *>     the result underflows or overflows. Rounding errors during scaling
  161: *>     lead to refining with a matrix that is not equivalent to the
  162: *>     input matrix, producing error estimates that may not be
  163: *>     reliable.
  164: *> \endverbatim
  165: *>
  166: *> \param[in] B
  167: *> \verbatim
  168: *>          B is DOUBLE PRECISION array, dimension (LDB,NRHS)
  169: *>     The right-hand-side matrix B.
  170: *> \endverbatim
  171: *>
  172: *> \param[in] LDB
  173: *> \verbatim
  174: *>          LDB is INTEGER
  175: *>     The leading dimension of the array B.  LDB >= max(1,N).
  176: *> \endverbatim
  177: *>
  178: *> \param[in,out] Y
  179: *> \verbatim
  180: *>          Y is DOUBLE PRECISION array, dimension (LDY,NRHS)
  181: *>     On entry, the solution matrix X, as computed by DGBTRS.
  182: *>     On exit, the improved solution matrix Y.
  183: *> \endverbatim
  184: *>
  185: *> \param[in] LDY
  186: *> \verbatim
  187: *>          LDY is INTEGER
  188: *>     The leading dimension of the array Y.  LDY >= max(1,N).
  189: *> \endverbatim
  190: *>
  191: *> \param[out] BERR_OUT
  192: *> \verbatim
  193: *>          BERR_OUT is DOUBLE PRECISION array, dimension (NRHS)
  194: *>     On exit, BERR_OUT(j) contains the componentwise relative backward
  195: *>     error for right-hand-side j from the formula
  196: *>         max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
  197: *>     where abs(Z) is the componentwise absolute value of the matrix
  198: *>     or vector Z. This is computed by DLA_LIN_BERR.
  199: *> \endverbatim
  200: *>
  201: *> \param[in] N_NORMS
  202: *> \verbatim
  203: *>          N_NORMS is INTEGER
  204: *>     Determines which error bounds to return (see ERR_BNDS_NORM
  205: *>     and ERR_BNDS_COMP).
  206: *>     If N_NORMS >= 1 return normwise error bounds.
  207: *>     If N_NORMS >= 2 return componentwise error bounds.
  208: *> \endverbatim
  209: *>
  210: *> \param[in,out] ERR_BNDS_NORM
  211: *> \verbatim
  212: *>          ERR_BNDS_NORM is DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
  213: *>     For each right-hand side, this array contains information about
  214: *>     various error bounds and condition numbers corresponding to the
  215: *>     normwise relative error, which is defined as follows:
  216: *>
  217: *>     Normwise relative error in the ith solution vector:
  218: *>             max_j (abs(XTRUE(j,i) - X(j,i)))
  219: *>            ------------------------------
  220: *>                  max_j abs(X(j,i))
  221: *>
  222: *>     The array is indexed by the type of error information as described
  223: *>     below. There currently are up to three pieces of information
  224: *>     returned.
  225: *>
  226: *>     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
  227: *>     right-hand side.
  228: *>
  229: *>     The second index in ERR_BNDS_NORM(:,err) contains the following
  230: *>     three fields:
  231: *>     err = 1 "Trust/don't trust" boolean. Trust the answer if the
  232: *>              reciprocal condition number is less than the threshold
  233: *>              sqrt(n) * slamch('Epsilon').
  234: *>
  235: *>     err = 2 "Guaranteed" error bound: The estimated forward error,
  236: *>              almost certainly within a factor of 10 of the true error
  237: *>              so long as the next entry is greater than the threshold
  238: *>              sqrt(n) * slamch('Epsilon'). This error bound should only
  239: *>              be trusted if the previous boolean is true.
  240: *>
  241: *>     err = 3  Reciprocal condition number: Estimated normwise
  242: *>              reciprocal condition number.  Compared with the threshold
  243: *>              sqrt(n) * slamch('Epsilon') to determine if the error
  244: *>              estimate is "guaranteed". These reciprocal condition
  245: *>              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
  246: *>              appropriately scaled matrix Z.
  247: *>              Let Z = S*A, where S scales each row by a power of the
  248: *>              radix so all absolute row sums of Z are approximately 1.
  249: *>
  250: *>     This subroutine is only responsible for setting the second field
  251: *>     above.
  252: *>     See Lapack Working Note 165 for further details and extra
  253: *>     cautions.
  254: *> \endverbatim
  255: *>
  256: *> \param[in,out] ERR_BNDS_COMP
  257: *> \verbatim
  258: *>          ERR_BNDS_COMP is DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
  259: *>     For each right-hand side, this array contains information about
  260: *>     various error bounds and condition numbers corresponding to the
  261: *>     componentwise relative error, which is defined as follows:
  262: *>
  263: *>     Componentwise relative error in the ith solution vector:
  264: *>                    abs(XTRUE(j,i) - X(j,i))
  265: *>             max_j ----------------------
  266: *>                         abs(X(j,i))
  267: *>
  268: *>     The array is indexed by the right-hand side i (on which the
  269: *>     componentwise relative error depends), and the type of error
  270: *>     information as described below. There currently are up to three
  271: *>     pieces of information returned for each right-hand side. If
  272: *>     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
  273: *>     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS < 3, then at most
  274: *>     the first (:,N_ERR_BNDS) entries are returned.
  275: *>
  276: *>     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
  277: *>     right-hand side.
  278: *>
  279: *>     The second index in ERR_BNDS_COMP(:,err) contains the following
  280: *>     three fields:
  281: *>     err = 1 "Trust/don't trust" boolean. Trust the answer if the
  282: *>              reciprocal condition number is less than the threshold
  283: *>              sqrt(n) * slamch('Epsilon').
  284: *>
  285: *>     err = 2 "Guaranteed" error bound: The estimated forward error,
  286: *>              almost certainly within a factor of 10 of the true error
  287: *>              so long as the next entry is greater than the threshold
  288: *>              sqrt(n) * slamch('Epsilon'). This error bound should only
  289: *>              be trusted if the previous boolean is true.
  290: *>
  291: *>     err = 3  Reciprocal condition number: Estimated componentwise
  292: *>              reciprocal condition number.  Compared with the threshold
  293: *>              sqrt(n) * slamch('Epsilon') to determine if the error
  294: *>              estimate is "guaranteed". These reciprocal condition
  295: *>              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
  296: *>              appropriately scaled matrix Z.
  297: *>              Let Z = S*(A*diag(x)), where x is the solution for the
  298: *>              current right-hand side and S scales each row of
  299: *>              A*diag(x) by a power of the radix so all absolute row
  300: *>              sums of Z are approximately 1.
  301: *>
  302: *>     This subroutine is only responsible for setting the second field
  303: *>     above.
  304: *>     See Lapack Working Note 165 for further details and extra
  305: *>     cautions.
  306: *> \endverbatim
  307: *>
  308: *> \param[in] RES
  309: *> \verbatim
  310: *>          RES is DOUBLE PRECISION array, dimension (N)
  311: *>     Workspace to hold the intermediate residual.
  312: *> \endverbatim
  313: *>
  314: *> \param[in] AYB
  315: *> \verbatim
  316: *>          AYB is DOUBLE PRECISION array, dimension (N)
  317: *>     Workspace. This can be the same workspace passed for Y_TAIL.
  318: *> \endverbatim
  319: *>
  320: *> \param[in] DY
  321: *> \verbatim
  322: *>          DY is DOUBLE PRECISION array, dimension (N)
  323: *>     Workspace to hold the intermediate solution.
  324: *> \endverbatim
  325: *>
  326: *> \param[in] Y_TAIL
  327: *> \verbatim
  328: *>          Y_TAIL is DOUBLE PRECISION array, dimension (N)
  329: *>     Workspace to hold the trailing bits of the intermediate solution.
  330: *> \endverbatim
  331: *>
  332: *> \param[in] RCOND
  333: *> \verbatim
  334: *>          RCOND is DOUBLE PRECISION
  335: *>     Reciprocal scaled condition number.  This is an estimate of the
  336: *>     reciprocal Skeel condition number of the matrix A after
  337: *>     equilibration (if done).  If this is less than the machine
  338: *>     precision (in particular, if it is zero), the matrix is singular
  339: *>     to working precision.  Note that the error may still be small even
  340: *>     if this number is very small and the matrix appears ill-
  341: *>     conditioned.
  342: *> \endverbatim
  343: *>
  344: *> \param[in] ITHRESH
  345: *> \verbatim
  346: *>          ITHRESH is INTEGER
  347: *>     The maximum number of residual computations allowed for
  348: *>     refinement. The default is 10. For 'aggressive' set to 100 to
  349: *>     permit convergence using approximate factorizations or
  350: *>     factorizations other than LU. If the factorization uses a
  351: *>     technique other than Gaussian elimination, the guarantees in
  352: *>     ERR_BNDS_NORM and ERR_BNDS_COMP may no longer be trustworthy.
  353: *> \endverbatim
  354: *>
  355: *> \param[in] RTHRESH
  356: *> \verbatim
  357: *>          RTHRESH is DOUBLE PRECISION
  358: *>     Determines when to stop refinement if the error estimate stops
  359: *>     decreasing. Refinement will stop when the next solution no longer
  360: *>     satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
  361: *>     the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
  362: *>     default value is 0.5. For 'aggressive' set to 0.9 to permit
  363: *>     convergence on extremely ill-conditioned matrices. See LAWN 165
  364: *>     for more details.
  365: *> \endverbatim
  366: *>
  367: *> \param[in] DZ_UB
  368: *> \verbatim
  369: *>          DZ_UB is DOUBLE PRECISION
  370: *>     Determines when to start considering componentwise convergence.
  371: *>     Componentwise convergence is only considered after each component
  372: *>     of the solution Y is stable, which we define as the relative
  373: *>     change in each component being less than DZ_UB. The default value
  374: *>     is 0.25, requiring the first bit to be stable. See LAWN 165 for
  375: *>     more details.
  376: *> \endverbatim
  377: *>
  378: *> \param[in] IGNORE_CWISE
  379: *> \verbatim
  380: *>          IGNORE_CWISE is LOGICAL
  381: *>     If .TRUE. then ignore componentwise convergence. Default value
  382: *>     is .FALSE..
  383: *> \endverbatim
  384: *>
  385: *> \param[out] INFO
  386: *> \verbatim
  387: *>          INFO is INTEGER
  388: *>       = 0:  Successful exit.
  389: *>       < 0:  if INFO = -i, the ith argument to DGBTRS had an illegal
  390: *>             value
  391: *> \endverbatim
  392: *
  393: *  Authors:
  394: *  ========
  395: *
  396: *> \author Univ. of Tennessee
  397: *> \author Univ. of California Berkeley
  398: *> \author Univ. of Colorado Denver
  399: *> \author NAG Ltd.
  400: *
  401: *> \ingroup doubleGBcomputational
  402: *
  403: *  =====================================================================
  404:       SUBROUTINE DLA_GBRFSX_EXTENDED( PREC_TYPE, TRANS_TYPE, N, KL, KU,
  405:      $                                NRHS, AB, LDAB, AFB, LDAFB, IPIV,
  406:      $                                COLEQU, C, B, LDB, Y, LDY,
  407:      $                                BERR_OUT, N_NORMS, ERR_BNDS_NORM,
  408:      $                                ERR_BNDS_COMP, RES, AYB, DY,
  409:      $                                Y_TAIL, RCOND, ITHRESH, RTHRESH,
  410:      $                                DZ_UB, IGNORE_CWISE, INFO )
  411: *
  412: *  -- LAPACK computational routine --
  413: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
  414: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  415: *
  416: *     .. Scalar Arguments ..
  417:       INTEGER            INFO, LDAB, LDAFB, LDB, LDY, N, KL, KU, NRHS,
  418:      $                   PREC_TYPE, TRANS_TYPE, N_NORMS, ITHRESH
  419:       LOGICAL            COLEQU, IGNORE_CWISE
  420:       DOUBLE PRECISION   RTHRESH, DZ_UB
  421: *     ..
  422: *     .. Array Arguments ..
  423:       INTEGER            IPIV( * )
  424:       DOUBLE PRECISION   AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
  425:      $                   Y( LDY, * ), RES(*), DY(*), Y_TAIL(*)
  426:       DOUBLE PRECISION   C( * ), AYB(*), RCOND, BERR_OUT(*),
  427:      $                   ERR_BNDS_NORM( NRHS, * ),
  428:      $                   ERR_BNDS_COMP( NRHS, * )
  429: *     ..
  430: *
  431: *  =====================================================================
  432: *
  433: *     .. Local Scalars ..
  434:       CHARACTER          TRANS
  435:       INTEGER            CNT, I, J, M, X_STATE, Z_STATE, Y_PREC_STATE
  436:       DOUBLE PRECISION   YK, DYK, YMIN, NORMY, NORMX, NORMDX, DXRAT,
  437:      $                   DZRAT, PREVNORMDX, PREV_DZ_Z, DXRATMAX,
  438:      $                   DZRATMAX, DX_X, DZ_Z, FINAL_DX_X, FINAL_DZ_Z,
  439:      $                   EPS, HUGEVAL, INCR_THRESH
  440:       LOGICAL            INCR_PREC
  441: *     ..
  442: *     .. Parameters ..
  443:       INTEGER            UNSTABLE_STATE, WORKING_STATE, CONV_STATE,
  444:      $                   NOPROG_STATE, BASE_RESIDUAL, EXTRA_RESIDUAL,
  445:      $                   EXTRA_Y
  446:       PARAMETER          ( UNSTABLE_STATE = 0, WORKING_STATE = 1,
  447:      $                   CONV_STATE = 2, NOPROG_STATE = 3 )
  448:       PARAMETER          ( BASE_RESIDUAL = 0, EXTRA_RESIDUAL = 1,
  449:      $                   EXTRA_Y = 2 )
  450:       INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
  451:       INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
  452:       INTEGER            CMP_ERR_I, PIV_GROWTH_I
  453:       PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
  454:      $                   BERR_I = 3 )
  455:       PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
  456:       PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
  457:      $                   PIV_GROWTH_I = 9 )
  458:       INTEGER            LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
  459:      $                   LA_LINRX_CWISE_I
  460:       PARAMETER          ( LA_LINRX_ITREF_I = 1,
  461:      $                   LA_LINRX_ITHRESH_I = 2 )
  462:       PARAMETER          ( LA_LINRX_CWISE_I = 3 )
  463:       INTEGER            LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
  464:      $                   LA_LINRX_RCOND_I
  465:       PARAMETER          ( LA_LINRX_TRUST_I = 1, LA_LINRX_ERR_I = 2 )
  466:       PARAMETER          ( LA_LINRX_RCOND_I = 3 )
  467: *     ..
  468: *     .. External Subroutines ..
  469:       EXTERNAL           DAXPY, DCOPY, DGBTRS, DGBMV, BLAS_DGBMV_X,
  470:      $                   BLAS_DGBMV2_X, DLA_GBAMV, DLA_WWADDW, DLAMCH,
  471:      $                   CHLA_TRANSTYPE, DLA_LIN_BERR
  472:       DOUBLE PRECISION   DLAMCH
  473:       CHARACTER          CHLA_TRANSTYPE
  474: *     ..
  475: *     .. Intrinsic Functions ..
  476:       INTRINSIC          ABS, MAX, MIN
  477: *     ..
  478: *     .. Executable Statements ..
  479: *
  480:       IF (INFO.NE.0) RETURN
  481:       TRANS = CHLA_TRANSTYPE(TRANS_TYPE)
  482:       EPS = DLAMCH( 'Epsilon' )
  483:       HUGEVAL = DLAMCH( 'Overflow' )
  484: *     Force HUGEVAL to Inf
  485:       HUGEVAL = HUGEVAL * HUGEVAL
  486: *     Using HUGEVAL may lead to spurious underflows.
  487:       INCR_THRESH = DBLE( N ) * EPS
  488:       M = KL+KU+1
  489: 
  490:       DO J = 1, NRHS
  491:          Y_PREC_STATE = EXTRA_RESIDUAL
  492:          IF ( Y_PREC_STATE .EQ. EXTRA_Y ) THEN
  493:             DO I = 1, N
  494:                Y_TAIL( I ) = 0.0D+0
  495:             END DO
  496:          END IF
  497: 
  498:          DXRAT = 0.0D+0
  499:          DXRATMAX = 0.0D+0
  500:          DZRAT = 0.0D+0
  501:          DZRATMAX = 0.0D+0
  502:          FINAL_DX_X = HUGEVAL
  503:          FINAL_DZ_Z = HUGEVAL
  504:          PREVNORMDX = HUGEVAL
  505:          PREV_DZ_Z = HUGEVAL
  506:          DZ_Z = HUGEVAL
  507:          DX_X = HUGEVAL
  508: 
  509:          X_STATE = WORKING_STATE
  510:          Z_STATE = UNSTABLE_STATE
  511:          INCR_PREC = .FALSE.
  512: 
  513:          DO CNT = 1, ITHRESH
  514: *
  515: *        Compute residual RES = B_s - op(A_s) * Y,
  516: *            op(A) = A, A**T, or A**H depending on TRANS (and type).
  517: *
  518:             CALL DCOPY( N, B( 1, J ), 1, RES, 1 )
  519:             IF ( Y_PREC_STATE .EQ. BASE_RESIDUAL ) THEN
  520:                CALL DGBMV( TRANS, M, N, KL, KU, -1.0D+0, AB, LDAB,
  521:      $              Y( 1, J ), 1, 1.0D+0, RES, 1 )
  522:             ELSE IF ( Y_PREC_STATE .EQ. EXTRA_RESIDUAL ) THEN
  523:                CALL BLAS_DGBMV_X( TRANS_TYPE, N, N, KL, KU,
  524:      $              -1.0D+0, AB, LDAB, Y( 1, J ), 1, 1.0D+0, RES, 1,
  525:      $              PREC_TYPE )
  526:             ELSE
  527:                CALL BLAS_DGBMV2_X( TRANS_TYPE, N, N, KL, KU, -1.0D+0,
  528:      $              AB, LDAB, Y( 1, J ), Y_TAIL, 1, 1.0D+0, RES, 1,
  529:      $              PREC_TYPE )
  530:             END IF
  531: 
  532: !        XXX: RES is no longer needed.
  533:             CALL DCOPY( N, RES, 1, DY, 1 )
  534:             CALL DGBTRS( TRANS, N, KL, KU, 1, AFB, LDAFB, IPIV, DY, N,
  535:      $           INFO )
  536: *
  537: *         Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT.
  538: *
  539:             NORMX = 0.0D+0
  540:             NORMY = 0.0D+0
  541:             NORMDX = 0.0D+0
  542:             DZ_Z = 0.0D+0
  543:             YMIN = HUGEVAL
  544: 
  545:             DO I = 1, N
  546:                YK = ABS( Y( I, J ) )
  547:                DYK = ABS( DY( I ) )
  548: 
  549:                IF ( YK .NE. 0.0D+0 ) THEN
  550:                   DZ_Z = MAX( DZ_Z, DYK / YK )
  551:                ELSE IF ( DYK .NE. 0.0D+0 ) THEN
  552:                   DZ_Z = HUGEVAL
  553:                END IF
  554: 
  555:                YMIN = MIN( YMIN, YK )
  556: 
  557:                NORMY = MAX( NORMY, YK )
  558: 
  559:                IF ( COLEQU ) THEN
  560:                   NORMX = MAX( NORMX, YK * C( I ) )
  561:                   NORMDX = MAX( NORMDX, DYK * C( I ) )
  562:                ELSE
  563:                   NORMX = NORMY
  564:                   NORMDX = MAX( NORMDX, DYK )
  565:                END IF
  566:             END DO
  567: 
  568:             IF ( NORMX .NE. 0.0D+0 ) THEN
  569:                DX_X = NORMDX / NORMX
  570:             ELSE IF ( NORMDX .EQ. 0.0D+0 ) THEN
  571:                DX_X = 0.0D+0
  572:             ELSE
  573:                DX_X = HUGEVAL
  574:             END IF
  575: 
  576:             DXRAT = NORMDX / PREVNORMDX
  577:             DZRAT = DZ_Z / PREV_DZ_Z
  578: *
  579: *         Check termination criteria.
  580: *
  581:             IF ( .NOT.IGNORE_CWISE
  582:      $           .AND. YMIN*RCOND .LT. INCR_THRESH*NORMY
  583:      $           .AND. Y_PREC_STATE .LT. EXTRA_Y )
  584:      $           INCR_PREC = .TRUE.
  585: 
  586:             IF ( X_STATE .EQ. NOPROG_STATE .AND. DXRAT .LE. RTHRESH )
  587:      $           X_STATE = WORKING_STATE
  588:             IF ( X_STATE .EQ. WORKING_STATE ) THEN
  589:                IF ( DX_X .LE. EPS ) THEN
  590:                   X_STATE = CONV_STATE
  591:                ELSE IF ( DXRAT .GT. RTHRESH ) THEN
  592:                   IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN
  593:                      INCR_PREC = .TRUE.
  594:                   ELSE
  595:                      X_STATE = NOPROG_STATE
  596:                   END IF
  597:                ELSE
  598:                   IF ( DXRAT .GT. DXRATMAX ) DXRATMAX = DXRAT
  599:                END IF
  600:                IF ( X_STATE .GT. WORKING_STATE ) FINAL_DX_X = DX_X
  601:             END IF
  602: 
  603:             IF ( Z_STATE .EQ. UNSTABLE_STATE .AND. DZ_Z .LE. DZ_UB )
  604:      $           Z_STATE = WORKING_STATE
  605:             IF ( Z_STATE .EQ. NOPROG_STATE .AND. DZRAT .LE. RTHRESH )
  606:      $           Z_STATE = WORKING_STATE
  607:             IF ( Z_STATE .EQ. WORKING_STATE ) THEN
  608:                IF ( DZ_Z .LE. EPS ) THEN
  609:                   Z_STATE = CONV_STATE
  610:                ELSE IF ( DZ_Z .GT. DZ_UB ) THEN
  611:                   Z_STATE = UNSTABLE_STATE
  612:                   DZRATMAX = 0.0D+0
  613:                   FINAL_DZ_Z = HUGEVAL
  614:                ELSE IF ( DZRAT .GT. RTHRESH ) THEN
  615:                   IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN
  616:                      INCR_PREC = .TRUE.
  617:                   ELSE
  618:                      Z_STATE = NOPROG_STATE
  619:                   END IF
  620:                ELSE
  621:                   IF ( DZRAT .GT. DZRATMAX ) DZRATMAX = DZRAT
  622:                END IF
  623:                IF ( Z_STATE .GT. WORKING_STATE ) FINAL_DZ_Z = DZ_Z
  624:             END IF
  625: *
  626: *           Exit if both normwise and componentwise stopped working,
  627: *           but if componentwise is unstable, let it go at least two
  628: *           iterations.
  629: *
  630:             IF ( X_STATE.NE.WORKING_STATE ) THEN
  631:                IF ( IGNORE_CWISE ) GOTO 666
  632:                IF ( Z_STATE.EQ.NOPROG_STATE .OR. Z_STATE.EQ.CONV_STATE )
  633:      $              GOTO 666
  634:                IF ( Z_STATE.EQ.UNSTABLE_STATE .AND. CNT.GT.1 ) GOTO 666
  635:             END IF
  636: 
  637:             IF ( INCR_PREC ) THEN
  638:                INCR_PREC = .FALSE.
  639:                Y_PREC_STATE = Y_PREC_STATE + 1
  640:                DO I = 1, N
  641:                   Y_TAIL( I ) = 0.0D+0
  642:                END DO
  643:             END IF
  644: 
  645:             PREVNORMDX = NORMDX
  646:             PREV_DZ_Z = DZ_Z
  647: *
  648: *           Update soluton.
  649: *
  650:             IF (Y_PREC_STATE .LT. EXTRA_Y) THEN
  651:                CALL DAXPY( N, 1.0D+0, DY, 1, Y(1,J), 1 )
  652:             ELSE
  653:                CALL DLA_WWADDW( N, Y(1,J), Y_TAIL, DY )
  654:             END IF
  655: 
  656:          END DO
  657: *        Target of "IF (Z_STOP .AND. X_STOP)".  Sun's f77 won't EXIT.
  658:  666     CONTINUE
  659: *
  660: *     Set final_* when cnt hits ithresh.
  661: *
  662:          IF ( X_STATE .EQ. WORKING_STATE ) FINAL_DX_X = DX_X
  663:          IF ( Z_STATE .EQ. WORKING_STATE ) FINAL_DZ_Z = DZ_Z
  664: *
  665: *     Compute error bounds.
  666: *
  667:          IF ( N_NORMS .GE. 1 ) THEN
  668:             ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
  669:      $           FINAL_DX_X / (1 - DXRATMAX)
  670:          END IF
  671:          IF (N_NORMS .GE. 2) THEN
  672:             ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
  673:      $           FINAL_DZ_Z / (1 - DZRATMAX)
  674:          END IF
  675: *
  676: *     Compute componentwise relative backward error from formula
  677: *         max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
  678: *     where abs(Z) is the componentwise absolute value of the matrix
  679: *     or vector Z.
  680: *
  681: *        Compute residual RES = B_s - op(A_s) * Y,
  682: *            op(A) = A, A**T, or A**H depending on TRANS (and type).
  683: *
  684:          CALL DCOPY( N, B( 1, J ), 1, RES, 1 )
  685:          CALL DGBMV(TRANS, N, N, KL, KU, -1.0D+0, AB, LDAB, Y(1,J),
  686:      $        1, 1.0D+0, RES, 1 )
  687: 
  688:          DO I = 1, N
  689:             AYB( I ) = ABS( B( I, J ) )
  690:          END DO
  691: *
  692: *     Compute abs(op(A_s))*abs(Y) + abs(B_s).
  693: *
  694:         CALL DLA_GBAMV( TRANS_TYPE, N, N, KL, KU, 1.0D+0,
  695:      $        AB, LDAB, Y(1, J), 1, 1.0D+0, AYB, 1 )
  696: 
  697:          CALL DLA_LIN_BERR( N, N, 1, RES, AYB, BERR_OUT( J ) )
  698: *
  699: *     End of loop for each RHS
  700: *
  701:       END DO
  702: *
  703:       RETURN
  704: *
  705: *     End of DLA_GBRFSX_EXTENDED
  706: *
  707:       END

CVSweb interface <joel.bertrand@systella.fr>