Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_lapack_zgesvx (f07ap)

Purpose

nag_lapack_zgesvx (f07ap) uses the LU$LU$ factorization to compute the solution to a complex system of linear equations
 AX = B   or   ATX = B   or   AHX = B , $AX=B or ATX=B or AHX=B ,$
where A$A$ is an n$n$ by n$n$ matrix and X$X$ and B$B$ are n$n$ by r$r$ matrices. Error bounds on the solution and a condition estimate are also provided.

Syntax

[a, af, ipiv, equed, r, c, b, x, rcond, ferr, berr, rwork, info] = f07ap(fact, trans, a, af, ipiv, equed, r, c, b, 'n', n, 'nrhs_p', nrhs_p)
[a, af, ipiv, equed, r, c, b, x, rcond, ferr, berr, rwork, info] = nag_lapack_zgesvx(fact, trans, a, af, ipiv, equed, r, c, b, 'n', n, 'nrhs_p', nrhs_p)

Description

nag_lapack_zgesvx (f07ap) performs the following steps:
1. Equilibration
The linear system to be solved may be badly scaled. However, the system can be equilibrated as a first stage by setting fact = 'E'${\mathbf{fact}}=\text{'E'}$. In this case, real scaling factors are computed and these factors then determine whether the system is to be equilibrated. Equilibrated forms of the systems AX = B $AX=B$, ATX = B ${A}^{\mathrm{T}}X=B$ and AHX = B ${A}^{\mathrm{H}}X=B$ are
 (DRADC) (DC − 1X) = DR B , $( DR A DC ) ( DC-1X ) = DR B ,$
 (DRADC)T (DR − 1X) = DC B , $( DR A DC )T ( DR-1 X ) = DC B ,$
and
 (DRADC)H (DR − 1X) = DC B , $( DR A DC )H ( DR-1 X ) = DC B ,$
respectively, where DR ${D}_{R}$ and DC ${D}_{C}$ are diagonal matrices, with positive diagonal elements, formed from the computed scaling factors.
When equilibration is used, A$A$ will be overwritten by DR A DC ${D}_{R}A{D}_{C}$ and B$B$ will be overwritten by DR B ${D}_{R}B$ (or DC B ${D}_{C}B$ when the solution of ATX = B ${A}^{\mathrm{T}}X=B$ or AHX = B ${A}^{\mathrm{H}}X=B$ is sought).
2. Factorization
The matrix A$A$, or its scaled form, is copied and factored using the LU$LU$ decomposition
 A = PLU , $A=PLU ,$
where P$P$ is a permutation matrix, L$L$ is a unit lower triangular matrix, and U$U$ is upper triangular.
This stage can be by-passed when a factored matrix (with scaled matrices and scaling factors) are supplied; for example, as provided by a previous call to nag_lapack_zgesvx (f07ap) with the same matrix A$A$.
3. Condition Number Estimation
The LU$LU$ factorization of A$A$ determines whether a solution to the linear system exists. If some diagonal element of U$U$ is zero, then U$U$ is exactly singular, no solution exists and the function returns with a failure. Otherwise the factorized form of A$A$ is used to estimate the condition number of the matrix A$A$. If the reciprocal of the condition number is less than machine precision then a warning code is returned on final exit.
4. Solution
The (equilibrated) system is solved for X$X$ ( DC1X ${D}_{C}^{-1}X$ or DR1X ${D}_{R}^{-1}X$) using the factored form of A$A$ ( DRADC ${D}_{R}A{D}_{C}$).
5. Iterative Refinement
Iterative refinement is applied to improve the computed solution matrix and to calculate error bounds and backward error estimates for the computed solution.
6. Construct Solution Matrix X$X$
If equilibration was used, the matrix X$X$ is premultiplied by DC ${D}_{C}$ (if trans = 'N'${\mathbf{trans}}=\text{'N'}$) or DR ${D}_{R}$ (if trans = 'T'${\mathbf{trans}}=\text{'T'}$ or 'C'$\text{'C'}$) so that it solves the original system before equilibration.

