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_dgbsvx (f07bb)

## Purpose

nag_lapack_dgbsvx (f07bb) uses the LU$LU$ factorization to compute the solution to a real system of linear equations
 AX = B   or   ATX = B , $AX=B or ATX=B ,$
where A$A$ is an n$n$ by n$n$ band matrix with kl${k}_{l}$ subdiagonals and ku${k}_{u}$ superdiagonals, 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

[ab, afb, ipiv, equed, r, c, b, x, rcond, ferr, berr, work, info] = f07bb(fact, trans, kl, ku, ab, afb, ipiv, equed, r, c, b, 'n', n, 'nrhs_p', nrhs_p)
[ab, afb, ipiv, equed, r, c, b, x, rcond, ferr, berr, work, info] = nag_lapack_dgbsvx(fact, trans, kl, ku, ab, afb, ipiv, equed, r, c, b, 'n', n, 'nrhs_p', nrhs_p)

## Description

nag_lapack_dgbsvx (f07bb) 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$ and ATX = B ${A}^{\mathrm{T}}X=B$ are
 (DRADC) (DC − 1X) = DR B $( DR A DC ) ( DC-1X ) = DR B$
and
 (DRADC)T (DR − 1X) = DC B , $( DR A DC )T ( 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$ 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_dgbsvx (f07bb) 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'}$
afb 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. ab, afb and ipiv are not modified.
fact = 'N'${\mathbf{fact}}=\text{'N'}$
The matrix A$A$ will be copied to afb and factorized.
fact = 'E'${\mathbf{fact}}=\text{'E'}$
The matrix A$A$ will be equilibrated if necessary, then copied to afb 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'}$ or 'C'$\text{'C'}$
ATX = B${A}^{\mathrm{T}}X=B$ (Transpose).
Constraint: trans = 'N'${\mathbf{trans}}=\text{'N'}$, 'T'$\text{'T'}$ or 'C'$\text{'C'}$.
3:     kl – int64int32nag_int scalar
kl${k}_{l}$, the number of subdiagonals within the band of the matrix A$A$.
Constraint: kl0${\mathbf{kl}}\ge 0$.
4:     ku – int64int32nag_int scalar
ku${k}_{u}$, the number of superdiagonals within the band of the matrix A$A$.
Constraint: ku0${\mathbf{ku}}\ge 0$.
5:     ab(ldab, : $:$) – double array
The first dimension of the array ab must be at least kl + ku + 1${\mathbf{kl}}+{\mathbf{ku}}+1$
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$ coefficient matrix A$A$.
The matrix is stored in rows 1$1$ to kl + ku + 1${k}_{l}+{k}_{u}+1$, more precisely, the element Aij${A}_{ij}$ must be stored in
 ab(ku + 1 + i − j,j)  for ​max (1,j − ku) ≤ i ≤ min (n,j + kl).$abku+1+i-jj for ​max(1,j-ku)≤i≤min(n,j+kl).$
See Section [Further Comments] for further details.
If fact = 'F'${\mathbf{fact}}=\text{'F'}$ and equed'N'${\mathbf{equed}}\ne \text{'N'}$, A$A$ must have been equilibrated by the scaling factors in r and/or c.
6:     afb(ldafb, : $:$) – double array
The first dimension of the array afb must be at least 2 × kl + ku + 1$2×{\mathbf{kl}}+{\mathbf{ku}}+1$
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 = 'N'${\mathbf{fact}}=\text{'N'}$ or 'E'$\text{'E'}$, afb need not be set.
If fact = 'F'${\mathbf{fact}}=\text{'F'}$, details of the LU$LU$ factorization of the n$n$ by n$n$ band matrix A$A$, as computed by nag_lapack_dgbtrf (f07bd).
The upper triangular band matrix U$U$, with kl + ku${k}_{l}+{k}_{u}$ superdiagonals, is stored in rows 1$1$ to kl + ku + 1${k}_{l}+{k}_{u}+1$ of the array, and the multipliers used to form the matrix L$L$ are stored in rows kl + ku + 2${k}_{l}+{k}_{u}+2$ to 2kl + ku + 1$2{k}_{l}+{k}_{u}+1$.
If equed'N'${\mathbf{equed}}\ne \text{'N'}$, afb is the factorized form of the equilibrated matrix A$A$.
7:     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'}$ or 'E'$\text{'E'}$, ipiv need not be set.
If fact = 'F'${\mathbf{fact}}=\text{'F'}$, ipiv contains the pivot indices from the factorization A = LU$A=LU$, as computed by nag_lapack_dgbtrf (f07bd); row i$i$ of the matrix was interchanged with row ipiv(i)${\mathbf{ipiv}}\left(i\right)$.
8:     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'}$.
9:     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.
10:   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.
11:   b(ldb, : $:$) – double 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 array b The second dimension of the arrays ab, afb, 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

ldab ldafb ldb ldx iwork

### Output Parameters

1:     ab(ldab, : $:$) – double array
The first dimension of the array ab will be kl + ku + 1${\mathbf{kl}}+{\mathbf{ku}}+1$
The second dimension of the array will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
ldabkl + ku + 1$\mathit{ldab}\ge {\mathbf{kl}}+{\mathbf{ku}}+1$.
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'}$, ab is not modified.
If equed'N'${\mathbf{equed}}\ne \text{'N'}$ then, if no constraints are violated, 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:     afb(ldafb, : $:$) – double array
The first dimension of the array afb will be 2 × kl + ku + 1$2×{\mathbf{kl}}+{\mathbf{ku}}+1$
The second dimension of the array will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
ldafb2 × kl + ku + 1$\mathit{ldafb}\ge 2×{\mathbf{kl}}+{\mathbf{ku}}+1$.
If fact = 'F'${\mathbf{fact}}=\text{'F'}$, afb is unchanged from entry.
Otherwise, if no constraints are violated, then if fact = 'N'${\mathbf{fact}}=\text{'N'}$, afb returns details of the LU$LU$ factorization of the band matrix A$A$, and if fact = 'E'${\mathbf{fact}}=\text{'E'}$, afb returns details of the LU$LU$ factorization of the equilibrated band matrix A$A$ (see the description of ab for the form of the equilibrated matrix).
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 = 'F'${\mathbf{fact}}=\text{'F'}$, ipiv is unchanged from entry.
Otherwise, if no constraints are violated, ipiv contains the pivot indices that define the permutation matrix P$P$; 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'}$, the pivot indices are those corresponding to the factorization A = LU$A=LU$ of the original matrix A$A$.
If fact = 'E'${\mathbf{fact}}=\text{'E'}$, the pivot indices are those corresponding to the factorization of A = LU$A=LU$ of the equilibrated matrix A$A$.
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, : $:$) – double 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, : $:$) – double 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:   work(max (1,3 × n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,3×{\mathbf{n}}\right)$) – double array
If ${\mathbf{INFO}}={\mathbf{0}}$, work(1)${\mathbf{work}}\left(1\right)$ contains the reciprocal pivot growth factor max|aij| / max|uij|$\mathrm{max}|{a}_{ij}|/\mathrm{max}|{u}_{ij}|$. If work(1)${\mathbf{work}}\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$X$, condition estimator rcond, and forward error bound ferr could be unreliable. If the factorization fails with INFO > 0andINFOn${\mathbf{INFO}}>{\mathbf{0}} \text{and} {\mathbf{INFO}}\le \mathbf{n}$, work(1)${\mathbf{work}}\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: kl, 5: ku, 6: nrhs_p, 7: ab, 8: ldab, 9: afb, 10: ldafb, 11: ipiv, 12: equed, 13: r, 14: c, 15: b, 16: ldb, 17: x, 18: ldx, 19: rcond, 20: ferr, 21: berr, 22: work, 23: iwork, 24: 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 band storage scheme for the array ab is illustrated by the following example, when n = 6 $n=6$, kl = 1 ${k}_{l}=1$, and ku = 2 ${k}_{u}=2$. Storage of the band matrix A $A$ in the array ab:
 * * a13 a24 a35 a46 * a12 a23 a34 a45 a56 a11 a22 a33 a44 a55 a66 a21 a32 a43 a54 a65 *
