hesvx#

Functions

void chesvx(
    const char*          fact,
    const char*          uplo,
    const INT            n,
    const INT            nrhs,
    const c64*  restrict A,
    const INT            lda,
          c64*  restrict AF,
    const INT            ldaf,
          INT*  restrict ipiv,
    const c64*  restrict B,
    const INT            ldb,
          c64*  restrict X,
    const INT            ldx,
          f32*           rcond,
          f32*  restrict ferr,
          f32*  restrict berr,
          c64*  restrict work,
    const INT            lwork,
          f32*  restrict rwork,
          INT*           info
);
void chesvx(const char *fact, const char *uplo, const INT n, const INT nrhs, const c64 *restrict A, const INT lda, c64 *restrict AF, const INT ldaf, INT *restrict ipiv, const c64 *restrict B, const INT ldb, c64 *restrict X, const INT ldx, f32 *rcond, f32 *restrict ferr, f32 *restrict berr, c64 *restrict work, const INT lwork, f32 *restrict rwork, INT *info)#

CHESVX uses the diagonal pivoting factorization to compute the solution to a complex system of linear equations A * X = B, where A is an N-by-N Hermitian matrix and X and B are N-by-NRHS matrices.

Error bounds on the solution and a condition estimate are also provided.

The following steps are performed:

  1. 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 Hermitian and block diagonal with 1-by-1 and 2-by-2 diagonal blocks.

  2. If some D(i,i)=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
fact

  • 'F': On entry, 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

The number of linear equations, i.e., the order of the matrix A. n>=0.

in
nrhs

The number of right hand sides. nrhs>=0.

in
A

Array of dimension (lda,n). The Hermitian matrix A.

in
lda

The leading dimension of the array A. lda>=max(1,n).

inout
AF

Array of dimension (ldaf,n). If fact='F', then AF is an input argument and on entry contains 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 chetrf. If fact='N', then AF is an output argument and on exit returns the block diagonal matrix D and the multipliers used to obtain the factor U or L.

in
ldaf

The leading dimension of the array AF. ldaf>=max(1,n).

inout
ipiv

Array of dimension n. Pivot indices (0-based). If fact='F', then ipiv is an input argument and on entry contains details of the interchanges and the block structure of D, as determined by chetrf. If ipiv[k]>=0, then rows and columns k and ipiv[k] were interchanged and D(k,k) is a 1-by-1 diagonal block. If uplo='U' and ipiv[k]=ipiv[k-1]<0, then rows and columns k-1 and -ipiv[k]-1 were interchanged and D(k-1:k,k-1:k) is a 2-by-2 diagonal block. If uplo='L' and ipiv[k]=ipiv[k+1]<0, then rows and columns k+1 and -ipiv[k]-1 were interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block. If fact='N', then ipiv is an output argument and on exit contains details of the interchanges and the block structure of D, as determined by chetrf.

in
B

Array of dimension (ldb,nrhs). The n-by-nrhs right hand side matrix B.

in
ldb

The leading dimension of the array B. ldb>=max(1,n).

out
X

Array of dimension (ldx,nrhs). If info=0 or info=n+1, the n-by-nrhs solution matrix X.

in
ldx

The leading dimension of the array X. ldx>=max(1,n).

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 of dimension nrhs. The estimated forward error bound for each solution vector X(j).

out
berr

Array of dimension nrhs. The componentwise relative backward error of each solution vector X(j).

out
work

Array of dimension max(1,lwork). On exit, if info=0, work[0] returns the optimal lwork.

in
lwork

The length of work. lwork>=max(1,2*n), and for best performance, when fact='N', lwork>=max(1,2*n,n*nb), where nb is the optimal block size for chetrf. If lwork=-1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued.

out
rwork

Array of dimension n.

out
info

  • info=0: successful exit

  • info<0: if info=-i, the i-th argument had an illegal value

  • info>0: if info=i, and i<=n, D(i,i) is exactly zero. The factorization has been completed but D is exactly singular, so the solution and error bounds could not be computed. rcond=0 is returned.

  • info=n+1: D is nonsingular, but rcond is less than machine precision, meaning that the matrix is singular to working precision.