References

Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia http://www.netlib.org/lapack/lug
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Higham N J (2002) Accuracy and Stability of Numerical Algorithms (2nd Edition) SIAM, Philadelphia

Parameters

Compulsory Input Parameters

1:     fact – string (length ≥ 1)
Specifies whether or not the factorized form of the matrix A$A$ is supplied on entry, and if not, whether the matrix A$A$ should be equilibrated before it is factorized.
fact = 'F'${\mathbf{fact}}=\text{'F'}$
af and ipiv contain the factorized form of A$A$. If equed'N'${\mathbf{equed}}\ne \text{'N'}$, the matrix A$A$ has been equilibrated with scaling factors given by r and c. a, af and ipiv are not modified.
fact = 'N'${\mathbf{fact}}=\text{'N'}$
The matrix A$A$ will be copied to af and factorized.
fact = 'E'${\mathbf{fact}}=\text{'E'}$
The matrix A$A$ will be equilibrated if necessary, then copied to af and factorized.
Constraint: fact = 'F'${\mathbf{fact}}=\text{'F'}$, 'N'$\text{'N'}$ or 'E'$\text{'E'}$.
2:     trans – string (length ≥ 1)
Specifies the form of the system of equations.
trans = 'N'${\mathbf{trans}}=\text{'N'}$
AX = B$AX=B$ (No transpose).
trans = 'T'${\mathbf{trans}}=\text{'T'}$
ATX = B${A}^{\mathrm{T}}X=B$ (Transpose).
trans = 'C'${\mathbf{trans}}=\text{'C'}$
AHX = B${A}^{\mathrm{H}}X=B$ (Conjugate transpose).
Constraint: trans = 'N'${\mathbf{trans}}=\text{'N'}$, 'T'$\text{'T'}$ or 'C'$\text{'C'}$.
3:     a(lda, : $:$) – complex array
The first dimension of the array a must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The second dimension of the array must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The n$n$ by n$n$ matrix A$A$.
If fact = 'F'${\mathbf{fact}}=\text{'F'}$ and equed'N'${\mathbf{equed}}\ne \text{'N'}$, a must have been equilibrated by the scaling factors in r and/or c.
4:     af(ldaf, : $:$) – complex array
The first dimension of the array af must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The second dimension of the array must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
If fact = 'F'${\mathbf{fact}}=\text{'F'}$, af contains the factors L$L$ and U$U$ from the factorization A = PLU$A=PLU$ as computed by nag_lapack_zgetrf (f07ar). If equed'N'${\mathbf{equed}}\ne \text{'N'}$, af is the factorized form of the equilibrated matrix A$A$.
If fact = 'N'${\mathbf{fact}}=\text{'N'}$ or 'E'$\text{'E'}$, af need not be set.
5:     ipiv( : $:$) – int64int32nag_int array
Note: the dimension of the array ipiv must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
If fact = 'F'${\mathbf{fact}}=\text{'F'}$, ipiv contains the pivot indices from the factorization A = PLU$A=PLU$ as computed by nag_lapack_zgetrf (f07ar); at the i$i$th step row i$i$ of the matrix was interchanged with row ipiv(i)${\mathbf{ipiv}}\left(i\right)$. ipiv(i) = i${\mathbf{ipiv}}\left(i\right)=i$ indicates a row interchange was not required.
If fact = 'N'${\mathbf{fact}}=\text{'N'}$ or 'E'$\text{'E'}$, ipiv need not be set.
6:     equed – string (length ≥ 1)
If fact = 'N'${\mathbf{fact}}=\text{'N'}$ or 'E'$\text{'E'}$, equed need not be set.
If fact = 'F'${\mathbf{fact}}=\text{'F'}$, equed must specify the form of the equilibration that was performed as follows:
• if equed = 'N'${\mathbf{equed}}=\text{'N'}$, no equilibration;
• if equed = 'R'${\mathbf{equed}}=\text{'R'}$, row equilibration, i.e., A$A$ has been premultiplied by DR${D}_{R}$;
• if equed = 'C'${\mathbf{equed}}=\text{'C'}$, column equilibration, i.e., A$A$ has been postmultiplied by DC${D}_{C}$;
• if equed = 'B'${\mathbf{equed}}=\text{'B'}$, both row and column equilibration, i.e., A$A$ has been replaced by DRADC${D}_{R}A{D}_{C}$.
Constraint: if fact = 'F'${\mathbf{fact}}=\text{'F'}$, equed = 'N'${\mathbf{equed}}=\text{'N'}$, 'R'$\text{'R'}$, 'C'$\text{'C'}$ or 'B'$\text{'B'}$.
7:     r( : $:$) – double array
Note: the dimension of the array r must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
If fact = 'N'${\mathbf{fact}}=\text{'N'}$ or 'E'$\text{'E'}$, r need not be set.
If fact = 'F'${\mathbf{fact}}=\text{'F'}$ and equed = 'R'${\mathbf{equed}}=\text{'R'}$ or 'B'$\text{'B'}$, r must contain the row scale factors for A$A$, DR${D}_{R}$; each element of r must be positive.
8:     c( : $:$) – double array
Note: the dimension of the array c must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
If fact = 'N'${\mathbf{fact}}=\text{'N'}$ or 'E'$\text{'E'}$, c need not be set.
If fact = 'F'${\mathbf{fact}}=\text{'F'}$ or equed = 'C'${\mathbf{equed}}=\text{'C'}$ or 'B'$\text{'B'}$, c must contain the column scale factors for A$A$, DC${D}_{C}$; each element of c must be positive.
9:     b(ldb, : $:$) – complex array
The first dimension of the array b must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The second dimension of the array must be at least max (1,nrhs)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{nrhs}}\right)$
The n$n$ by r$r$ right-hand side matrix B$B$.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The first dimension of the arrays a, af, b The second dimension of the arrays a, af, ipiv, r, c.
n$n$, the number of linear equations, i.e., the order of the matrix A$A$.
Constraint: n0${\mathbf{n}}\ge 0$.
2:     nrhs_p – int64int32nag_int scalar
Default: The second dimension of the array b.
r$r$, the number of right-hand sides, i.e., the number of columns of the matrix B$B$.
Constraint: nrhs0${\mathbf{nrhs}}\ge 0$.

