File:  [local] / rpl / lapack / lapack / dla_gbrfsx_extended.f
Revision 1.6: download - view: text, annotated - select for diffs - revision graph
Mon Nov 21 22:19:30 2011 UTC (12 years, 5 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_8, rpl-4_1_7, rpl-4_1_6, rpl-4_1_5, rpl-4_1_4, HEAD
Cohérence

    1: *> \brief \b DLA_GBRFSX_EXTENDED
    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 resonsible 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
   70: *>     P    = 'S':  Single
   71: *>          = 'D':  Double
   72: *>          = 'I':  Indigenous
   73: *>          = 'X', '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
   81: *>     T    = '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
  181: *>                    (LDY,NRHS)
  182: *>     On entry, the solution matrix X, as computed by DGBTRS.
  183: *>     On exit, the improved solution matrix Y.
  184: *> \endverbatim
  185: *>
  186: *> \param[in] LDY
  187: *> \verbatim
  188: *>          LDY is INTEGER
  189: *>     The leading dimension of the array Y.  LDY >= max(1,N).
  190: *> \endverbatim
  191: *>
  192: *> \param[out] BERR_OUT
  193: *> \verbatim
  194: *>          BERR_OUT is DOUBLE PRECISION array, dimension (NRHS)
  195: *>     On exit, BERR_OUT(j) contains the componentwise relative backward
  196: *>     error for right-hand-side j from the formula
  197: *>         max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
  198: *>     where abs(Z) is the componentwise absolute value of the matrix
  199: *>     or vector Z. This is computed by DLA_LIN_BERR.
  200: *> \endverbatim
  201: *>
  202: *> \param[in] N_NORMS
  203: *> \verbatim
  204: *>          N_NORMS is INTEGER
  205: *>     Determines which error bounds to return (see ERR_BNDS_NORM
  206: *>     and ERR_BNDS_COMP).
  207: *>     If N_NORMS >= 1 return normwise error bounds.
  208: *>     If N_NORMS >= 2 return componentwise error bounds.
  209: *> \endverbatim
  210: *>
  211: *> \param[in,out] ERR_BNDS_NORM
  212: *> \verbatim
  213: *>          ERR_BNDS_NORM is DOUBLE PRECISION array, dimension
  214: *>                    (NRHS, N_ERR_BNDS)
  215: *>     For each right-hand side, this array contains information about
  216: *>     various error bounds and condition numbers corresponding to the
  217: *>     normwise relative error, which is defined as follows:
  218: *>
  219: *>     Normwise relative error in the ith solution vector:
  220: *>             max_j (abs(XTRUE(j,i) - X(j,i)))
  221: *>            ------------------------------
  222: *>                  max_j abs(X(j,i))
  223: *>
  224: *>     The array is indexed by the type of error information as described
  225: *>     below. There currently are up to three pieces of information
  226: *>     returned.
  227: *>
  228: *>     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
  229: *>     right-hand side.
  230: *>
  231: *>     The second index in ERR_BNDS_NORM(:,err) contains the following
  232: *>     three fields:
  233: *>     err = 1 "Trust/don't trust" boolean. Trust the answer if the
  234: *>              reciprocal condition number is less than the threshold
  235: *>              sqrt(n) * slamch('Epsilon').
  236: *>
  237: *>     err = 2 "Guaranteed" error bound: The estimated forward error,
  238: *>              almost certainly within a factor of 10 of the true error
  239: *>              so long as the next entry is greater than the threshold
  240: *>              sqrt(n) * slamch('Epsilon'). This error bound should only
  241: *>              be trusted if the previous boolean is true.
  242: *>
  243: *>     err = 3  Reciprocal condition number: Estimated normwise
  244: *>              reciprocal condition number.  Compared with the threshold
  245: *>              sqrt(n) * slamch('Epsilon') to determine if the error
  246: *>              estimate is "guaranteed". These reciprocal condition
  247: *>              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
  248: *>              appropriately scaled matrix Z.
  249: *>              Let Z = S*A, where S scales each row by a power of the
  250: *>              radix so all absolute row sums of Z are approximately 1.
  251: *>
  252: *>     This subroutine is only responsible for setting the second field
  253: *>     above.
  254: *>     See Lapack Working Note 165 for further details and extra
  255: *>     cautions.
  256: *> \endverbatim
  257: *>
  258: *> \param[in,out] ERR_BNDS_COMP
  259: *> \verbatim
  260: *>          ERR_BNDS_COMP is DOUBLE PRECISION array, dimension
  261: *>                    (NRHS, N_ERR_BNDS)
  262: *>     For each right-hand side, this array contains information about
  263: *>     various error bounds and condition numbers corresponding to the
  264: *>     componentwise relative error, which is defined as follows:
  265: *>
  266: *>     Componentwise relative error in the ith solution vector:
  267: *>                    abs(XTRUE(j,i) - X(j,i))
  268: *>             max_j ----------------------
  269: *>                         abs(X(j,i))
  270: *>
  271: *>     The array is indexed by the right-hand side i (on which the
  272: *>     componentwise relative error depends), and the type of error
  273: *>     information as described below. There currently are up to three
  274: *>     pieces of information returned for each right-hand side. If
  275: *>     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
  276: *>     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
  277: *>     the first (:,N_ERR_BNDS) entries are returned.
  278: *>
  279: *>     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
  280: *>     right-hand side.
  281: *>
  282: *>     The second index in ERR_BNDS_COMP(:,err) contains the following
  283: *>     three fields:
  284: *>     err = 1 "Trust/don't trust" boolean. Trust the answer if the
  285: *>              reciprocal condition number is less than the threshold
  286: *>              sqrt(n) * slamch('Epsilon').
  287: *>
  288: *>     err = 2 "Guaranteed" error bound: The estimated forward error,
  289: *>              almost certainly within a factor of 10 of the true error
  290: *>              so long as the next entry is greater than the threshold
  291: *>              sqrt(n) * slamch('Epsilon'). This error bound should only
  292: *>              be trusted if the previous boolean is true.
  293: *>
  294: *>     err = 3  Reciprocal condition number: Estimated componentwise
  295: *>              reciprocal condition number.  Compared with the threshold
  296: *>              sqrt(n) * slamch('Epsilon') to determine if the error
  297: *>              estimate is "guaranteed". These reciprocal condition
  298: *>              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
  299: *>              appropriately scaled matrix Z.
  300: *>              Let Z = S*(A*diag(x)), where x is the solution for the
  301: *>              current right-hand side and S scales each row of
  302: *>              A*diag(x) by a power of the radix so all absolute row
  303: *>              sums of Z are approximately 1.
  304: *>
  305: *>     This subroutine is only responsible for setting the second field
  306: *>     above.
  307: *>     See Lapack Working Note 165 for further details and extra
  308: *>     cautions.
  309: *> \endverbatim
  310: *>
  311: *> \param[in] RES
  312: *> \verbatim
  313: *>          RES is DOUBLE PRECISION array, dimension (N)
  314: *>     Workspace to hold the intermediate residual.
  315: *> \endverbatim
  316: *>
  317: *> \param[in] AYB
  318: *> \verbatim
  319: *>          AYB is DOUBLE PRECISION array, dimension (N)
  320: *>     Workspace. This can be the same workspace passed for Y_TAIL.
  321: *> \endverbatim
  322: *>
  323: *> \param[in] DY
  324: *> \verbatim
  325: *>          DY is DOUBLE PRECISION array, dimension (N)
  326: *>     Workspace to hold the intermediate solution.
  327: *> \endverbatim
  328: *>
  329: *> \param[in] Y_TAIL
  330: *> \verbatim
  331: *>          Y_TAIL is DOUBLE PRECISION array, dimension (N)
  332: *>     Workspace to hold the trailing bits of the intermediate solution.
  333: *> \endverbatim
  334: *>
  335: *> \param[in] RCOND
  336: *> \verbatim
  337: *>          RCOND is DOUBLE PRECISION
  338: *>     Reciprocal scaled condition number.  This is an estimate of the
  339: *>     reciprocal Skeel condition number of the matrix A after
  340: *>     equilibration (if done).  If this is less than the machine
  341: *>     precision (in particular, if it is zero), the matrix is singular
  342: *>     to working precision.  Note that the error may still be small even
  343: *>     if this number is very small and the matrix appears ill-
  344: *>     conditioned.
  345: *> \endverbatim
  346: *>
  347: *> \param[in] ITHRESH
  348: *> \verbatim
  349: *>          ITHRESH is INTEGER
  350: *>     The maximum number of residual computations allowed for
  351: *>     refinement. The default is 10. For 'aggressive' set to 100 to
  352: *>     permit convergence using approximate factorizations or
  353: *>     factorizations other than LU. If the factorization uses a
  354: *>     technique other than Gaussian elimination, the guarantees in
  355: *>     ERR_BNDS_NORM and ERR_BNDS_COMP may no longer be trustworthy.
  356: *> \endverbatim
  357: *>
  358: *> \param[in] RTHRESH
  359: *> \verbatim
  360: *>          RTHRESH is DOUBLE PRECISION
  361: *>     Determines when to stop refinement if the error estimate stops
  362: *>     decreasing. Refinement will stop when the next solution no longer
  363: *>     satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
  364: *>     the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
  365: *>     default value is 0.5. For 'aggressive' set to 0.9 to permit
  366: *>     convergence on extremely ill-conditioned matrices. See LAWN 165
  367: *>     for more details.
  368: *> \endverbatim
  369: *>
  370: *> \param[in] DZ_UB
  371: *> \verbatim
  372: *>          DZ_UB is DOUBLE PRECISION
  373: *>     Determines when to start considering componentwise convergence.
  374: *>     Componentwise convergence is only considered after each component
  375: *>     of the solution Y is stable, which we definte as the relative
  376: *>     change in each component being less than DZ_UB. The default value
  377: *>     is 0.25, requiring the first bit to be stable. See LAWN 165 for
  378: *>     more details.
  379: *> \endverbatim
  380: *>
  381: *> \param[in] IGNORE_CWISE
  382: *> \verbatim
  383: *>          IGNORE_CWISE is LOGICAL
  384: *>     If .TRUE. then ignore componentwise convergence. Default value
  385: *>     is .FALSE..
  386: *> \endverbatim
  387: *>
  388: *> \param[out] INFO
  389: *> \verbatim
  390: *>          INFO is INTEGER
  391: *>       = 0:  Successful exit.
  392: *>       < 0:  if INFO = -i, the ith argument to DGBTRS had an illegal
  393: *>             value
  394: *> \endverbatim
  395: *
  396: *  Authors:
  397: *  ========
  398: *
  399: *> \author Univ. of Tennessee 
  400: *> \author Univ. of California Berkeley 
  401: *> \author Univ. of Colorado Denver 
  402: *> \author NAG Ltd. 
  403: *
  404: *> \date November 2011
  405: *
  406: *> \ingroup doubleGBcomputational
  407: *
  408: *  =====================================================================
  409:       SUBROUTINE DLA_GBRFSX_EXTENDED( PREC_TYPE, TRANS_TYPE, N, KL, KU,
  410:      $                                NRHS, AB, LDAB, AFB, LDAFB, IPIV,
  411:      $                                COLEQU, C, B, LDB, Y, LDY,
  412:      $                                BERR_OUT, N_NORMS, ERR_BNDS_NORM,
  413:      $                                ERR_BNDS_COMP, RES, AYB, DY,
  414:      $                                Y_TAIL, RCOND, ITHRESH, RTHRESH,
  415:      $                                DZ_UB, IGNORE_CWISE, INFO )
  416: *
  417: *  -- LAPACK computational routine (version 3.4.0) --
  418: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
  419: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  420: *     November 2011
  421: *
  422: *     .. Scalar Arguments ..
  423:       INTEGER            INFO, LDAB, LDAFB, LDB, LDY, N, KL, KU, NRHS,
  424:      $                   PREC_TYPE, TRANS_TYPE, N_NORMS, ITHRESH
  425:       LOGICAL            COLEQU, IGNORE_CWISE
  426:       DOUBLE PRECISION   RTHRESH, DZ_UB
  427: *     ..
  428: *     .. Array Arguments ..
  429:       INTEGER            IPIV( * )
  430:       DOUBLE PRECISION   AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
  431:      $                   Y( LDY, * ), RES(*), DY(*), Y_TAIL(*)
  432:       DOUBLE PRECISION   C( * ), AYB(*), RCOND, BERR_OUT(*),
  433:      $                   ERR_BNDS_NORM( NRHS, * ),
  434:      $                   ERR_BNDS_COMP( NRHS, * )
  435: *     ..
  436: *
  437: *  =====================================================================
  438: *
  439: *     .. Local Scalars ..
  440:       CHARACTER          TRANS
  441:       INTEGER            CNT, I, J, M, X_STATE, Z_STATE, Y_PREC_STATE
  442:       DOUBLE PRECISION   YK, DYK, YMIN, NORMY, NORMX, NORMDX, DXRAT,
  443:      $                   DZRAT, PREVNORMDX, PREV_DZ_Z, DXRATMAX,
  444:      $                   DZRATMAX, DX_X, DZ_Z, FINAL_DX_X, FINAL_DZ_Z,
  445:      $                   EPS, HUGEVAL, INCR_THRESH
  446:       LOGICAL            INCR_PREC
  447: *     ..
  448: *     .. Parameters ..
  449:       INTEGER            UNSTABLE_STATE, WORKING_STATE, CONV_STATE,
  450:      $                   NOPROG_STATE, BASE_RESIDUAL, EXTRA_RESIDUAL,
  451:      $                   EXTRA_Y
  452:       PARAMETER          ( UNSTABLE_STATE = 0, WORKING_STATE = 1,
  453:      $                   CONV_STATE = 2, NOPROG_STATE = 3 )
  454:       PARAMETER          ( BASE_RESIDUAL = 0, EXTRA_RESIDUAL = 1,
  455:      $                   EXTRA_Y = 2 )
  456:       INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
  457:       INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
  458:       INTEGER            CMP_ERR_I, PIV_GROWTH_I
  459:       PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
  460:      $                   BERR_I = 3 )
  461:       PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
  462:       PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
  463:      $                   PIV_GROWTH_I = 9 )
  464:       INTEGER            LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
  465:      $                   LA_LINRX_CWISE_I
  466:       PARAMETER          ( LA_LINRX_ITREF_I = 1,
  467:      $                   LA_LINRX_ITHRESH_I = 2 )
  468:       PARAMETER          ( LA_LINRX_CWISE_I = 3 )
  469:       INTEGER            LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
  470:      $                   LA_LINRX_RCOND_I
  471:       PARAMETER          ( LA_LINRX_TRUST_I = 1, LA_LINRX_ERR_I = 2 )
  472:       PARAMETER          ( LA_LINRX_RCOND_I = 3 )
  473: *     ..
  474: *     .. External Subroutines ..
  475:       EXTERNAL           DAXPY, DCOPY, DGBTRS, DGBMV, BLAS_DGBMV_X,
  476:      $                   BLAS_DGBMV2_X, DLA_GBAMV, DLA_WWADDW, DLAMCH,
  477:      $                   CHLA_TRANSTYPE, DLA_LIN_BERR
  478:       DOUBLE PRECISION   DLAMCH
  479:       CHARACTER          CHLA_TRANSTYPE
  480: *     ..
  481: *     .. Intrinsic Functions ..
  482:       INTRINSIC          ABS, MAX, MIN
  483: *     ..
  484: *     .. Executable Statements ..
  485: *
  486:       IF (INFO.NE.0) RETURN
  487:       TRANS = CHLA_TRANSTYPE(TRANS_TYPE)
  488:       EPS = DLAMCH( 'Epsilon' )
  489:       HUGEVAL = DLAMCH( 'Overflow' )
  490: *     Force HUGEVAL to Inf
  491:       HUGEVAL = HUGEVAL * HUGEVAL
  492: *     Using HUGEVAL may lead to spurious underflows.
  493:       INCR_THRESH = DBLE( N ) * EPS
  494:       M = KL+KU+1
  495: 
  496:       DO J = 1, NRHS
  497:          Y_PREC_STATE = EXTRA_RESIDUAL
  498:          IF ( Y_PREC_STATE .EQ. EXTRA_Y ) THEN
  499:             DO I = 1, N
  500:                Y_TAIL( I ) = 0.0D+0
  501:             END DO
  502:          END IF
  503: 
  504:          DXRAT = 0.0D+0
  505:          DXRATMAX = 0.0D+0
  506:          DZRAT = 0.0D+0
  507:          DZRATMAX = 0.0D+0
  508:          FINAL_DX_X = HUGEVAL
  509:          FINAL_DZ_Z = HUGEVAL
  510:          PREVNORMDX = HUGEVAL
  511:          PREV_DZ_Z = HUGEVAL
  512:          DZ_Z = HUGEVAL
  513:          DX_X = HUGEVAL
  514: 
  515:          X_STATE = WORKING_STATE
  516:          Z_STATE = UNSTABLE_STATE
  517:          INCR_PREC = .FALSE.
  518: 
  519:          DO CNT = 1, ITHRESH
  520: *
  521: *        Compute residual RES = B_s - op(A_s) * Y,
  522: *            op(A) = A, A**T, or A**H depending on TRANS (and type).
  523: *
  524:             CALL DCOPY( N, B( 1, J ), 1, RES, 1 )
  525:             IF ( Y_PREC_STATE .EQ. BASE_RESIDUAL ) THEN
  526:                CALL DGBMV( TRANS, M, N, KL, KU, -1.0D+0, AB, LDAB,
  527:      $              Y( 1, J ), 1, 1.0D+0, RES, 1 )
  528:             ELSE IF ( Y_PREC_STATE .EQ. EXTRA_RESIDUAL ) THEN
  529:                CALL BLAS_DGBMV_X( TRANS_TYPE, N, N, KL, KU,
  530:      $              -1.0D+0, AB, LDAB, Y( 1, J ), 1, 1.0D+0, RES, 1,
  531:      $              PREC_TYPE )
  532:             ELSE
  533:                CALL BLAS_DGBMV2_X( TRANS_TYPE, N, N, KL, KU, -1.0D+0,
  534:      $              AB, LDAB, Y( 1, J ), Y_TAIL, 1, 1.0D+0, RES, 1,
  535:      $              PREC_TYPE )
  536:             END IF
  537: 
  538: !        XXX: RES is no longer needed.
  539:             CALL DCOPY( N, RES, 1, DY, 1 )
  540:             CALL DGBTRS( TRANS, N, KL, KU, 1, AFB, LDAFB, IPIV, DY, N,
  541:      $           INFO )
  542: *
  543: *         Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT.
  544: *
  545:             NORMX = 0.0D+0
  546:             NORMY = 0.0D+0
  547:             NORMDX = 0.0D+0
  548:             DZ_Z = 0.0D+0
  549:             YMIN = HUGEVAL
  550: 
  551:             DO I = 1, N
  552:                YK = ABS( Y( I, J ) )
  553:                DYK = ABS( DY( I ) )
  554: 
  555:                IF ( YK .NE. 0.0D+0 ) THEN
  556:                   DZ_Z = MAX( DZ_Z, DYK / YK )
  557:                ELSE IF ( DYK .NE. 0.0D+0 ) THEN
  558:                   DZ_Z = HUGEVAL
  559:                END IF
  560: 
  561:                YMIN = MIN( YMIN, YK )
  562: 
  563:                NORMY = MAX( NORMY, YK )
  564: 
  565:                IF ( COLEQU ) THEN
  566:                   NORMX = MAX( NORMX, YK * C( I ) )
  567:                   NORMDX = MAX( NORMDX, DYK * C( I ) )
  568:                ELSE
  569:                   NORMX = NORMY
  570:                   NORMDX = MAX( NORMDX, DYK )
  571:                END IF
  572:             END DO
  573: 
  574:             IF ( NORMX .NE. 0.0D+0 ) THEN
  575:                DX_X = NORMDX / NORMX
  576:             ELSE IF ( NORMDX .EQ. 0.0D+0 ) THEN
  577:                DX_X = 0.0D+0
  578:             ELSE
  579:                DX_X = HUGEVAL
  580:             END IF
  581: 
  582:             DXRAT = NORMDX / PREVNORMDX
  583:             DZRAT = DZ_Z / PREV_DZ_Z
  584: *
  585: *         Check termination criteria.
  586: *
  587:             IF ( .NOT.IGNORE_CWISE
  588:      $           .AND. YMIN*RCOND .LT. INCR_THRESH*NORMY
  589:      $           .AND. Y_PREC_STATE .LT. EXTRA_Y )
  590:      $           INCR_PREC = .TRUE.
  591: 
  592:             IF ( X_STATE .EQ. NOPROG_STATE .AND. DXRAT .LE. RTHRESH )
  593:      $           X_STATE = WORKING_STATE
  594:             IF ( X_STATE .EQ. WORKING_STATE ) THEN
  595:                IF ( DX_X .LE. EPS ) THEN
  596:                   X_STATE = CONV_STATE
  597:                ELSE IF ( DXRAT .GT. RTHRESH ) THEN
  598:                   IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN
  599:                      INCR_PREC = .TRUE.
  600:                   ELSE
  601:                      X_STATE = NOPROG_STATE
  602:                   END IF
  603:                ELSE
  604:                   IF ( DXRAT .GT. DXRATMAX ) DXRATMAX = DXRAT
  605:                END IF
  606:                IF ( X_STATE .GT. WORKING_STATE ) FINAL_DX_X = DX_X
  607:             END IF
  608: 
  609:             IF ( Z_STATE .EQ. UNSTABLE_STATE .AND. DZ_Z .LE. DZ_UB )
  610:      $           Z_STATE = WORKING_STATE
  611:             IF ( Z_STATE .EQ. NOPROG_STATE .AND. DZRAT .LE. RTHRESH )
  612:      $           Z_STATE = WORKING_STATE
  613:             IF ( Z_STATE .EQ. WORKING_STATE ) THEN
  614:                IF ( DZ_Z .LE. EPS ) THEN
  615:                   Z_STATE = CONV_STATE
  616:                ELSE IF ( DZ_Z .GT. DZ_UB ) THEN
  617:                   Z_STATE = UNSTABLE_STATE
  618:                   DZRATMAX = 0.0D+0
  619:                   FINAL_DZ_Z = HUGEVAL
  620:                ELSE IF ( DZRAT .GT. RTHRESH ) THEN
  621:                   IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN
  622:                      INCR_PREC = .TRUE.
  623:                   ELSE
  624:                      Z_STATE = NOPROG_STATE
  625:                   END IF
  626:                ELSE
  627:                   IF ( DZRAT .GT. DZRATMAX ) DZRATMAX = DZRAT
  628:                END IF
  629:                IF ( Z_STATE .GT. WORKING_STATE ) FINAL_DZ_Z = DZ_Z
  630:             END IF
  631: *
  632: *           Exit if both normwise and componentwise stopped working,
  633: *           but if componentwise is unstable, let it go at least two
  634: *           iterations.
  635: *
  636:             IF ( X_STATE.NE.WORKING_STATE ) THEN
  637:                IF ( IGNORE_CWISE ) GOTO 666
  638:                IF ( Z_STATE.EQ.NOPROG_STATE .OR. Z_STATE.EQ.CONV_STATE )
  639:      $              GOTO 666
  640:                IF ( Z_STATE.EQ.UNSTABLE_STATE .AND. CNT.GT.1 ) GOTO 666
  641:             END IF
  642: 
  643:             IF ( INCR_PREC ) THEN
  644:                INCR_PREC = .FALSE.
  645:                Y_PREC_STATE = Y_PREC_STATE + 1
  646:                DO I = 1, N
  647:                   Y_TAIL( I ) = 0.0D+0
  648:                END DO
  649:             END IF
  650: 
  651:             PREVNORMDX = NORMDX
  652:             PREV_DZ_Z = DZ_Z
  653: *
  654: *           Update soluton.
  655: *
  656:             IF (Y_PREC_STATE .LT. EXTRA_Y) THEN
  657:                CALL DAXPY( N, 1.0D+0, DY, 1, Y(1,J), 1 )
  658:             ELSE
  659:                CALL DLA_WWADDW( N, Y(1,J), Y_TAIL, DY )
  660:             END IF
  661: 
  662:          END DO
  663: *        Target of "IF (Z_STOP .AND. X_STOP)".  Sun's f77 won't EXIT.
  664:  666     CONTINUE
  665: *
  666: *     Set final_* when cnt hits ithresh.
  667: *
  668:          IF ( X_STATE .EQ. WORKING_STATE ) FINAL_DX_X = DX_X
  669:          IF ( Z_STATE .EQ. WORKING_STATE ) FINAL_DZ_Z = DZ_Z
  670: *
  671: *     Compute error bounds.
  672: *
  673:          IF ( N_NORMS .GE. 1 ) THEN
  674:             ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
  675:      $           FINAL_DX_X / (1 - DXRATMAX)
  676:          END IF
  677:          IF (N_NORMS .GE. 2) THEN
  678:             ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
  679:      $           FINAL_DZ_Z / (1 - DZRATMAX)
  680:          END IF
  681: *
  682: *     Compute componentwise relative backward error from formula
  683: *         max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
  684: *     where abs(Z) is the componentwise absolute value of the matrix
  685: *     or vector Z.
  686: *
  687: *        Compute residual RES = B_s - op(A_s) * Y,
  688: *            op(A) = A, A**T, or A**H depending on TRANS (and type).
  689: *
  690:          CALL DCOPY( N, B( 1, J ), 1, RES, 1 )
  691:          CALL DGBMV(TRANS, N, N, KL, KU, -1.0D+0, AB, LDAB, Y(1,J),
  692:      $        1, 1.0D+0, RES, 1 )
  693: 
  694:          DO I = 1, N
  695:             AYB( I ) = ABS( B( I, J ) )
  696:          END DO
  697: *
  698: *     Compute abs(op(A_s))*abs(Y) + abs(B_s).
  699: *
  700:         CALL DLA_GBAMV( TRANS_TYPE, N, N, KL, KU, 1.0D+0,
  701:      $        AB, LDAB, Y(1, J), 1, 1.0D+0, AYB, 1 )
  702: 
  703:          CALL DLA_LIN_BERR( N, N, 1, RES, AYB, BERR_OUT( J ) )
  704: *
  705: *     End of loop for each RHS
  706: *
  707:       END DO
  708: *
  709:       RETURN
  710:       END

CVSweb interface <joel.bertrand@systella.fr>