LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
cgbsvxx.f
Go to the documentation of this file.
00001 *> \brief <b> CGBSVXX computes the solution to system of linear equations A * X = B for GB matrices</b>
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download CGBSVXX + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cgbsvxx.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cgbsvxx.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbsvxx.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE CGBSVXX( FACT, TRANS, N, KL, KU, NRHS, AB, LDAB, AFB,
00022 *                           LDAFB, IPIV, EQUED, R, C, B, LDB, X, LDX,
00023 *                           RCOND, RPVGRW, BERR, N_ERR_BNDS,
00024 *                           ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
00025 *                           WORK, RWORK, INFO )
00026 * 
00027 *       .. Scalar Arguments ..
00028 *       CHARACTER          EQUED, FACT, TRANS
00029 *       INTEGER            INFO, LDAB, LDAFB, LDB, LDX, N, NRHS, NPARAMS,
00030 *      $                   N_ERR_BNDS
00031 *       REAL               RCOND, RPVGRW
00032 *       ..
00033 *       .. Array Arguments ..
00034 *       INTEGER            IPIV( * )
00035 *       COMPLEX            AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
00036 *      $                   X( LDX , * ),WORK( * )
00037 *       REAL               R( * ), C( * ), PARAMS( * ), BERR( * ),
00038 *      $                   ERR_BNDS_NORM( NRHS, * ),
00039 *      $                   ERR_BNDS_COMP( NRHS, * ), RWORK( * )
00040 *       ..
00041 *  
00042 *
00043 *> \par Purpose:
00044 *  =============
00045 *>
00046 *> \verbatim
00047 *>
00048 *>    CGBSVXX uses the LU factorization to compute the solution to a
00049 *>    complex system of linear equations  A * X = B,  where A is an
00050 *>    N-by-N matrix and X and B are N-by-NRHS matrices.
00051 *>
00052 *>    If requested, both normwise and maximum componentwise error bounds
00053 *>    are returned. CGBSVXX will return a solution with a tiny
00054 *>    guaranteed error (O(eps) where eps is the working machine
00055 *>    precision) unless the matrix is very ill-conditioned, in which
00056 *>    case a warning is returned. Relevant condition numbers also are
00057 *>    calculated and returned.
00058 *>
00059 *>    CGBSVXX accepts user-provided factorizations and equilibration
00060 *>    factors; see the definitions of the FACT and EQUED options.
00061 *>    Solving with refinement and using a factorization from a previous
00062 *>    CGBSVXX call will also produce a solution with either O(eps)
00063 *>    errors or warnings, but we cannot make that claim for general
00064 *>    user-provided factorizations and equilibration factors if they
00065 *>    differ from what CGBSVXX would itself produce.
00066 *> \endverbatim
00067 *
00068 *> \par Description:
00069 *  =================
00070 *>
00071 *> \verbatim
00072 *>
00073 *>    The following steps are performed:
00074 *>
00075 *>    1. If FACT = 'E', real scaling factors are computed to equilibrate
00076 *>    the system:
00077 *>
00078 *>      TRANS = 'N':  diag(R)*A*diag(C)     *inv(diag(C))*X = diag(R)*B
00079 *>      TRANS = 'T': (diag(R)*A*diag(C))**T *inv(diag(R))*X = diag(C)*B
00080 *>      TRANS = 'C': (diag(R)*A*diag(C))**H *inv(diag(R))*X = diag(C)*B
00081 *>
00082 *>    Whether or not the system will be equilibrated depends on the
00083 *>    scaling of the matrix A, but if equilibration is used, A is
00084 *>    overwritten by diag(R)*A*diag(C) and B by diag(R)*B (if TRANS='N')
00085 *>    or diag(C)*B (if TRANS = 'T' or 'C').
00086 *>
00087 *>    2. If FACT = 'N' or 'E', the LU decomposition is used to factor
00088 *>    the matrix A (after equilibration if FACT = 'E') as
00089 *>
00090 *>      A = P * L * U,
00091 *>
00092 *>    where P is a permutation matrix, L is a unit lower triangular
00093 *>    matrix, and U is upper triangular.
00094 *>
00095 *>    3. If some U(i,i)=0, so that U is exactly singular, then the
00096 *>    routine returns with INFO = i. Otherwise, the factored form of A
00097 *>    is used to estimate the condition number of the matrix A (see
00098 *>    argument RCOND). If the reciprocal of the condition number is less
00099 *>    than machine precision, the routine still goes on to solve for X
00100 *>    and compute error bounds as described below.
00101 *>
00102 *>    4. The system of equations is solved for X using the factored form
00103 *>    of A.
00104 *>
00105 *>    5. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero),
00106 *>    the routine will use iterative refinement to try to get a small
00107 *>    error and error bounds.  Refinement calculates the residual to at
00108 *>    least twice the working precision.
00109 *>
00110 *>    6. If equilibration was used, the matrix X is premultiplied by
00111 *>    diag(C) (if TRANS = 'N') or diag(R) (if TRANS = 'T' or 'C') so
00112 *>    that it solves the original system before equilibration.
00113 *> \endverbatim
00114 *
00115 *  Arguments:
00116 *  ==========
00117 *
00118 *> \verbatim
00119 *>     Some optional parameters are bundled in the PARAMS array.  These
00120 *>     settings determine how refinement is performed, but often the
00121 *>     defaults are acceptable.  If the defaults are acceptable, users
00122 *>     can pass NPARAMS = 0 which prevents the source code from accessing
00123 *>     the PARAMS argument.
00124 *> \endverbatim
00125 *>
00126 *> \param[in] FACT
00127 *> \verbatim
00128 *>          FACT is CHARACTER*1
00129 *>     Specifies whether or not the factored form of the matrix A is
00130 *>     supplied on entry, and if not, whether the matrix A should be
00131 *>     equilibrated before it is factored.
00132 *>       = 'F':  On entry, AF and IPIV contain the factored form of A.
00133 *>               If EQUED is not 'N', the matrix A has been
00134 *>               equilibrated with scaling factors given by R and C.
00135 *>               A, AF, and IPIV are not modified.
00136 *>       = 'N':  The matrix A will be copied to AF and factored.
00137 *>       = 'E':  The matrix A will be equilibrated if necessary, then
00138 *>               copied to AF and factored.
00139 *> \endverbatim
00140 *>
00141 *> \param[in] TRANS
00142 *> \verbatim
00143 *>          TRANS is CHARACTER*1
00144 *>     Specifies the form of the system of equations:
00145 *>       = 'N':  A * X = B     (No transpose)
00146 *>       = 'T':  A**T * X = B  (Transpose)
00147 *>       = 'C':  A**H * X = B  (Conjugate Transpose = Transpose)
00148 *> \endverbatim
00149 *>
00150 *> \param[in] N
00151 *> \verbatim
00152 *>          N is INTEGER
00153 *>     The number of linear equations, i.e., the order of the
00154 *>     matrix A.  N >= 0.
00155 *> \endverbatim
00156 *>
00157 *> \param[in] KL
00158 *> \verbatim
00159 *>          KL is INTEGER
00160 *>     The number of subdiagonals within the band of A.  KL >= 0.
00161 *> \endverbatim
00162 *>
00163 *> \param[in] KU
00164 *> \verbatim
00165 *>          KU is INTEGER
00166 *>     The number of superdiagonals within the band of A.  KU >= 0.
00167 *> \endverbatim
00168 *>
00169 *> \param[in] NRHS
00170 *> \verbatim
00171 *>          NRHS is INTEGER
00172 *>     The number of right hand sides, i.e., the number of columns
00173 *>     of the matrices B and X.  NRHS >= 0.
00174 *> \endverbatim
00175 *>
00176 *> \param[in,out] AB
00177 *> \verbatim
00178 *>          AB is REAL array, dimension (LDAB,N)
00179 *>     On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
00180 *>     The j-th column of A is stored in the j-th column of the
00181 *>     array AB as follows:
00182 *>     AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
00183 *>
00184 *>     If FACT = 'F' and EQUED is not 'N', then AB must have been
00185 *>     equilibrated by the scaling factors in R and/or C.  AB is not
00186 *>     modified if FACT = 'F' or 'N', or if FACT = 'E' and
00187 *>     EQUED = 'N' on exit.
00188 *>
00189 *>     On exit, if EQUED .ne. 'N', A is scaled as follows:
00190 *>     EQUED = 'R':  A := diag(R) * A
00191 *>     EQUED = 'C':  A := A * diag(C)
00192 *>     EQUED = 'B':  A := diag(R) * A * diag(C).
00193 *> \endverbatim
00194 *>
00195 *> \param[in] LDAB
00196 *> \verbatim
00197 *>          LDAB is INTEGER
00198 *>     The leading dimension of the array AB.  LDAB >= KL+KU+1.
00199 *> \endverbatim
00200 *>
00201 *> \param[in,out] AFB
00202 *> \verbatim
00203 *>          AFB is REAL array, dimension (LDAFB,N)
00204 *>     If FACT = 'F', then AFB is an input argument and on entry
00205 *>     contains details of the LU factorization of the band matrix
00206 *>     A, as computed by CGBTRF.  U is stored as an upper triangular
00207 *>     band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
00208 *>     and the multipliers used during the factorization are stored
00209 *>     in rows KL+KU+2 to 2*KL+KU+1.  If EQUED .ne. 'N', then AFB is
00210 *>     the factored form of the equilibrated matrix A.
00211 *>
00212 *>     If FACT = 'N', then AF is an output argument and on exit
00213 *>     returns the factors L and U from the factorization A = P*L*U
00214 *>     of the original matrix A.
00215 *>
00216 *>     If FACT = 'E', then AF is an output argument and on exit
00217 *>     returns the factors L and U from the factorization A = P*L*U
00218 *>     of the equilibrated matrix A (see the description of A for
00219 *>     the form of the equilibrated matrix).
00220 *> \endverbatim
00221 *>
00222 *> \param[in] LDAFB
00223 *> \verbatim
00224 *>          LDAFB is INTEGER
00225 *>     The leading dimension of the array AFB.  LDAFB >= 2*KL+KU+1.
00226 *> \endverbatim
00227 *>
00228 *> \param[in,out] IPIV
00229 *> \verbatim
00230 *>          IPIV is INTEGER array, dimension (N)
00231 *>     If FACT = 'F', then IPIV is an input argument and on entry
00232 *>     contains the pivot indices from the factorization A = P*L*U
00233 *>     as computed by SGETRF; row i of the matrix was interchanged
00234 *>     with row IPIV(i).
00235 *>
00236 *>     If FACT = 'N', then IPIV is an output argument and on exit
00237 *>     contains the pivot indices from the factorization A = P*L*U
00238 *>     of the original matrix A.
00239 *>
00240 *>     If FACT = 'E', then IPIV is an output argument and on exit
00241 *>     contains the pivot indices from the factorization A = P*L*U
00242 *>     of the equilibrated matrix A.
00243 *> \endverbatim
00244 *>
00245 *> \param[in,out] EQUED
00246 *> \verbatim
00247 *>          EQUED is CHARACTER*1
00248 *>     Specifies the form of equilibration that was done.
00249 *>       = 'N':  No equilibration (always true if FACT = 'N').
00250 *>       = 'R':  Row equilibration, i.e., A has been premultiplied by
00251 *>               diag(R).
00252 *>       = 'C':  Column equilibration, i.e., A has been postmultiplied
00253 *>               by diag(C).
00254 *>       = 'B':  Both row and column equilibration, i.e., A has been
00255 *>               replaced by diag(R) * A * diag(C).
00256 *>     EQUED is an input argument if FACT = 'F'; otherwise, it is an
00257 *>     output argument.
00258 *> \endverbatim
00259 *>
00260 *> \param[in,out] R
00261 *> \verbatim
00262 *>          R is REAL array, dimension (N)
00263 *>     The row scale factors for A.  If EQUED = 'R' or 'B', A is
00264 *>     multiplied on the left by diag(R); if EQUED = 'N' or 'C', R
00265 *>     is not accessed.  R is an input argument if FACT = 'F';
00266 *>     otherwise, R is an output argument.  If FACT = 'F' and
00267 *>     EQUED = 'R' or 'B', each element of R must be positive.
00268 *>     If R is output, each element of R is a power of the radix.
00269 *>     If R is input, each element of R should be a power of the radix
00270 *>     to ensure a reliable solution and error estimates. Scaling by
00271 *>     powers of the radix does not cause rounding errors unless the
00272 *>     result underflows or overflows. Rounding errors during scaling
00273 *>     lead to refining with a matrix that is not equivalent to the
00274 *>     input matrix, producing error estimates that may not be
00275 *>     reliable.
00276 *> \endverbatim
00277 *>
00278 *> \param[in,out] C
00279 *> \verbatim
00280 *>          C is REAL array, dimension (N)
00281 *>     The column scale factors for A.  If EQUED = 'C' or 'B', A is
00282 *>     multiplied on the right by diag(C); if EQUED = 'N' or 'R', C
00283 *>     is not accessed.  C is an input argument if FACT = 'F';
00284 *>     otherwise, C is an output argument.  If FACT = 'F' and
00285 *>     EQUED = 'C' or 'B', each element of C must be positive.
00286 *>     If C is output, each element of C is a power of the radix.
00287 *>     If C is input, each element of C should be a power of the radix
00288 *>     to ensure a reliable solution and error estimates. Scaling by
00289 *>     powers of the radix does not cause rounding errors unless the
00290 *>     result underflows or overflows. Rounding errors during scaling
00291 *>     lead to refining with a matrix that is not equivalent to the
00292 *>     input matrix, producing error estimates that may not be
00293 *>     reliable.
00294 *> \endverbatim
00295 *>
00296 *> \param[in,out] B
00297 *> \verbatim
00298 *>          B is REAL array, dimension (LDB,NRHS)
00299 *>     On entry, the N-by-NRHS right hand side matrix B.
00300 *>     On exit,
00301 *>     if EQUED = 'N', B is not modified;
00302 *>     if TRANS = 'N' and EQUED = 'R' or 'B', B is overwritten by
00303 *>        diag(R)*B;
00304 *>     if TRANS = 'T' or 'C' and EQUED = 'C' or 'B', B is
00305 *>        overwritten by diag(C)*B.
00306 *> \endverbatim
00307 *>
00308 *> \param[in] LDB
00309 *> \verbatim
00310 *>          LDB is INTEGER
00311 *>     The leading dimension of the array B.  LDB >= max(1,N).
00312 *> \endverbatim
00313 *>
00314 *> \param[out] X
00315 *> \verbatim
00316 *>          X is REAL array, dimension (LDX,NRHS)
00317 *>     If INFO = 0, the N-by-NRHS solution matrix X to the original
00318 *>     system of equations.  Note that A and B are modified on exit
00319 *>     if EQUED .ne. 'N', and the solution to the equilibrated system is
00320 *>     inv(diag(C))*X if TRANS = 'N' and EQUED = 'C' or 'B', or
00321 *>     inv(diag(R))*X if TRANS = 'T' or 'C' and EQUED = 'R' or 'B'.
00322 *> \endverbatim
00323 *>
00324 *> \param[in] LDX
00325 *> \verbatim
00326 *>          LDX is INTEGER
00327 *>     The leading dimension of the array X.  LDX >= max(1,N).
00328 *> \endverbatim
00329 *>
00330 *> \param[out] RCOND
00331 *> \verbatim
00332 *>          RCOND is REAL
00333 *>     Reciprocal scaled condition number.  This is an estimate of the
00334 *>     reciprocal Skeel condition number of the matrix A after
00335 *>     equilibration (if done).  If this is less than the machine
00336 *>     precision (in particular, if it is zero), the matrix is singular
00337 *>     to working precision.  Note that the error may still be small even
00338 *>     if this number is very small and the matrix appears ill-
00339 *>     conditioned.
00340 *> \endverbatim
00341 *>
00342 *> \param[out] RPVGRW
00343 *> \verbatim
00344 *>          RPVGRW is REAL
00345 *>     Reciprocal pivot growth.  On exit, this contains the reciprocal
00346 *>     pivot growth factor norm(A)/norm(U). The "max absolute element"
00347 *>     norm is used.  If this is much less than 1, then the stability of
00348 *>     the LU factorization of the (equilibrated) matrix A could be poor.
00349 *>     This also means that the solution X, estimated condition numbers,
00350 *>     and error bounds could be unreliable. If factorization fails with
00351 *>     0<INFO<=N, then this contains the reciprocal pivot growth factor
00352 *>     for the leading INFO columns of A.  In SGESVX, this quantity is
00353 *>     returned in WORK(1).
00354 *> \endverbatim
00355 *>
00356 *> \param[out] BERR
00357 *> \verbatim
00358 *>          BERR is REAL array, dimension (NRHS)
00359 *>     Componentwise relative backward error.  This is the
00360 *>     componentwise relative backward error of each solution vector X(j)
00361 *>     (i.e., the smallest relative change in any element of A or B that
00362 *>     makes X(j) an exact solution).
00363 *> \endverbatim
00364 *>
00365 *> \param[in] N_ERR_BNDS
00366 *> \verbatim
00367 *>          N_ERR_BNDS is INTEGER
00368 *>     Number of error bounds to return for each right hand side
00369 *>     and each type (normwise or componentwise).  See ERR_BNDS_NORM and
00370 *>     ERR_BNDS_COMP below.
00371 *> \endverbatim
00372 *>
00373 *> \param[out] ERR_BNDS_NORM
00374 *> \verbatim
00375 *>          ERR_BNDS_NORM is REAL array, dimension (NRHS, N_ERR_BNDS)
00376 *>     For each right-hand side, this array contains information about
00377 *>     various error bounds and condition numbers corresponding to the
00378 *>     normwise relative error, which is defined as follows:
00379 *>
00380 *>     Normwise relative error in the ith solution vector:
00381 *>             max_j (abs(XTRUE(j,i) - X(j,i)))
00382 *>            ------------------------------
00383 *>                  max_j abs(X(j,i))
00384 *>
00385 *>     The array is indexed by the type of error information as described
00386 *>     below. There currently are up to three pieces of information
00387 *>     returned.
00388 *>
00389 *>     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
00390 *>     right-hand side.
00391 *>
00392 *>     The second index in ERR_BNDS_NORM(:,err) contains the following
00393 *>     three fields:
00394 *>     err = 1 "Trust/don't trust" boolean. Trust the answer if the
00395 *>              reciprocal condition number is less than the threshold
00396 *>              sqrt(n) * slamch('Epsilon').
00397 *>
00398 *>     err = 2 "Guaranteed" error bound: The estimated forward error,
00399 *>              almost certainly within a factor of 10 of the true error
00400 *>              so long as the next entry is greater than the threshold
00401 *>              sqrt(n) * slamch('Epsilon'). This error bound should only
00402 *>              be trusted if the previous boolean is true.
00403 *>
00404 *>     err = 3  Reciprocal condition number: Estimated normwise
00405 *>              reciprocal condition number.  Compared with the threshold
00406 *>              sqrt(n) * slamch('Epsilon') to determine if the error
00407 *>              estimate is "guaranteed". These reciprocal condition
00408 *>              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
00409 *>              appropriately scaled matrix Z.
00410 *>              Let Z = S*A, where S scales each row by a power of the
00411 *>              radix so all absolute row sums of Z are approximately 1.
00412 *>
00413 *>     See Lapack Working Note 165 for further details and extra
00414 *>     cautions.
00415 *> \endverbatim
00416 *>
00417 *> \param[out] ERR_BNDS_COMP
00418 *> \verbatim
00419 *>          ERR_BNDS_COMP is REAL array, dimension (NRHS, N_ERR_BNDS)
00420 *>     For each right-hand side, this array contains information about
00421 *>     various error bounds and condition numbers corresponding to the
00422 *>     componentwise relative error, which is defined as follows:
00423 *>
00424 *>     Componentwise relative error in the ith solution vector:
00425 *>                    abs(XTRUE(j,i) - X(j,i))
00426 *>             max_j ----------------------
00427 *>                         abs(X(j,i))
00428 *>
00429 *>     The array is indexed by the right-hand side i (on which the
00430 *>     componentwise relative error depends), and the type of error
00431 *>     information as described below. There currently are up to three
00432 *>     pieces of information returned for each right-hand side. If
00433 *>     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
00434 *>     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
00435 *>     the first (:,N_ERR_BNDS) entries are returned.
00436 *>
00437 *>     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
00438 *>     right-hand side.
00439 *>
00440 *>     The second index in ERR_BNDS_COMP(:,err) contains the following
00441 *>     three fields:
00442 *>     err = 1 "Trust/don't trust" boolean. Trust the answer if the
00443 *>              reciprocal condition number is less than the threshold
00444 *>              sqrt(n) * slamch('Epsilon').
00445 *>
00446 *>     err = 2 "Guaranteed" error bound: The estimated forward error,
00447 *>              almost certainly within a factor of 10 of the true error
00448 *>              so long as the next entry is greater than the threshold
00449 *>              sqrt(n) * slamch('Epsilon'). This error bound should only
00450 *>              be trusted if the previous boolean is true.
00451 *>
00452 *>     err = 3  Reciprocal condition number: Estimated componentwise
00453 *>              reciprocal condition number.  Compared with the threshold
00454 *>              sqrt(n) * slamch('Epsilon') to determine if the error
00455 *>              estimate is "guaranteed". These reciprocal condition
00456 *>              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
00457 *>              appropriately scaled matrix Z.
00458 *>              Let Z = S*(A*diag(x)), where x is the solution for the
00459 *>              current right-hand side and S scales each row of
00460 *>              A*diag(x) by a power of the radix so all absolute row
00461 *>              sums of Z are approximately 1.
00462 *>
00463 *>     See Lapack Working Note 165 for further details and extra
00464 *>     cautions.
00465 *> \endverbatim
00466 *>
00467 *> \param[in] NPARAMS
00468 *> \verbatim
00469 *>          NPARAMS is INTEGER
00470 *>     Specifies the number of parameters set in PARAMS.  If .LE. 0, the
00471 *>     PARAMS array is never referenced and default values are used.
00472 *> \endverbatim
00473 *>
00474 *> \param[in,out] PARAMS
00475 *> \verbatim
00476 *>          PARAMS is / output) REAL array, dimension NPARAMS
00477 *>     Specifies algorithm parameters.  If an entry is .LT. 0.0, then
00478 *>     that entry will be filled with default value used for that
00479 *>     parameter.  Only positions up to NPARAMS are accessed; defaults
00480 *>     are used for higher-numbered parameters.
00481 *>
00482 *>       PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
00483 *>            refinement or not.
00484 *>         Default: 1.0
00485 *>            = 0.0 : No refinement is performed, and no error bounds are
00486 *>                    computed.
00487 *>            = 1.0 : Use the double-precision refinement algorithm,
00488 *>                    possibly with doubled-single computations if the
00489 *>                    compilation environment does not support DOUBLE
00490 *>                    PRECISION.
00491 *>              (other values are reserved for future use)
00492 *>
00493 *>       PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
00494 *>            computations allowed for refinement.
00495 *>         Default: 10
00496 *>         Aggressive: Set to 100 to permit convergence using approximate
00497 *>                     factorizations or factorizations other than LU. If
00498 *>                     the factorization uses a technique other than
00499 *>                     Gaussian elimination, the guarantees in
00500 *>                     err_bnds_norm and err_bnds_comp may no longer be
00501 *>                     trustworthy.
00502 *>
00503 *>       PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code
00504 *>            will attempt to find a solution with small componentwise
00505 *>            relative error in the double-precision algorithm.  Positive
00506 *>            is true, 0.0 is false.
00507 *>         Default: 1.0 (attempt componentwise convergence)
00508 *> \endverbatim
00509 *>
00510 *> \param[out] WORK
00511 *> \verbatim
00512 *>          WORK is COMPLEX array, dimension (2*N)
00513 *> \endverbatim
00514 *>
00515 *> \param[out] RWORK
00516 *> \verbatim
00517 *>          RWORK is REAL array, dimension (2*N)
00518 *> \endverbatim
00519 *>
00520 *> \param[out] INFO
00521 *> \verbatim
00522 *>          INFO is INTEGER
00523 *>       = 0:  Successful exit. The solution to every right-hand side is
00524 *>         guaranteed.
00525 *>       < 0:  If INFO = -i, the i-th argument had an illegal value
00526 *>       > 0 and <= N:  U(INFO,INFO) is exactly zero.  The factorization
00527 *>         has been completed, but the factor U is exactly singular, so
00528 *>         the solution and error bounds could not be computed. RCOND = 0
00529 *>         is returned.
00530 *>       = N+J: The solution corresponding to the Jth right-hand side is
00531 *>         not guaranteed. The solutions corresponding to other right-
00532 *>         hand sides K with K > J may not be guaranteed as well, but
00533 *>         only the first such right-hand side is reported. If a small
00534 *>         componentwise error is not requested (PARAMS(3) = 0.0) then
00535 *>         the Jth right-hand side is the first with a normwise error
00536 *>         bound that is not guaranteed (the smallest J such
00537 *>         that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)
00538 *>         the Jth right-hand side is the first with either a normwise or
00539 *>         componentwise error bound that is not guaranteed (the smallest
00540 *>         J such that either ERR_BNDS_NORM(J,1) = 0.0 or
00541 *>         ERR_BNDS_COMP(J,1) = 0.0). See the definition of
00542 *>         ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information
00543 *>         about all of the right-hand sides check ERR_BNDS_NORM or
00544 *>         ERR_BNDS_COMP.
00545 *> \endverbatim
00546 *
00547 *  Authors:
00548 *  ========
00549 *
00550 *> \author Univ. of Tennessee 
00551 *> \author Univ. of California Berkeley 
00552 *> \author Univ. of Colorado Denver 
00553 *> \author NAG Ltd. 
00554 *
00555 *> \date April 2012
00556 *
00557 *> \ingroup complexGBsolve
00558 *
00559 *  =====================================================================
00560       SUBROUTINE CGBSVXX( FACT, TRANS, N, KL, KU, NRHS, AB, LDAB, AFB,
00561      $                    LDAFB, IPIV, EQUED, R, C, B, LDB, X, LDX,
00562      $                    RCOND, RPVGRW, BERR, N_ERR_BNDS,
00563      $                    ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
00564      $                    WORK, RWORK, INFO )
00565 *
00566 *  -- LAPACK driver routine (version 3.4.1) --
00567 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00568 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00569 *     April 2012
00570 *
00571 *     .. Scalar Arguments ..
00572       CHARACTER          EQUED, FACT, TRANS
00573       INTEGER            INFO, LDAB, LDAFB, LDB, LDX, N, NRHS, NPARAMS,
00574      $                   N_ERR_BNDS
00575       REAL               RCOND, RPVGRW
00576 *     ..
00577 *     .. Array Arguments ..
00578       INTEGER            IPIV( * )
00579       COMPLEX            AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
00580      $                   X( LDX , * ),WORK( * )
00581       REAL               R( * ), C( * ), PARAMS( * ), BERR( * ),
00582      $                   ERR_BNDS_NORM( NRHS, * ),
00583      $                   ERR_BNDS_COMP( NRHS, * ), RWORK( * )
00584 *     ..
00585 *
00586 *  ==================================================================
00587 *
00588 *     .. Parameters ..
00589       REAL               ZERO, ONE
00590       PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
00591       INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
00592       INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
00593       INTEGER            CMP_ERR_I, PIV_GROWTH_I
00594       PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
00595      $                   BERR_I = 3 )
00596       PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
00597       PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
00598      $                   PIV_GROWTH_I = 9 )
00599 *     ..
00600 *     .. Local Scalars ..
00601       LOGICAL            COLEQU, EQUIL, NOFACT, NOTRAN, ROWEQU
00602       INTEGER            INFEQU, I, J, KL, KU
00603       REAL               AMAX, BIGNUM, COLCND, RCMAX, RCMIN,
00604      $                   ROWCND, SMLNUM
00605 *     ..
00606 *     .. External Functions ..
00607       EXTERNAL           LSAME, SLAMCH, CLA_GBRPVGRW
00608       LOGICAL            LSAME
00609       REAL               SLAMCH, CLA_GBRPVGRW
00610 *     ..
00611 *     .. External Subroutines ..
00612       EXTERNAL           CGBEQUB, CGBTRF, CGBTRS, CLACPY, CLAQGB,
00613      $                   XERBLA, CLASCL2, CGBRFSX
00614 *     ..
00615 *     .. Intrinsic Functions ..
00616       INTRINSIC          MAX, MIN
00617 *     ..
00618 *     .. Executable Statements ..
00619 *
00620       INFO = 0
00621       NOFACT = LSAME( FACT, 'N' )
00622       EQUIL = LSAME( FACT, 'E' )
00623       NOTRAN = LSAME( TRANS, 'N' )
00624       SMLNUM = SLAMCH( 'Safe minimum' )
00625       BIGNUM = ONE / SMLNUM
00626       IF( NOFACT .OR. EQUIL ) THEN
00627          EQUED = 'N'
00628          ROWEQU = .FALSE.
00629          COLEQU = .FALSE.
00630       ELSE
00631          ROWEQU = LSAME( EQUED, 'R' ) .OR. LSAME( EQUED, 'B' )
00632          COLEQU = LSAME( EQUED, 'C' ) .OR. LSAME( EQUED, 'B' )
00633       END IF
00634 *
00635 *     Default is failure.  If an input parameter is wrong or
00636 *     factorization fails, make everything look horrible.  Only the
00637 *     pivot growth is set here, the rest is initialized in CGBRFSX.
00638 *
00639       RPVGRW = ZERO
00640 *
00641 *     Test the input parameters.  PARAMS is not tested until SGERFSX.
00642 *
00643       IF( .NOT.NOFACT .AND. .NOT.EQUIL .AND. .NOT.
00644      $     LSAME( FACT, 'F' ) ) THEN
00645          INFO = -1
00646       ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'T' ) .AND. .NOT.
00647      $        LSAME( TRANS, 'C' ) ) THEN
00648          INFO = -2
00649       ELSE IF( N.LT.0 ) THEN
00650          INFO = -3
00651       ELSE IF( KL.LT.0 ) THEN
00652          INFO = -4
00653       ELSE IF( KU.LT.0 ) THEN
00654          INFO = -5
00655       ELSE IF( NRHS.LT.0 ) THEN
00656          INFO = -6
00657       ELSE IF( LDAB.LT.KL+KU+1 ) THEN
00658          INFO = -8
00659       ELSE IF( LDAFB.LT.2*KL+KU+1 ) THEN
00660          INFO = -10
00661       ELSE IF( LSAME( FACT, 'F' ) .AND. .NOT.
00662      $        ( ROWEQU .OR. COLEQU .OR. LSAME( EQUED, 'N' ) ) ) THEN
00663          INFO = -12
00664       ELSE
00665          IF( ROWEQU ) THEN
00666             RCMIN = BIGNUM
00667             RCMAX = ZERO
00668             DO 10 J = 1, N
00669                RCMIN = MIN( RCMIN, R( J ) )
00670                RCMAX = MAX( RCMAX, R( J ) )
00671  10         CONTINUE
00672             IF( RCMIN.LE.ZERO ) THEN
00673                INFO = -13
00674             ELSE IF( N.GT.0 ) THEN
00675                ROWCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM )
00676             ELSE
00677                ROWCND = ONE
00678             END IF
00679          END IF
00680          IF( COLEQU .AND. INFO.EQ.0 ) THEN
00681             RCMIN = BIGNUM
00682             RCMAX = ZERO
00683             DO 20 J = 1, N
00684                RCMIN = MIN( RCMIN, C( J ) )
00685                RCMAX = MAX( RCMAX, C( J ) )
00686  20         CONTINUE
00687             IF( RCMIN.LE.ZERO ) THEN
00688                INFO = -14
00689             ELSE IF( N.GT.0 ) THEN
00690                COLCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM )
00691             ELSE
00692                COLCND = ONE
00693             END IF
00694          END IF
00695          IF( INFO.EQ.0 ) THEN
00696             IF( LDB.LT.MAX( 1, N ) ) THEN
00697                INFO = -15
00698             ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
00699                INFO = -16
00700             END IF
00701          END IF
00702       END IF
00703 *
00704       IF( INFO.NE.0 ) THEN
00705          CALL XERBLA( 'CGBSVXX', -INFO )
00706          RETURN
00707       END IF
00708 *
00709       IF( EQUIL ) THEN
00710 *
00711 *     Compute row and column scalings to equilibrate the matrix A.
00712 *
00713          CALL CGBEQUB( N, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND,
00714      $        AMAX, INFEQU )
00715          IF( INFEQU.EQ.0 ) THEN
00716 *
00717 *     Equilibrate the matrix.
00718 *
00719             CALL CLAQGB( N, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND,
00720      $           AMAX, EQUED )
00721             ROWEQU = LSAME( EQUED, 'R' ) .OR. LSAME( EQUED, 'B' )
00722             COLEQU = LSAME( EQUED, 'C' ) .OR. LSAME( EQUED, 'B' )
00723          END IF
00724 *
00725 *     If the scaling factors are not applied, set them to 1.0.
00726 *
00727          IF ( .NOT.ROWEQU ) THEN
00728             DO J = 1, N
00729                R( J ) = 1.0
00730             END DO
00731          END IF
00732          IF ( .NOT.COLEQU ) THEN
00733             DO J = 1, N
00734                C( J ) = 1.0
00735             END DO
00736          END IF
00737       END IF
00738 *
00739 *     Scale the right-hand side.
00740 *
00741       IF( NOTRAN ) THEN
00742          IF( ROWEQU ) CALL CLASCL2( N, NRHS, R, B, LDB )
00743       ELSE
00744          IF( COLEQU ) CALL CLASCL2( N, NRHS, C, B, LDB )
00745       END IF
00746 *
00747       IF( NOFACT .OR. EQUIL ) THEN
00748 *
00749 *        Compute the LU factorization of A.
00750 *
00751          DO 40, J = 1, N
00752             DO 30, I = KL+1, 2*KL+KU+1
00753                AFB( I, J ) = AB( I-KL, J )
00754  30         CONTINUE
00755  40      CONTINUE
00756          CALL CGBTRF( N, N, KL, KU, AFB, LDAFB, IPIV, INFO )
00757 *
00758 *        Return if INFO is non-zero.
00759 *
00760          IF( INFO.GT.0 ) THEN
00761 *
00762 *           Pivot in column INFO is exactly 0
00763 *           Compute the reciprocal pivot growth factor of the
00764 *           leading rank-deficient INFO columns of A.
00765 *
00766             RPVGRW = CLA_GBRPVGRW( N, KL, KU, INFO, AB, LDAB, AFB,
00767      $           LDAFB )
00768             RETURN
00769          END IF
00770       END IF
00771 *
00772 *     Compute the reciprocal pivot growth factor RPVGRW.
00773 *
00774       RPVGRW = CLA_GBRPVGRW( N, KL, KU, N, AB, LDAB, AFB, LDAFB )
00775 *
00776 *     Compute the solution matrix X.
00777 *
00778       CALL CLACPY( 'Full', N, NRHS, B, LDB, X, LDX )
00779       CALL CGBTRS( TRANS, N, KL, KU, NRHS, AFB, LDAFB, IPIV, X, LDX,
00780      $     INFO )
00781 *
00782 *     Use iterative refinement to improve the computed solution and
00783 *     compute error bounds and backward error estimates for it.
00784 *
00785       CALL CGBRFSX( TRANS, EQUED, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB,
00786      $     IPIV, R, C, B, LDB, X, LDX, RCOND, BERR,
00787      $     N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
00788      $     WORK, RWORK, INFO )
00789 
00790 *
00791 *     Scale solutions.
00792 *
00793       IF ( COLEQU .AND. NOTRAN ) THEN
00794          CALL CLASCL2( N, NRHS, C, X, LDX )
00795       ELSE IF ( ROWEQU .AND. .NOT.NOTRAN ) THEN
00796          CALL CLASCL2( N, NRHS, R, X, LDX )
00797       END IF
00798 *
00799       RETURN
00800 *
00801 *     End of CGBSVXX
00802 *
00803       END
 All Files Functions