Input Parameters Omitted from the MATLAB Interface

lda ldaf ldb ldx work

Output Parameters

1:     a(lda, : $:$) – complex array
The first dimension of the array a will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The second dimension of the array will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
ldamax (1,n)$\mathit{lda}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
If fact = 'F'${\mathbf{fact}}=\text{'F'}$ or 'N'$\text{'N'}$, or if fact = 'E'${\mathbf{fact}}=\text{'E'}$ and equed = 'N'${\mathbf{equed}}=\text{'N'}$, a is not modified.
If fact = 'E'${\mathbf{fact}}=\text{'E'}$ or equed'N'${\mathbf{equed}}\ne \text{'N'}$, A$A$ is scaled as follows:
• if equed = 'R'${\mathbf{equed}}=\text{'R'}$, A = DRA$A={D}_{R}A$;
• if equed = 'C'${\mathbf{equed}}=\text{'C'}$, A = ADC$A=A{D}_{C}$;
• if equed = 'B'${\mathbf{equed}}=\text{'B'}$, A = DRADC$A={D}_{R}A{D}_{C}$.
2:     af(ldaf, : $:$) – complex array
The first dimension of the array af will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The second dimension of the array will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
ldafmax (1,n)$\mathit{ldaf}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
If fact = 'N'${\mathbf{fact}}=\text{'N'}$, af returns the factors L$L$ and U$U$ from the factorization A = PLU$A=PLU$ of the original matrix A$A$.
If fact = 'E'${\mathbf{fact}}=\text{'E'}$, af returns the factors L$L$ and U$U$ from the factorization A = PLU$A=PLU$ of the equilibrated matrix A$A$ (see the description of a for the form of the equilibrated matrix).
If fact = 'F'${\mathbf{fact}}=\text{'F'}$, af is unchanged from entry.
3:     ipiv( : $:$) – int64int32nag_int array
Note: the dimension of the array ipiv must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
If fact = 'N'${\mathbf{fact}}=\text{'N'}$, ipiv contains the pivot indices from the factorization A = PLU$A=PLU$ of the original matrix A$A$.
If fact = 'E'${\mathbf{fact}}=\text{'E'}$, ipiv contains the pivot indices from the factorization A = PLU$A=PLU$ of the equilibrated matrix A$A$.
If fact = 'F'${\mathbf{fact}}=\text{'F'}$, ipiv is unchanged from entry.
4:     equed – string (length ≥ 1)
If fact = 'F'${\mathbf{fact}}=\text{'F'}$, equed is unchanged from entry.
Otherwise, if no constraints are violated, equed specifies the form of equilibration that was performed as specified above.
5:     r( : $:$) – double array
Note: the dimension of the array r must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
If fact = 'F'${\mathbf{fact}}=\text{'F'}$, r is unchanged from entry.
Otherwise, if no constraints are violated and equed = 'R'${\mathbf{equed}}=\text{'R'}$ or 'B'$\text{'B'}$, r contains the row scale factors for A$A$, DR${D}_{R}$, such that A$A$ is multiplied on the left by DR${D}_{R}$; each element of r is positive.
6:     c( : $:$) – double array
Note: the dimension of the array c must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
If fact = 'F'${\mathbf{fact}}=\text{'F'}$, c is unchanged from entry.
Otherwise, if no constraints are violated and equed = 'C'${\mathbf{equed}}=\text{'C'}$ or 'B'$\text{'B'}$, c contains the row scale factors for A$A$, DC${D}_{C}$; each element of c is positive.
7:     b(ldb, : $:$) – complex array
The first dimension of the array b will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The second dimension of the array will be max (1,nrhs)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{nrhs}}\right)$
ldbmax (1,n)$\mathit{ldb}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
If equed = 'N'${\mathbf{equed}}=\text{'N'}$, b is not modified.
If trans = 'N'${\mathbf{trans}}=\text{'N'}$ and equed = 'R'${\mathbf{equed}}=\text{'R'}$ or 'B'$\text{'B'}$, b stores DRB${D}_{R}B$.
If trans = 'T'${\mathbf{trans}}=\text{'T'}$ or 'C'$\text{'C'}$ and equed = 'C'${\mathbf{equed}}=\text{'C'}$ or 'B'$\text{'B'}$, b stores DCB${D}_{C}B$.
8:     x(ldx, : $:$) – complex array
The first dimension of the array x will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The second dimension of the array will be max (1,nrhs)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{nrhs}}\right)$
ldxmax (1,n)$\mathit{ldx}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
If ${\mathbf{INFO}}={\mathbf{0}}$ or n + 1$\mathbf{n}+{\mathbf{1}}$, the n$n$ by r$r$ solution matrix X$X$ to the original system of equations. Note that the arrays A$A$ and B$B$ are modified on exit if equed'N'${\mathbf{equed}}\ne \text{'N'}$, and the solution to the equilibrated system is DC1X${D}_{C}^{-1}X$ if trans = 'N'${\mathbf{trans}}=\text{'N'}$ and equed = 'C'${\mathbf{equed}}=\text{'C'}$ or 'B'$\text{'B'}$, or DR1X${D}_{R}^{-1}X$ if trans = 'T'${\mathbf{trans}}=\text{'T'}$ or 'C'$\text{'C'}$ and equed = 'R'${\mathbf{equed}}=\text{'R'}$ or 'B'$\text{'B'}$.
9:     rcond – double scalar
If no constraints are violated, an estimate of the reciprocal condition number of the matrix A$A$ (after equilibration if that is performed), computed as rcond = 1.0 / (A1A11)${\mathbf{rcond}}=1.0/\left({‖A‖}_{1}{‖{A}^{-1}‖}_{1}\right)$.
10:   ferr(nrhs_p) – double array
If ${\mathbf{INFO}}={\mathbf{0}}$ or n + 1$\mathbf{n}+{\mathbf{1}}$, an estimate of the forward error bound for each computed solution vector, such that jxj / xjferr(j)${‖{\stackrel{^}{x}}_{j}-{x}_{j}‖}_{\infty }/{‖{x}_{j}‖}_{\infty }\le {\mathbf{ferr}}\left(j\right)$ where j${\stackrel{^}{x}}_{j}$ is the j$j$th column of the computed solution returned in the array x and xj${x}_{j}$ is the corresponding column of the exact solution X$X$. The estimate is as reliable as the estimate for rcond, and is almost always a slight overestimate of the true error.
11:   berr(nrhs_p) – double array
If ${\mathbf{INFO}}={\mathbf{0}}$ or n + 1$\mathbf{n}+{\mathbf{1}}$, an estimate of the component-wise relative backward error of each computed solution vector j${\stackrel{^}{x}}_{j}$ (i.e., the smallest relative change in any element of A$A$ or B$B$ that makes j${\stackrel{^}{x}}_{j}$ an exact solution).
12:   rwork(max (1,2 × n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,2×{\mathbf{n}}\right)$) – double array
rwork(1)${\mathbf{rwork}}\left(1\right)$ contains the reciprocal pivot growth factor A / U$‖A‖/‖U‖$. The ‘max absolute element’ norm is used. If rwork(1)${\mathbf{rwork}}\left(1\right)$ is much less than 1$1$, then the stability of the LU$LU$ factorization of the (equilibrated) matrix A$A$ could be poor. This also means that the solution x, condition estimator rcond, and forward error bound ferr could be unreliable. If factorization fails with INFO > 0andINFOn${\mathbf{INFO}}>{\mathbf{0}} \text{and} {\mathbf{INFO}}\le \mathbf{n}$, then rwork(1)${\mathbf{rwork}}\left(1\right)$ contains the reciprocal pivot growth factor for the leading info columns of A$A$.
13:   info – int64int32nag_int scalar
info = 0${\mathbf{info}}=0$ unless the function detects an error (see Section [Error Indicators and Warnings]).

