XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ zhpsvx()

void zhpsvx ( char  fact,
char  uplo,
int  n,
int  nrhs,
doublecomplex  ap[],
doublecomplex  afp[],
int  ipiv[],
int  ldb,
doublecomplex  b[],
int  ldx,
doublecomplex  x[],
double *  rcond,
double  ferr[],
double  berr[],
doublecomplex  work[],
double  rwork[],
int *  info 
)

(Expert driver) Solution to system of linear equations AX = B for a Hermitian matrix in packed form

Purpose
This routine uses the diagonal pivoting factorization A = U*D*U^H or A = L*D*L^H to computes the solution to a complex system of linear equations
A * X = B
where A is an n x n Hermitian matrix stored in packed form, 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:

  1. If fact = 'N', the diagonal pivoting method is used to factor A as
    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 Hermitian and block diagonal with 1 x 1 and 2 x 2 diagonal blocks.
  2. 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.
  3. The system of equations is solved for X using the factored form of A.
  4. Iterative refinement is applied to improve the computed solution matrix and calculate error bounds and backward error estimates for it.
Parameters
[in]factSpecifies whether or not the factored form of A has been supplied on entry.
= 'F': afp[] and ipiv[] contain the factored form of A. afp[] and ipiv[] will not be modified.
= 'N': The matrix A will be copied to afp[] and factored.
[in]uplo= 'U': Upper triangle of A is stored.
= 'L': Lower triangle of A is stored.
[in]nNumber of linear equations, i.e., order of the matrix A. (n >= 0) (If n = 0, returns without computation)
[in]nrhsNumber of right hand sides, i.e., number of columns of the matrix B and X. (nrhs >= 0) (if nrhs = 0, returns without computation)
[in]ap[]Array ap[lap] (lap >= n(n + 1)/2)
n x n Hermitian matrix A in packed form. The upper or lower part is to be stored in accordance with uplo.
[in,out]afp[]Array afp[lafp] (lafp >= n(n + 1)/2)
[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 zhptrf, to be stored as a packed triangular matrix in the same storage format as ap[].
[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 as computed by zhptrf, stored as a packed triangular matrix in the same storage format as ap[].
[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 zhptrf, 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 zhptrf, are returned.
[in]ldbLeading 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]ldxLeading 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]rcondThe 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] (lwork >= 2*n)
Work array.
[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)
= -8: The argument ldb had an illegal value (ldb < max(1, n))
= -10: The argument ldx had an illegal value (ldx < max(1, n))
= 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