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

◆ zgtsvx()

void zgtsvx ( char  fact,
char  trans,
int  n,
int  nrhs,
doublecomplex  dl[],
doublecomplex  d[],
doublecomplex  du[],
doublecomplex  dlf[],
doublecomplex  df[],
doublecomplex  duf[],
doublecomplex  du2[],
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 complex tridiagonal matrix)

Purpose
This routine uses the LU factorization to computes the solution to a complex system of linear equations
A * X = B, A^T * X = B or A^H * X = B
where A is a tridiagonal matrix of order n 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 LU decomposition is used to factor the matrix A as
    A = L * U
    where L is a product of permutation and unit lower bidiagonal matrices and U is upper triangular with nonzeros in only the main diagonal and first two super-diagonals.
  2. If i-th diagonal element of U = 0, so that U 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': dlf[], df[], duf[], du2[] and ipiv[] contain the factored form of A; dlf[], df[], duf[], du2[] and ipiv[] will not be modified.
= 'N': The matrix will be copied to dlf[], df[] and duf[] and factored.
[in]transSpecifies the form of the system of equations:
= 'N': A * X = B. (no transpose)
= 'T': A^T * X = B. (transpose)
= 'C': A^H * X = B. (conjugate transpose)
[in]nOrder 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. (nrhs >= 0) (if nrhs = 0, returns without computation)
[in]dl[]Array dl[ldl] (ldl >= n - 1)
n-1 sub-diagonal elements of A.
[in]d[]Array d[ld] (ld >= n)
n diagonal elements of A.
[in]du[]Array du[ldu] (ldu >= n - 1)
n-1 super-diagonal elements of A.
[in,out]dlf[]Array dlf[ldlf] (ldlf >= n - 1)
[in] If fact = 'F', (n-1) multipliers that define the matrix L from the LU factorization of A as computed by zgttrf, are to be stored.
[out] If fact = 'N', (n-1) multipliers that define the matrix L from the LU factorization of A, are returned.
[in,out]df[]Array df[ldf] (ldf >= n)
[in] If fact = 'F', diagonal elements of the upper triangular matrix U from the LU factorization of A, are to be stored.
[out] If fact = 'N', diagonal elements of the upper triangular matrix U from the LU factorization of A, are returned.
[in,out]duf[]Array duf[lduf] (lduf >= n - 1)
[in] If fact = 'F', (n-1) elements of the first super-diagonal of U, are to be stored.
[out] If fact = 'N', (n-1) elements of the first super-diagonal of U, are returned.
[in,out]du2[]Array du2[ldu2] (ldu2 >= n - 2)
[in] If fact = 'F', (n-2) elements of the second super-diagonal of U, are to be stored.
[out] If fact = 'N', (n-2) elements of the second super-diagonal of U, are returned.
[in,out]ipiv[]Array ipiv[lipiv] (lipiv >= n)
[in] If fact = 'F', the pivot indices from the LU factorization of A as computed by zgttrf, are to be stored.
[out] If fact = 'N', the pivot indices from the LU factorization of A are returned; row i of the matrix was interchanged with row ipiv[i-1]. ipiv[i-1] will always be either i or i+1; ipiv[i-1] = i indicates a row interchange was not required.
[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 trans had an illegal value (trans != 'N', 'T' nor 'C')
= -3: The argument n had an illegal value (n < 0)
= -4: The argument nrhs had an illegal value (nrhs < 0)
= -13: The argument ldb had an illegal value (ldb < max(1, n))
= -15: The argument ldx had an illegal value (ldx < max(1, n))
= i (0 < i <= n): The i-th diagonal element of the factor U is exactly zero. The factorization has not been completed unless i = n, but the factor U is exactly singular, so the solution and error bounds could not be computed. rcond = 0 is returned.
= n+1: U 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