Error Indicators and Warnings

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

info = i${\mathbf{info}}=-i$
If info = i${\mathbf{info}}=-i$, parameter i$i$ had an illegal value on entry. The parameters are numbered as follows:
1: fact, 2: trans, 3: n, 4: nrhs_p, 5: a, 6: lda, 7: af, 8: ldaf, 9: ipiv, 10: equed, 11: r, 12: c, 13: b, 14: ldb, 15: x, 16: ldx, 17: rcond, 18: ferr, 19: berr, 20: work, 21: rwork, 22: info.
It is possible that info refers to a parameter that is omitted from the MATLAB interface. This usually indicates that an error in one of the other input parameters has caused an incorrect value to be inferred.
W INFO > 0andINFON${\mathbf{INFO}}>0 \text{and} {\mathbf{INFO}}\le {\mathbf{N}}$
If info = i${\mathbf{info}}=i$, uii${u}_{ii}$ is exactly zero. The factorization has been completed, but the factor U$U$ is exactly singular, so the solution and error bounds could not be computed. rcond = 0.0${\mathbf{rcond}}=0.0$ is returned.
W INFO = N + 1${\mathbf{INFO}}={\mathbf{N}}+1$
The triangular matrix U$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.

Accuracy

For each right-hand side vector b$b$, the computed solution $\stackrel{^}{x}$ is the exact solution of a perturbed system of equations (A + E) = b$\left(A+E\right)\stackrel{^}{x}=b$, where
 |E| ≤ c(n)εP|L||U| , $|E|≤c(n)εP|L||U| ,$
