|
|
◆ zhesvx()
| void zhesvx |
( |
char |
fact, |
|
|
char |
uplo, |
|
|
int |
n, |
|
|
int |
nrhs, |
|
|
int |
lda, |
|
|
doublecomplex |
a[], |
|
|
int |
ldaf, |
|
|
doublecomplex |
af[], |
|
|
int |
ipiv[], |
|
|
int |
ldb, |
|
|
doublecomplex |
b[], |
|
|
int |
ldx, |
|
|
doublecomplex |
x[], |
|
|
double * |
rcond, |
|
|
double |
ferr[], |
|
|
double |
berr[], |
|
|
doublecomplex |
work[], |
|
|
int |
lwork, |
|
|
double |
rwork[], |
|
|
int * |
info |
|
) |
| |
(Expert driver) Solution to system of linear equations AX = B for a Hermitian matrix
- Purpose
- This routine uses the diagonal pivoting factorization to computes the solution to a complex system of linear equations where A is an n x n Hermitian matrix, and X and B are n x nrhs matrices.
Error bounds on the solution and a condition estimate are also provided.
- Description
- The following steps are performed:
- If fact = 'N', the diagonal pivoting method is used to factor A. The form of the factorization is
A = U * D * U^H, if uplo = 'U', or
A = L * D * L^H, if uplo = 'L',
where U (or L) is a product of permutation and unit upper (lower) triangular matrices, and D is symmetric and block diagonal with 1 x 1 and 2 x 2 diagonal blocks.
- If some i-th diagonal element of D = 0, so that D is exactly singular, then the routine returns with info = i. Otherwise, the factored form of A is used to estimate the condition number of the matrix A. If the reciprocal of the condition number is less than machine precision, info = n+1 is returned as a warning, but the routine still goes on to solve for X and compute error bounds as described below.
- The system of equations is solved for X using the factored form of A.
- Iterative refinement is applied to improve the computed solution matrix and calculate error bounds and backward error estimates for it.
- Parameters
-
| [in] | fact | Specifies whether or not the factored form of A has been supplied on entry.
= 'F': af[][] and ipiv[] contain the factored form of A. af[][] and ipiv[] will not be modified.
= 'N': The matrix A will be copied to af[][] and factored. |
| [in] | uplo | = 'U': Upper triangle of A is stored.
= 'L': Lower triangle of A is stored. |
| [in] | n | Number of linear equations, i.e., order of the matrix A. (n >= 0) (If n = 0, returns without computation) |
| [in] | nrhs | Number of right hand sides, i.e., number of columns of the matrix B and X. (nrhs >= 0) (if nrhs = 0, returns without computation) |
| [in] | lda | Leading dimension of the two dimensional array a[][]. (lda >= max(1, n)) |
| [in] | a[][] | Array a[la][lda] (la >= n)
n x n Hermitian matrix A. The upper or lower triangular part is to be referenced in accordance with uplo. |
| [in] | ldaf | Leading dimension of the two dimensional array af[][]. (ldaf >= max(1, n)) |
| [in,out] | af[][] | Array af[laf][ldaf] (laf >= n)
[in] If fact = 'F', the block diagonal matrix D and the multipliers used to obtain the factor U or L from the factorization A = U*D*U^H or A = L*D*L^H as computed by zhetrf.
[out] If fact = 'N', the block diagonal matrix D and the multipliers used to obtain the factor U or L from the factorization A = U*D*U^H or A = L*D*L^H. |
| [in,out] | ipiv[] | Array ipiv[lipiv] (lipiv >= n)
[in] If fact = 'F', details of the interchanges and the block structure of D, as determined by zhetrf, are to be stored.
If ipiv[k-1] > 0, then rows and columns k and ipiv[k-1] were interchanged, and k-th diagonal of D is a 1 x 1 diagonal block.
If uplo = 'U' and ipiv[k-1] = ipiv[k-2] < 0, then rows and columns k-1 and -ipiv[k-1] were interchanged and (k-1)-th diagonal of D is a 2 x 2 diagonal block.
If uplo = 'L' and ipiv[k-1] = ipiv[k] < 0, then rows and columns k+1 and -ipiv[k-1] were interchanged and k-th diagonal of D is a 2 x 2 diagonal block.
[out] If fact = 'N', details of the interchanges and the block structure of D, as determined by zhetrf, are returned. |
| [in] | ldb | Leading dimension of the two dimensional array b[][]. (ldb >= max(1, n)) |
| [in] | b[][] | Array b[lb][ldb] (lb >= nrhs)
n x nrhs right hand side matrix B. |
| [in] | ldx | Leading dimension of the two dimensional array x[][]. (ldx >= max(1, n)) |
| [out] | x[][] | Array x[lx][ldx] (lx >= nrhs)
If info = 0 or info = n+1, n x nrhs solution matrix X. |
| [out] | rcond | The estimate of the reciprocal condition number of the matrix A. If rcond is less than the machine precision (in particular, if rcond = 0), the matrix is singular to working precision. This condition is indicated by a return code of info > 0. |
| [out] | ferr[] | Array ferr[lferr] (lferr >= nrhs)
The estimated forward error bound for each solution vector X(j) (the j-th column of the solution matrix X). If Xtrue is the true solution corresponding to X(j), ferr[j-1] is an estimated upper bound for the magnitude of the largest element in (X(j) - Xtrue) divided by the magnitude of the largest element in X(j). The estimate is as reliable as the estimate for rcond, and is almost always a slight overestimate of the true error. |
| [out] | berr[] | Array berr[lberr] (lberr >= nrhs)
The componentwise relative backward error of each solution vector X(j) (i.e., the smallest relative change in any element of A or B that makes X(j) an exact solution). |
| [out] | work[] | Array work[lwork]
Work array
On exit, if info = 0, work[0] returns the optimal lwork. |
| [in] | lwork | The length of work[] (lwork >= max(1, 2*n))
For best performance, when fact = 'N', lwork >= max(1, 2*n, n*nb), where nb is the optimal blocksize for zhetrf.
If lwork = -1, then a workspace query is assumed. The routine only calculates the optimal size of the work array and returns the value in work[0]. |
| [out] | rwork[] | Array rwork[lrwork] (lrwork >= n)
Work array. |
| [out] | info | = 0: Successful exit
= -1: The argument fact had an illegal value (fact != 'F' nor 'N')
= -2: The argument uplo had an illegal value (uplo != 'U' nor 'L')
= -3: The argument n had an illegal value (n < 0)
= -4: The argument nrhs had an illegal value (nrhs < 0)
= -5: The argument lda had an illegal value (lda < max(1, n))
= -7: The argument ldaf had an illegal value (ldaf < max(1, n))
= -10: The argument ldb had an illegal value (ldb < max(1, n))
= -12: The argument ldx had an illegal value (ldx < max(1, n))
= -18: The argument lwork had an illegal value (lwork too small)
= i (0 < i <= n): The i-th element of the factor D is exactly zero. The factorization has been completed, but the factor D is exactly singular, so the solution and error bounds could not be computed. rcond = 0 is returned.
= n+1: D is nonsingular, but rcond is less than machine precision, meaning that the matrix is singular to working precision. Nevertheless, the solution and error bounds are computed because there are a number of situations where the computed solution can be more accurate than the value of rcond would suggest. |
- Reference
- LAPACK
|