Functions

void zhesvx(
    const char*          fact,
    const char*          uplo,
    const INT            n,
    const INT            nrhs,
    const c128* restrict A,
    const INT            lda,
          c128* restrict AF,
    const INT            ldaf,
          INT*  restrict ipiv,
    const c128* restrict B,
    const INT            ldb,
          c128* restrict X,
    const INT            ldx,
          f64*           rcond,
          f64*  restrict ferr,
          f64*  restrict berr,
          c128* restrict work,
    const INT            lwork,
          f64*  restrict rwork,
          INT*           info
);
void zhesvx(const char *fact, const char *uplo, const INT n, const INT nrhs, const c128 *restrict A, const INT lda, c128 *restrict AF, const INT ldaf, INT *restrict ipiv, const c128 *restrict B, const INT ldb, c128 *restrict X, const INT ldx, f64 *rcond, f64 *restrict ferr, f64 *restrict berr, c128 *restrict work, const INT lwork, f64 *restrict rwork, INT *info)#

ZHESVX uses the diagonal pivoting factorization to compute the solution to a complex system of linear equations A * X = B, where A is an N-by-N Hermitian matrix and X and B are N-by-NRHS matrices.

Error bounds on the solution and a condition estimate are also provided.

The following steps are performed:

  1. 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 Hermitian and block diagonal with 1-by-1 and 2-by-2 diagonal blocks.

  2. If some D(i,i)=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
fact

  • 'F': On entry, 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

The number of linear equations, i.e., the order of the matrix A. n>=0.

in
nrhs

The number of right hand sides. nrhs>=0.

in
A

Array of dimension (lda,n). The Hermitian matrix A.

in
lda

The leading dimension of the array A. lda>=max(1,n).

inout
AF

Array of dimension (ldaf,n). If fact='F', then AF is an input argument and on entry contains 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. If fact='N', then AF is an output argument and on exit returns the block diagonal matrix D and the multipliers used to obtain the factor U or L.

in
ldaf

The leading dimension of the array AF. ldaf>=max(1,n).

inout
ipiv

Array of dimension n. Pivot indices (0-based). If fact='F', then ipiv is an input argument and on entry contains details of the interchanges and the block structure of D, as determined by zhetrf. If ipiv[k]>=0, then rows and columns k and ipiv[k] were interchanged and D(k,k) is a 1-by-1 diagonal block. If uplo='U' and ipiv[k]=ipiv[k-1]<0, then rows and columns k-1 and -ipiv[k]-1 were interchanged and D(k-1:k,k-1:k) is a 2-by-2 diagonal block. If uplo='L' and ipiv[k]=ipiv[k+1]<0, then rows and columns k+1 and -ipiv[k]-1 were interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block. If fact='N', then ipiv is an output argument and on exit contains details of the interchanges and the block structure of D, as determined by zhetrf.

in
B

Array of dimension (ldb,nrhs). The n-by-nrhs right hand side matrix B.

in
ldb

The leading dimension of the array B. ldb>=max(1,n).

out
X

Array of dimension (ldx,nrhs). If info=0 or info=n+1, the n-by-nrhs solution matrix X.

in
ldx

The leading dimension of the array X. ldx>=max(1,n).

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 of dimension nrhs. The estimated forward error bound for each solution vector X(j).

out
berr

Array of dimension nrhs. The componentwise relative backward error of each solution vector X(j).

out
work

Array of dimension max(1,lwork). On exit, if info=0, work[0] returns the optimal lwork.

in
lwork

The length of work. lwork>=max(1,2*n), and for best performance, when fact='N', lwork>=max(1,2*n,n*nb), where nb is the optimal block size for zhetrf. If lwork=-1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued.

out
rwork

Array of dimension n.

out
info

  • info=0: successful exit

  • info<0: if info=-i, the i-th argument had an illegal value

  • info>0: if info=i, and i<=n, D(i,i) is exactly zero. The factorization has been completed but D is exactly singular, so the solution and error bounds could not be computed. rcond=0 is returned.

  • info=n+1: D is nonsingular, but rcond is less than machine precision, meaning that the matrix is singular to working precision.