c(n)$c\left(n\right)$ is a modest linear function of n$n$, and ε$\epsilon$ is the machine precision. See Section 9.3 of Higham (2002) for further details.
If x$x$ is the true solution, then the computed solution $\stackrel{^}{x}$ satisfies a forward error bound of the form
 ( ‖x − x̂‖∞ )/( ‖x̂‖∞ ) ≤ wc cond(A,x̂,b) $‖x-x^‖∞ ‖x^‖∞ ≤ wc cond(A,x^,b)$
where cond(A,,b) = |A1|(|A||| + |b|) / cond(A) = |A1||A|κ (A)$\mathrm{cond}\left(A,\stackrel{^}{x},b\right)={‖|{A}^{-1}|\left(|A||\stackrel{^}{x}|+|b|\right)‖}_{\infty }/{‖\stackrel{^}{x}‖}_{\infty }\le \mathrm{cond}\left(A\right)={‖|{A}^{-1}||A|‖}_{\infty }\le {\kappa }_{\infty }\left(A\right)$. If $\stackrel{^}{x}$ is the j $j$th column of X $X$, then wc ${w}_{c}$ is returned in berr(j) ${\mathbf{berr}}\left(j\right)$ and a bound on x / ${‖x-\stackrel{^}{x}‖}_{\infty }/{‖\stackrel{^}{x}‖}_{\infty }$ is returned in ferr(j) ${\mathbf{ferr}}\left(j\right)$. See Section 4.4 of Anderson et al. (1999) for further details.