$* * a13 a24 a35 a46 * a12 a23 a34 a45 a56 a11 a22 a33 a44 a55 a66 a21 a32 a43 a54 a65 *$
The total number of floating point operations required to solve the equations AX = B $AX=B$ depends upon the pivoting required, but if nkl + ku $n\gg {k}_{l}+{k}_{u}$ then it is approximately bounded by O( n kl ( kl + ku ) ) $\mathit{O}\left(n{k}_{l}\left({k}_{l}+{k}_{u}\right)\right)$ for the factorization and O( n (2kl + ku) r ) $\mathit{O}\left(n\left(2{k}_{l}+{k}_{u}\right)r\right)$ for the solution following the factorization. The condition number estimation typically requires between four and five solves and never more than eleven solves, following the factorization. The solution is then refined, and the errors estimated, using iterative refinement; see nag_lapack_dgbrfs (f07bh) for information on the floating point operations required.
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 complex analogue of this function is nag_lapack_zgbsvx (f07bp).

## Example

```function nag_lapack_dgbsvx_example
fact = 'Equilibration';
trans = 'No transpose';
kl = int64(1);
ku = int64(2);
ab = [0, 0, -3.66, -2.13;
0, 2.54, -2.73, 4.07;
-0.23, 2.46, 2.46, -3.82;
-6.98, 2.56, -4.78, 0];
afb = zeros(5, 4);
ipiv = [int64(36);8133896;1;0];
equed = ' ';
r = zeros(4, 1);
c = zeros(4, 1);
b = [4.42, -36.01;
27.13, -31.67;
-6.14, -1.16;
10.5, -25.82];
[abOut, afbOut, ipivOut, equedOut, rOut, cOut, bOut, ...
x, rcond, ferr, berr, work, info] = ...
nag_lapack_dgbsvx(fact, trans, kl, ku, ab, afb, ipiv, equed, r, c, b)
```
```

0         0   -3.6600   -2.1300
0    2.5400   -2.7300    4.0700
-0.2300    2.4600    2.4600   -3.8200
-6.9800    2.5600   -4.7800         0

afbOut =

0         0         0   -2.1300
0         0   -2.7300    4.0700
0    2.4600    2.4600   -3.8391
-6.9800    2.5600   -5.9329   -0.7269
0.0330    0.9605    0.8057         0

ipivOut =

2
3
3
4

equedOut =

N

rOut =

0.2732
0.1433
0.2457
0.2092

cOut =

1.0000
1.4409
1.0000
1.0000

bOut =

4.4200  -36.0100
27.1300  -31.6700
-6.1400   -1.1600
10.5000  -25.8200

x =

-2.0000    1.0000
3.0000   -4.0000
1.0000    7.0000
-4.0000   -2.0000

rcond =

0.0177

ferr =

1.0e-13 *

0.1558
0.1905

berr =

1.0e-15 *

0.1091
0.0987

work =

1.0000
0.0000
0.0000
0.0000
-0.0000
-0.0000
0.0000
0.0000
0.0000
-0.0000
-0.0000
-0.0000

info =

0

```
```function f07bb_example
fact = 'Equilibration';
trans = 'No transpose';
kl = int64(1);
ku = int64(2);
ab = [0, 0, -3.66, -2.13;
0, 2.54, -2.73, 4.07;
-0.23, 2.46, 2.46, -3.82;
-6.98, 2.56, -4.78, 0];
afb = zeros(5, 4);
ipiv = [int64(36);8133896;1;0];
equed = ' ';
r = zeros(4, 1);
c = zeros(4, 1);
b = [4.42, -36.01;
27.13, -31.67;
-6.14, -1.16;
10.5, -25.82];
[abOut, afbOut, ipivOut, equedOut, rOut, cOut, bOut, ...
x, rcond, ferr, berr, work, info] = ...
f07bb(fact, trans, kl, ku, ab, afb, ipiv, equed, r, c, b)
```
```

0         0   -3.6600   -2.1300
0    2.5400   -2.7300    4.0700
-0.2300    2.4600    2.4600   -3.8200
-6.9800    2.5600   -4.7800         0

afbOut =

0         0         0   -2.1300
0         0   -2.7300    4.0700
0    2.4600    2.4600   -3.8391
-6.9800    2.5600   -5.9329   -0.7269
0.0330    0.9605    0.8057         0

ipivOut =

2
3
3
4

equedOut =

N

rOut =

0.2732
0.1433
0.2457
0.2092

cOut =

1.0000
1.4409
1.0000
1.0000

bOut =

4.4200  -36.0100
27.1300  -31.6700
-6.1400   -1.1600
10.5000  -25.8200

x =

-2.0000    1.0000
3.0000   -4.0000
1.0000    7.0000
-4.0000   -2.0000

rcond =

0.0177

ferr =

1.0e-13 *

0.1558
0.1905

berr =

1.0e-15 *

0.1091
0.0987

work =

1.0000
0.0000
0.0000
0.0000
-0.0000
-0.0000
0.0000
0.0000
0.0000
-0.0000
-0.0000
-0.0000

info =

0

```