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