The factorization of A $A$ requires approximately (8/3) n3 $\frac{8}{3}{n}^{3}$ floating point operations.
Estimating the forward error involves solving a number of systems of linear equations of the form Ax = b$Ax=b$ or ATx = b${A}^{\mathrm{T}}x=b$; the number is usually 4$4$ or 5$5$ and never more than 11$11$. Each solution involves approximately 8n2$8{n}^{2}$ operations.
In practice the condition number estimator is very reliable, but it can underestimate the true condition number; see Section 15.3 of Higham (2002) for further details.
The real analogue of this function is nag_lapack_dgesvx (f07ab).

Example

```function nag_lapack_zgesvx_example
fact = 'Equilibrate';
trans = 'No transpose';
equed = ' ';
a = [ -1.34 + 2.55i,  0.28 + 3.17i,  -6.39 - 2.2i,  0.72 - 0.92i;
-1.7 - 14.1i,  33.1 - 1.5i,  -1.5 + 13.4i,  12.9 + 13.8i;
-3.29 - 2.39i,  -1.91 + 4.42i,  -0.14 - 1.35i,  1.72 + 1.35i;
2.41 + 0.39i,  -0.56 + 1.47i, -0.83 - 0.69i,  -1.96 + 0.67i];
b = [ 26.26 + 51.78i,  31.32 - 6.7i;
64.3 - 86.8i,  158.6 - 14.2i;
-5.75 + 25.31i,  -2.15 + 30.19i;
1.16 + 2.57i,  -2.56 + 7.55i];
af = complex(zeros(4, 4));
ipiv = zeros(4, 1, 'int64');
r = zeros(4, 1);
c = zeros(4, 1);
[a, af, ipiv, equed, r, c, b, x, rcond, ferr, berr, rwork, info] = ...
nag_lapack_zgesvx(fact, trans, a, af, ipiv, equed, r, c, b)
```
```

a =

-0.1560 + 0.2969i   0.0326 + 0.3690i  -0.7439 - 0.2561i   0.0838 - 0.1071i
-0.0491 - 0.4075i   0.9566 - 0.0434i  -0.0434 + 0.3873i   0.3728 + 0.3988i
-0.5197 - 0.3776i  -0.3017 + 0.6983i  -0.0221 - 0.2133i   0.2717 + 0.2133i
0.8607 + 0.1393i  -0.2000 + 0.5250i  -0.2964 - 0.2464i  -0.7000 + 0.2393i

af =

0.8607 + 0.1393i  -0.2000 + 0.5250i  -0.2964 - 0.2464i  -0.7000 + 0.2393i
-0.6576 - 0.3322i  -0.6077 + 0.9771i  -0.1352 - 0.4738i  -0.2681 + 0.1381i
-0.1222 + 0.3647i   0.2819 - 0.3796i  -0.6520 - 0.0959i   0.1087 + 0.0367i
-0.1303 - 0.4524i  -0.3664 - 0.4815i  -0.3085 + 0.0724i   0.0449 + 0.0383i

ipiv =

4
3
4
4

equed =

R

r =

0.1164
0.0289
0.1580
0.3571

c =

1.0000
1.0000
1.0000
1.0646

b =

3.0570 + 6.0279i   3.6461 - 0.7800i
1.8584 - 2.5087i   4.5838 - 0.4104i
-0.9084 + 3.9984i  -0.3397 + 4.7694i
0.4143 + 0.9179i  -0.9143 + 2.6964i

x =

1.0000 + 1.0000i  -1.0000 - 2.0000i
2.0000 - 3.0000i   5.0000 + 1.0000i
-4.0000 - 5.0000i  -3.0000 + 4.0000i
0.0000 + 6.0000i   2.0000 - 3.0000i

rcond =

0.0104

ferr =

1.0e-13 *

0.5582
0.7724

berr =

1.0e-16 *

0.2654
0.8080

rwork =

0.8323
0.0000
0.0000
0.0000
0
0.7250
1.1519
1.4909

info =

0

```
```function f07ap_example
fact = 'Equilibrate';
trans = 'No transpose';
equed = ' ';
a = [ -1.34 + 2.55i,  0.28 + 3.17i,  -6.39 - 2.2i,  0.72 - 0.92i;
-1.7 - 14.1i,  33.1 - 1.5i,  -1.5 + 13.4i,  12.9 + 13.8i;
-3.29 - 2.39i,  -1.91 + 4.42i,  -0.14 - 1.35i,  1.72 + 1.35i;
2.41 + 0.39i,  -0.56 + 1.47i, -0.83 - 0.69i,  -1.96 + 0.67i];
b = [ 26.26 + 51.78i,  31.32 - 6.7i;
64.3 - 86.8i,  158.6 - 14.2i;
-5.75 + 25.31i,  -2.15 + 30.19i;
1.16 + 2.57i,  -2.56 + 7.55i];
af = complex(zeros(4, 4));
ipiv = zeros(4, 1, 'int64');
r = zeros(4, 1);
c = zeros(4, 1);
[a, af, ipiv, equed, r, c, b, x, rcond, ferr, berr, rwork, info] = ...
f07ap(fact, trans, a, af, ipiv, equed, r, c, b)
```
```

a =

-0.1560 + 0.2969i   0.0326 + 0.3690i  -0.7439 - 0.2561i   0.0838 - 0.1071i
-0.0491 - 0.4075i   0.9566 - 0.0434i  -0.0434 + 0.3873i   0.3728 + 0.3988i
-0.5197 - 0.3776i  -0.3017 + 0.6983i  -0.0221 - 0.2133i   0.2717 + 0.2133i
0.8607 + 0.1393i  -0.2000 + 0.5250i  -0.2964 - 0.2464i  -0.7000 + 0.2393i

af =

0.8607 + 0.1393i  -0.2000 + 0.5250i  -0.2964 - 0.2464i  -0.7000 + 0.2393i
-0.6576 - 0.3322i  -0.6077 + 0.9771i  -0.1352 - 0.4738i  -0.2681 + 0.1381i
-0.1222 + 0.3647i   0.2819 - 0.3796i  -0.6520 - 0.0959i   0.1087 + 0.0367i
-0.1303 - 0.4524i  -0.3664 - 0.4815i  -0.3085 + 0.0724i   0.0449 + 0.0383i

ipiv =

4
3
4
4

equed =

R

r =

0.1164
0.0289
0.1580
0.3571

c =

1.0000
1.0000
1.0000
1.0646

b =

3.0570 + 6.0279i   3.6461 - 0.7800i
1.8584 - 2.5087i   4.5838 - 0.4104i
-0.9084 + 3.9984i  -0.3397 + 4.7694i
0.4143 + 0.9179i  -0.9143 + 2.6964i

x =

1.0000 + 1.0000i  -1.0000 - 2.0000i
2.0000 - 3.0000i   5.0000 + 1.0000i
-4.0000 - 5.0000i  -3.0000 + 4.0000i
0.0000 + 6.0000i   2.0000 - 3.0000i

rcond =

0.0104

ferr =

1.0e-13 *

0.5582
0.7724

berr =

1.0e-16 *

0.2654
0.8080

rwork =

0.8323
0.0000
0.0000
0.0000
0
0.7250
1.1519
1.4909

info =

0

```