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

◆ zcgesv()

void zcgesv ( int  n,
int  nrhs,
int  lda,
doublecomplex  a[],
int  ipiv[],
int  ldb,
doublecomplex  b[],
int  ldx,
doublecomplex  x[],
doublecomplex  work[],
floatcomplex  swork[],
double  rwork[],
int *  iter,
int *  info 
)

(Simple driver) Solution to system of linear equations AX = B for a complex matrix (mixed precision with iterative refinement)

Purpose
This routine computes the solution to a complex system of linear equations
A * X = B
where A is an n x n matrix and X and B are n x nrhs matrices.

zcgesv first attempts to factorize the matrix in single precision and use this factorization within an iterative refinement procedure to produce a solution with double precision normwise backward error quality (see below). If the approach fails the method switches to a double precision factorization and solve.

The iterative refinement is not going to be a winning strategy if the ratio single precision performance over double precision performance is too small. A reasonable strategy should take the number of right-hand sides and the size of the matrix into account. Up to now, we always try iterative refinement.

The iterative refinement process is stopped if
  iter > itermax
or for all the rhs we have:
  rnrm < sqrt(n)*xnrm*anrm*eps*bwdmax
where
  iter is the number of the current iteration in the iterative refinement process
  rnrm is the infinity-norm of the residual
  xnrm is the infinity-norm of the solution
  anrm is the infinity-operator-norm of the matrix A
  eps is the machine epsilon returned by dlamch('E')
The value itermax and bwdmax are fixed to 30 and 1.0D+00 respectively.
Parameters
[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. (nrhs >= 0)
[in]ldaLeading dimension of the two dimensional array a[][]. (lda >= max(1, n))
[in,out]a[][]Array a[la][lda] (la >= n)
[in] n x n coefficient matrix A.
[out] If iterative refinement has been successfully used (info = 0 and iter >= 0, see description below), then a[][] is unchanged. If double precision factorization has been used (info = 0 and iter < 0, see description below), then the array a[][] contains the factors L and U from the factorization A = P*L*U; the unit diagonal elements of L are not stored.
[out]ipiv[]Array ipiv[lipiv] (lipiv >= n)
Pivot indices that define the permutation matrix P; row i of the matrix was interchanged with row ipiv[i-1]. Corresponds either to the single precision factorization (if info = 0 and iter >= 0) or the double precision factorization (if info = 0 and iter < 0).
[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, n x nrhs solution matrix X.
[out]work[]Array work[lwork] (lwork >= n*nrhs)
This array is used to hold the residual vectors.
[out]swork[]Array swork[lswork] (lswork >= n*(n + nrhs))
This array is used to use the single precision matrix and the right-hand sides or solutions in single precision.
[out]rwork[]Array rwork[lrwork] (lrwork >= n)
Work array.
[out]iter< 0: Iterative refinement has failed, double precision factorization has been performed.
  = -1: The routine fell back to full precision for implementation- or machine-specific reasons.
  = -2: Narrowing the precision induced an overflow, the routine fell back to full precision.
  = -3: Failure of cgetrf.
  = -31: Stop the iterative refinement after the 30th iterations.
> 0: Iterative refinement has been successfully used. Returns the number of iterations.
[out]info= 0: Successful exit
= -1: The argument n had an illegal value (n < 0)
= -2: The argument nrhs had an illegal value (nrhs < 0)
= -3: The argument lda had an illegal value (lda < max(1, n))
= -6: The argument ldb had an illegal value (ldb < max(1, n))
= -8: The argument ldx had an illegal value (ldx < max(1, n))
= i > 0: The i-th diagonal element of the factor U computed in double precision is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution could not be computed.
Reference
LAPACK