LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
zgbsvxx.f
Go to the documentation of this file.
00001 *> \brief <b> ZGBSVXX 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 ZGBSVXX + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgbsvxx.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgbsvxx.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgbsvxx.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE ZGBSVXX( 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 *       DOUBLE PRECISION   RCOND, RPVGRW
00032 *       ..
00033 *       .. Array Arguments ..
00034 *       INTEGER            IPIV( * )
00035 *       COMPLEX*16         AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
00036 *      $                   X( LDX , * ),WORK( * )
00037 *       DOUBLE PRECISION   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 *>    ZGBSVXX uses the LU factorization to compute the solution to a
00049 *>    complex*16 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. ZGBSVXX 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 *>    ZGBSVXX 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 *>    ZGBSVXX 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 ZGBSVXX 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', double precision 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 COMPLEX*16 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 COMPLEX*16 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 ZGBTRF.  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 DGETRF; 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 DOUBLE PRECISION 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 DOUBLE PRECISION 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 COMPLEX*16 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 COMPLEX*16 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 DOUBLE PRECISION
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 DOUBLE PRECISION
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 DGESVX, this quantity is
00353 *>     returned in WORK(1).
00354 *> \endverbatim
00355 *>
00356 *> \param[out] BERR
00357 *> \verbatim
00358 *>          BERR is DOUBLE PRECISION 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 DOUBLE PRECISION 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) * dlamch('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) * dlamch('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) * dlamch('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 DOUBLE PRECISION 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) * dlamch('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) * dlamch('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) * dlamch('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) DOUBLE PRECISION 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.0D+0
00485 *>            = 0.0 : No refinement is performed, and no error bounds are
00486 *>                    computed.
00487 *>            = 1.0 : Use the extra-precise refinement algorithm.
00488 *>              (other values are reserved for future use)
00489 *>
00490 *>       PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
00491 *>            computations allowed for refinement.
00492 *>         Default: 10
00493 *>         Aggressive: Set to 100 to permit convergence using approximate
00494 *>                     factorizations or factorizations other than LU. If
00495 *>                     the factorization uses a technique other than
00496 *>                     Gaussian elimination, the guarantees in
00497 *>                     err_bnds_norm and err_bnds_comp may no longer be
00498 *>                     trustworthy.
00499 *>
00500 *>       PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code
00501 *>            will attempt to find a solution with small componentwise
00502 *>            relative error in the double-precision algorithm.  Positive
00503 *>            is true, 0.0 is false.
00504 *>         Default: 1.0 (attempt componentwise convergence)
00505 *> \endverbatim
00506 *>
00507 *> \param[out] WORK
00508 *> \verbatim
00509 *>          WORK is COMPLEX*16 array, dimension (2*N)
00510 *> \endverbatim
00511 *>
00512 *> \param[out] RWORK
00513 *> \verbatim
00514 *>          RWORK is DOUBLE PRECISION array, dimension (2*N)
00515 *> \endverbatim
00516 *>
00517 *> \param[out] INFO
00518 *> \verbatim
00519 *>          INFO is INTEGER
00520 *>       = 0:  Successful exit. The solution to every right-hand side is
00521 *>         guaranteed.
00522 *>       < 0:  If INFO = -i, the i-th argument had an illegal value
00523 *>       > 0 and <= N:  U(INFO,INFO) is exactly zero.  The factorization
00524 *>         has been completed, but the factor U is exactly singular, so
00525 *>         the solution and error bounds could not be computed. RCOND = 0
00526 *>         is returned.
00527 *>       = N+J: The solution corresponding to the Jth right-hand side is
00528 *>         not guaranteed. The solutions corresponding to other right-
00529 *>         hand sides K with K > J may not be guaranteed as well, but
00530 *>         only the first such right-hand side is reported. If a small
00531 *>         componentwise error is not requested (PARAMS(3) = 0.0) then
00532 *>         the Jth right-hand side is the first with a normwise error
00533 *>         bound that is not guaranteed (the smallest J such
00534 *>         that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)
00535 *>         the Jth right-hand side is the first with either a normwise or
00536 *>         componentwise error bound that is not guaranteed (the smallest
00537 *>         J such that either ERR_BNDS_NORM(J,1) = 0.0 or
00538 *>         ERR_BNDS_COMP(J,1) = 0.0). See the definition of
00539 *>         ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information
00540 *>         about all of the right-hand sides check ERR_BNDS_NORM or
00541 *>         ERR_BNDS_COMP.
00542 *> \endverbatim
00543 *
00544 *  Authors:
00545 *  ========
00546 *
00547 *> \author Univ. of Tennessee 
00548 *> \author Univ. of California Berkeley 
00549 *> \author Univ. of Colorado Denver 
00550 *> \author NAG Ltd. 
00551 *
00552 *> \date April 2012
00553 *
00554 *> \ingroup complex16GBsolve
00555 *
00556 *  =====================================================================
00557       SUBROUTINE ZGBSVXX( FACT, TRANS, N, KL, KU, NRHS, AB, LDAB, AFB,
00558      $                    LDAFB, IPIV, EQUED, R, C, B, LDB, X, LDX,
00559      $                    RCOND, RPVGRW, BERR, N_ERR_BNDS,
00560      $                    ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
00561      $                    WORK, RWORK, INFO )
00562 *
00563 *  -- LAPACK driver routine (version 3.4.1) --
00564 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00565 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00566 *     April 2012
00567 *
00568 *     .. Scalar Arguments ..
00569       CHARACTER          EQUED, FACT, TRANS
00570       INTEGER            INFO, LDAB, LDAFB, LDB, LDX, N, NRHS, NPARAMS,
00571      $                   N_ERR_BNDS
00572       DOUBLE PRECISION   RCOND, RPVGRW
00573 *     ..
00574 *     .. Array Arguments ..
00575       INTEGER            IPIV( * )
00576       COMPLEX*16         AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
00577      $                   X( LDX , * ),WORK( * )
00578       DOUBLE PRECISION   R( * ), C( * ), PARAMS( * ), BERR( * ),
00579      $                   ERR_BNDS_NORM( NRHS, * ),
00580      $                   ERR_BNDS_COMP( NRHS, * ), RWORK( * )
00581 *     ..
00582 *
00583 *  ==================================================================
00584 *
00585 *     .. Parameters ..
00586       DOUBLE PRECISION   ZERO, ONE
00587       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00588       INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
00589       INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
00590       INTEGER            CMP_ERR_I, PIV_GROWTH_I
00591       PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
00592      $                   BERR_I = 3 )
00593       PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
00594       PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
00595      $                   PIV_GROWTH_I = 9 )
00596 *     ..
00597 *     .. Local Scalars ..
00598       LOGICAL            COLEQU, EQUIL, NOFACT, NOTRAN, ROWEQU
00599       INTEGER            INFEQU, I, J, KL, KU
00600       DOUBLE PRECISION   AMAX, BIGNUM, COLCND, RCMAX, RCMIN,
00601      $                   ROWCND, SMLNUM
00602 *     ..
00603 *     .. External Functions ..
00604       EXTERNAL           LSAME, DLAMCH, ZLA_GBRPVGRW
00605       LOGICAL            LSAME
00606       DOUBLE PRECISION   DLAMCH, ZLA_GBRPVGRW
00607 *     ..
00608 *     .. External Subroutines ..
00609       EXTERNAL           ZGBEQUB, ZGBTRF, ZGBTRS, ZLACPY, ZLAQGB,
00610      $                   XERBLA, ZLASCL2, ZGBRFSX
00611 *     ..
00612 *     .. Intrinsic Functions ..
00613       INTRINSIC          MAX, MIN
00614 *     ..
00615 *     .. Executable Statements ..
00616 *
00617       INFO = 0
00618       NOFACT = LSAME( FACT, 'N' )
00619       EQUIL = LSAME( FACT, 'E' )
00620       NOTRAN = LSAME( TRANS, 'N' )
00621       SMLNUM = DLAMCH( 'Safe minimum' )
00622       BIGNUM = ONE / SMLNUM
00623       IF( NOFACT .OR. EQUIL ) THEN
00624          EQUED = 'N'
00625          ROWEQU = .FALSE.
00626          COLEQU = .FALSE.
00627       ELSE
00628          ROWEQU = LSAME( EQUED, 'R' ) .OR. LSAME( EQUED, 'B' )
00629          COLEQU = LSAME( EQUED, 'C' ) .OR. LSAME( EQUED, 'B' )
00630       END IF
00631 *
00632 *     Default is failure.  If an input parameter is wrong or
00633 *     factorization fails, make everything look horrible.  Only the
00634 *     pivot growth is set here, the rest is initialized in ZGBRFSX.
00635 *
00636       RPVGRW = ZERO
00637 *
00638 *     Test the input parameters.  PARAMS is not tested until DGERFSX.
00639 *
00640       IF( .NOT.NOFACT .AND. .NOT.EQUIL .AND. .NOT.
00641      $     LSAME( FACT, 'F' ) ) THEN
00642          INFO = -1
00643       ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'T' ) .AND. .NOT.
00644      $        LSAME( TRANS, 'C' ) ) THEN
00645          INFO = -2
00646       ELSE IF( N.LT.0 ) THEN
00647          INFO = -3
00648       ELSE IF( KL.LT.0 ) THEN
00649          INFO = -4
00650       ELSE IF( KU.LT.0 ) THEN
00651          INFO = -5
00652       ELSE IF( NRHS.LT.0 ) THEN
00653          INFO = -6
00654       ELSE IF( LDAB.LT.KL+KU+1 ) THEN
00655          INFO = -8
00656       ELSE IF( LDAFB.LT.2*KL+KU+1 ) THEN
00657          INFO = -10
00658       ELSE IF( LSAME( FACT, 'F' ) .AND. .NOT.
00659      $        ( ROWEQU .OR. COLEQU .OR. LSAME( EQUED, 'N' ) ) ) THEN
00660          INFO = -12
00661       ELSE
00662          IF( ROWEQU ) THEN
00663             RCMIN = BIGNUM
00664             RCMAX = ZERO
00665             DO 10 J = 1, N
00666                RCMIN = MIN( RCMIN, R( J ) )
00667                RCMAX = MAX( RCMAX, R( J ) )
00668  10         CONTINUE
00669             IF( RCMIN.LE.ZERO ) THEN
00670                INFO = -13
00671             ELSE IF( N.GT.0 ) THEN
00672                ROWCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM )
00673             ELSE
00674                ROWCND = ONE
00675             END IF
00676          END IF
00677          IF( COLEQU .AND. INFO.EQ.0 ) THEN
00678             RCMIN = BIGNUM
00679             RCMAX = ZERO
00680             DO 20 J = 1, N
00681                RCMIN = MIN( RCMIN, C( J ) )
00682                RCMAX = MAX( RCMAX, C( J ) )
00683  20         CONTINUE
00684             IF( RCMIN.LE.ZERO ) THEN
00685                INFO = -14
00686             ELSE IF( N.GT.0 ) THEN
00687                COLCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM )
00688             ELSE
00689                COLCND = ONE
00690             END IF
00691          END IF
00692          IF( INFO.EQ.0 ) THEN
00693             IF( LDB.LT.MAX( 1, N ) ) THEN
00694                INFO = -15
00695             ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
00696                INFO = -16
00697             END IF
00698          END IF
00699       END IF
00700 *
00701       IF( INFO.NE.0 ) THEN
00702          CALL XERBLA( 'ZGBSVXX', -INFO )
00703          RETURN
00704       END IF
00705 *
00706       IF( EQUIL ) THEN
00707 *
00708 *     Compute row and column scalings to equilibrate the matrix A.
00709 *
00710          CALL ZGBEQUB( N, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND,
00711      $        AMAX, INFEQU )
00712          IF( INFEQU.EQ.0 ) THEN
00713 *
00714 *     Equilibrate the matrix.
00715 *
00716             CALL ZLAQGB( N, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND,
00717      $           AMAX, EQUED )
00718             ROWEQU = LSAME( EQUED, 'R' ) .OR. LSAME( EQUED, 'B' )
00719             COLEQU = LSAME( EQUED, 'C' ) .OR. LSAME( EQUED, 'B' )
00720          END IF
00721 *
00722 *     If the scaling factors are not applied, set them to 1.0.
00723 *
00724          IF ( .NOT.ROWEQU ) THEN
00725             DO J = 1, N
00726                R( J ) = 1.0D+0
00727             END DO
00728          END IF
00729          IF ( .NOT.COLEQU ) THEN
00730             DO J = 1, N
00731                C( J ) = 1.0D+0
00732             END DO
00733          END IF
00734       END IF
00735 *
00736 *     Scale the right-hand side.
00737 *
00738       IF( NOTRAN ) THEN
00739          IF( ROWEQU ) CALL ZLASCL2( N, NRHS, R, B, LDB )
00740       ELSE
00741          IF( COLEQU ) CALL ZLASCL2( N, NRHS, C, B, LDB )
00742       END IF
00743 *
00744       IF( NOFACT .OR. EQUIL ) THEN
00745 *
00746 *        Compute the LU factorization of A.
00747 *
00748          DO 40, J = 1, N
00749             DO 30, I = KL+1, 2*KL+KU+1
00750                AFB( I, J ) = AB( I-KL, J )
00751  30         CONTINUE
00752  40      CONTINUE
00753          CALL ZGBTRF( N, N, KL, KU, AFB, LDAFB, IPIV, INFO )
00754 *
00755 *        Return if INFO is non-zero.
00756 *
00757          IF( INFO.GT.0 ) THEN
00758 *
00759 *           Pivot in column INFO is exactly 0
00760 *           Compute the reciprocal pivot growth factor of the
00761 *           leading rank-deficient INFO columns of A.
00762 *
00763             RPVGRW = ZLA_GBRPVGRW( N, KL, KU, INFO, AB, LDAB, AFB,
00764      $           LDAFB )
00765             RETURN
00766          END IF
00767       END IF
00768 *
00769 *     Compute the reciprocal pivot growth factor RPVGRW.
00770 *
00771       RPVGRW = ZLA_GBRPVGRW( N, KL, KU, N, AB, LDAB, AFB, LDAFB )
00772 *
00773 *     Compute the solution matrix X.
00774 *
00775       CALL ZLACPY( 'Full', N, NRHS, B, LDB, X, LDX )
00776       CALL ZGBTRS( TRANS, N, KL, KU, NRHS, AFB, LDAFB, IPIV, X, LDX,
00777      $     INFO )
00778 *
00779 *     Use iterative refinement to improve the computed solution and
00780 *     compute error bounds and backward error estimates for it.
00781 *
00782       CALL ZGBRFSX( TRANS, EQUED, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB,
00783      $     IPIV, R, C, B, LDB, X, LDX, RCOND, BERR,
00784      $     N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
00785      $     WORK, RWORK, INFO )
00786 
00787 *
00788 *     Scale solutions.
00789 *
00790       IF ( COLEQU .AND. NOTRAN ) THEN
00791          CALL ZLASCL2( N, NRHS, C, X, LDX )
00792       ELSE IF ( ROWEQU .AND. .NOT.NOTRAN ) THEN
00793          CALL ZLASCL2( N, NRHS, R, X, LDX )
00794       END IF
00795 *
00796       RETURN
00797 *
00798 *     End of ZGBSVXX
00799 *
00800       END
 All Files Functions