f07 Chapter Contents
f07 Chapter Introduction
NAG Library Manual

# NAG Library Function Documentnag_dgbsvx (f07bbc)

## 1  Purpose

nag_dgbsvx (f07bbc) uses the $LU$ factorization to compute the solution to a real system of linear equations
 $AX=B or ATX=B ,$
where $A$ is an $n$ by $n$ band matrix with ${k}_{l}$ subdiagonals and ${k}_{u}$ superdiagonals, and $X$ and $B$ are $n$ by $r$ matrices. Error bounds on the solution and a condition estimate are also provided.

## 2  Specification

 #include #include
 void nag_dgbsvx (Nag_OrderType order, Nag_FactoredFormType fact, Nag_TransType trans, Integer n, Integer kl, Integer ku, Integer nrhs, double ab[], Integer pdab, double afb[], Integer pdafb, Integer ipiv[], Nag_EquilibrationType *equed, double r[], double c[], double b[], Integer pdb, double x[], Integer pdx, double *rcond, double ferr[], double berr[], double *recip_growth_factor, NagError *fail)

## 3  Description

nag_dgbsvx (f07bbc) 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 ${\mathbf{fact}}=\mathrm{Nag_EquilibrateAndFactor}$. 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$ and ${A}^{\mathrm{T}}X=B$ are
 $DR A DC DC-1X = DR B$
and
 $DR A DC T DR-1 X = DC B ,$
respectively, where ${D}_{R}$ and ${D}_{C}$ are diagonal matrices, with positive diagonal elements, formed from the computed scaling factors.
When equilibration is used, $A$ will be overwritten by ${D}_{R}A{D}_{C}$ and $B$ will be overwritten by ${D}_{R}B$ (or ${D}_{C}B$ when the solution of ${A}^{\mathrm{T}}X=B$ is sought).
2. Factorization
The matrix $A$, or its scaled form, is copied and factored using the $LU$ decomposition
 $A=PLU ,$
where $P$ is a permutation matrix, $L$ is a unit lower triangular matrix, and $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_dgbsvx (f07bbc) with the same matrix $A$.
3. Condition Number Estimation
The $LU$ factorization of $A$ determines whether a solution to the linear system exists. If some diagonal element of $U$ is zero, then $U$ is exactly singular, no solution exists and the function returns with a failure. Otherwise the factorized 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 then a warning code is returned on final exit.
4. Solution
The (equilibrated) system is solved for $X$ (${D}_{C}^{-1}X$ or ${D}_{R}^{-1}X$) using the factored form of $A$ (${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$
If equilibration was used, the matrix $X$ is premultiplied by ${D}_{C}$ (if ${\mathbf{trans}}=\mathrm{Nag_NoTrans}$) or ${D}_{R}$ (if ${\mathbf{trans}}=\mathrm{Nag_Trans}$ or $\mathrm{Nag_ConjTrans}$) so that it solves the original system before equilibration.

## 4  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

## 5  Arguments

1:     orderNag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or $\mathrm{Nag_ColMajor}$.
2:     factNag_FactoredFormTypeInput
On entry: specifies whether or not the factorized form of the matrix $A$ is supplied on entry, and if not, whether the matrix $A$ should be equilibrated before it is factorized.
${\mathbf{fact}}=\mathrm{Nag_Factored}$
afb and ipiv contain the factorized form of $A$. If ${\mathbf{equed}}\ne \mathrm{Nag_NoEquilibration}$, the matrix $A$ has been equilibrated with scaling factors given by r and c. abafb and ipiv are not modified.
${\mathbf{fact}}=\mathrm{Nag_NotFactored}$
The matrix $A$ will be copied to afb and factorized.
${\mathbf{fact}}=\mathrm{Nag_EquilibrateAndFactor}$
The matrix $A$ will be equilibrated if necessary, then copied to afb and factorized.
Constraint: ${\mathbf{fact}}=\mathrm{Nag_Factored}$, $\mathrm{Nag_NotFactored}$ or $\mathrm{Nag_EquilibrateAndFactor}$.
3:     transNag_TransTypeInput
On entry: specifies the form of the system of equations.
${\mathbf{trans}}=\mathrm{Nag_NoTrans}$
$AX=B$ (No transpose).
${\mathbf{trans}}=\mathrm{Nag_Trans}$ or $\mathrm{Nag_ConjTrans}$
${A}^{\mathrm{T}}X=B$ (Transpose).
Constraint: ${\mathbf{trans}}=\mathrm{Nag_NoTrans}$, $\mathrm{Nag_Trans}$ or $\mathrm{Nag_ConjTrans}$.
4:     nIntegerInput
On entry: $n$, the number of linear equations, i.e., the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
5:     klIntegerInput
On entry: ${k}_{l}$, the number of subdiagonals within the band of the matrix $A$.
Constraint: ${\mathbf{kl}}\ge 0$.
6:     kuIntegerInput
On entry: ${k}_{u}$, the number of superdiagonals within the band of the matrix $A$.
Constraint: ${\mathbf{ku}}\ge 0$.
7:     nrhsIntegerInput
On entry: $r$, the number of right-hand sides, i.e., the number of columns of the matrix $B$.
Constraint: ${\mathbf{nrhs}}\ge 0$.
8:     ab[$\mathit{dim}$]doubleInput/Output
Note: the dimension, dim, of the array ab must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdab}}×{\mathbf{n}}\right)$.
On entry: the $n$ by $n$ coefficient matrix $A$.
This is stored as a notional two-dimensional array with row elements or column elements stored contiguously. The storage of elements ${A}_{ij}$, for row $i=1,\dots ,n$ and column $j=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,i-{k}_{l}\right),\dots ,\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(n,i+{k}_{u}\right)$, depends on the order argument as follows:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${A}_{ij}$ is stored as ${\mathbf{ab}}\left[\left(j-1\right)×{\mathbf{pdab}}+{\mathbf{ku}}+i-j\right]$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${A}_{ij}$ is stored as ${\mathbf{ab}}\left[\left(i-1\right)×{\mathbf{pdab}}+{\mathbf{kl}}+j-i\right]$.
See Section 9 for further details.
If ${\mathbf{fact}}=\mathrm{Nag_Factored}$ and ${\mathbf{equed}}\ne \mathrm{Nag_NoEquilibration}$, $A$ must have been equilibrated by the scaling factors in r and/or c.
On exit: if ${\mathbf{fact}}=\mathrm{Nag_Factored}$ or $\mathrm{Nag_NotFactored}$, or if ${\mathbf{fact}}=\mathrm{Nag_EquilibrateAndFactor}$ and ${\mathbf{equed}}=\mathrm{Nag_NoEquilibration}$, ab is not modified.
If ${\mathbf{equed}}\ne \mathrm{Nag_NoEquilibration}$ then, if no constraints are violated, $A$ is scaled as follows:
• if ${\mathbf{equed}}=\mathrm{Nag_RowEquilibration}$, $A={D}_{r}A$;
• if ${\mathbf{equed}}=\mathrm{Nag_ColumnEquilibration}$, $A=A{D}_{c}$;
• if ${\mathbf{equed}}=\mathrm{Nag_RowAndColumnEquilibration}$, $A={D}_{r}A{D}_{c}$.
9:     pdabIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) of the matrix $A$ in the array ab.
Constraint: ${\mathbf{pdab}}\ge {\mathbf{kl}}+{\mathbf{ku}}+1$.
10:   afb[$\mathit{dim}$]doubleInput/Output
Note: the dimension, dim, of the array afb must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdafb}}×{\mathbf{n}}\right)$.
On entry: if ${\mathbf{fact}}=\mathrm{Nag_NotFactored}$ or $\mathrm{Nag_EquilibrateAndFactor}$, afb need not be set.
If ${\mathbf{fact}}=\mathrm{Nag_Factored}$, details of the $LU$ factorization of the $n$ by $n$ band matrix $A$, as computed by nag_dgbtrf (f07bdc).
The elements, ${u}_{ij}$, of the upper triangular band factor $U$ with ${k}_{l}+{k}_{u}$ super-diagonals, and the multipliers, ${l}_{ij}$, used to form the lower triangular factor $L$ are stored. The elements ${u}_{ij}$, for $i=1,\dots ,n$ and $j=i,\dots ,\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(n,i+{k}_{l}+{k}_{u}\right)$, and ${l}_{ij}$, for $i=1,\dots ,n$ and $j=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,i-{k}_{l}\right),\dots ,i$, are stored where ${A}_{ij}$ is stored on entry.
If ${\mathbf{equed}}\ne \mathrm{Nag_NoEquilibration}$, afb is the factorized form of the equilibrated matrix $A$.
On exit: if ${\mathbf{fact}}=\mathrm{Nag_Factored}$, afb is unchanged from entry.
Otherwise, if no constraints are violated, then if ${\mathbf{fact}}=\mathrm{Nag_NotFactored}$, afb returns details of the $LU$ factorization of the band matrix $A$, and if ${\mathbf{fact}}=\mathrm{Nag_EquilibrateAndFactor}$, afb returns details of the $LU$ factorization of the equilibrated band matrix $A$ (see the description of ab for the form of the equilibrated matrix).
11:   pdafbIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) of the matrix $A$ in the array afb.
Constraint: ${\mathbf{pdafb}}\ge 2×{\mathbf{kl}}+{\mathbf{ku}}+1$.
12:   ipiv[$\mathit{dim}$]IntegerInput/Output
Note: the dimension, dim, of the array ipiv must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: if ${\mathbf{fact}}=\mathrm{Nag_NotFactored}$ or $\mathrm{Nag_EquilibrateAndFactor}$, ipiv need not be set.
If ${\mathbf{fact}}=\mathrm{Nag_Factored}$, ipiv contains the pivot indices from the factorization $A=LU$, as computed by nag_dgbtrf (f07bdc); row $i$ of the matrix was interchanged with row ${\mathbf{ipiv}}\left[i-1\right]$.
On exit: if ${\mathbf{fact}}=\mathrm{Nag_Factored}$, ipiv is unchanged from entry.
Otherwise, if no constraints are violated, ipiv contains the pivot indices that define the permutation matrix $P$; at the $i$th step row $i$ of the matrix was interchanged with row ${\mathbf{ipiv}}\left[i-1\right]$. ${\mathbf{ipiv}}\left[i-1\right]=i$ indicates a row interchange was not required.
If ${\mathbf{fact}}=\mathrm{Nag_NotFactored}$, the pivot indices are those corresponding to the factorization $A=LU$ of the original matrix $A$.
If ${\mathbf{fact}}=\mathrm{Nag_EquilibrateAndFactor}$, the pivot indices are those corresponding to the factorization of $A=LU$ of the equilibrated matrix $A$.
13:   equedNag_EquilibrationType *Input/Output
On entry: if ${\mathbf{fact}}=\mathrm{Nag_NotFactored}$ or $\mathrm{Nag_EquilibrateAndFactor}$, equed need not be set.
If ${\mathbf{fact}}=\mathrm{Nag_Factored}$, equed must specify the form of the equilibration that was performed as follows:
• if ${\mathbf{equed}}=\mathrm{Nag_NoEquilibration}$, no equilibration;
• if ${\mathbf{equed}}=\mathrm{Nag_RowEquilibration}$, row equilibration, i.e., $A$ has been premultiplied by ${D}_{R}$;
• if ${\mathbf{equed}}=\mathrm{Nag_ColumnEquilibration}$, column equilibration, i.e., $A$ has been postmultiplied by ${D}_{C}$;
• if ${\mathbf{equed}}=\mathrm{Nag_RowAndColumnEquilibration}$, both row and column equilibration, i.e., $A$ has been replaced by ${D}_{R}A{D}_{C}$.
On exit: if ${\mathbf{fact}}=\mathrm{Nag_Factored}$, equed is unchanged from entry.
Otherwise, if no constraints are violated, equed specifies the form of equilibration that was performed as specified above.
Constraint: if ${\mathbf{fact}}=\mathrm{Nag_Factored}$, ${\mathbf{equed}}=\mathrm{Nag_NoEquilibration}$, $\mathrm{Nag_RowEquilibration}$, $\mathrm{Nag_ColumnEquilibration}$ or $\mathrm{Nag_RowAndColumnEquilibration}$.
14:   r[$\mathit{dim}$]doubleInput/Output
Note: the dimension, dim, of the array r must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: if ${\mathbf{fact}}=\mathrm{Nag_NotFactored}$ or $\mathrm{Nag_EquilibrateAndFactor}$, r need not be set.
If ${\mathbf{fact}}=\mathrm{Nag_Factored}$ and ${\mathbf{equed}}=\mathrm{Nag_RowEquilibration}$ or $\mathrm{Nag_RowAndColumnEquilibration}$, r must contain the row scale factors for $A$, ${D}_{R}$; each element of r must be positive.
On exit: if ${\mathbf{fact}}=\mathrm{Nag_Factored}$, r is unchanged from entry.
Otherwise, if no constraints are violated and ${\mathbf{equed}}=\mathrm{Nag_RowEquilibration}$ or $\mathrm{Nag_RowAndColumnEquilibration}$, r contains the row scale factors for $A$, ${D}_{R}$, such that $A$ is multiplied on the left by ${D}_{R}$; each element of r is positive.
15:   c[$\mathit{dim}$]doubleInput/Output
Note: the dimension, dim, of the array c must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: if ${\mathbf{fact}}=\mathrm{Nag_NotFactored}$ or $\mathrm{Nag_EquilibrateAndFactor}$, c need not be set.
If ${\mathbf{fact}}=\mathrm{Nag_Factored}$ or ${\mathbf{equed}}=\mathrm{Nag_ColumnEquilibration}$ or $\mathrm{Nag_RowAndColumnEquilibration}$, c must contain the column scale factors for $A$, ${D}_{C}$; each element of c must be positive.
On exit: if ${\mathbf{fact}}=\mathrm{Nag_Factored}$, c is unchanged from entry.
Otherwise, if no constraints are violated and ${\mathbf{equed}}=\mathrm{Nag_ColumnEquilibration}$ or $\mathrm{Nag_RowAndColumnEquilibration}$, c contains the row scale factors for $A$, ${D}_{C}$; each element of c is positive.
16:   b[$\mathit{dim}$]doubleInput/Output
Note: the dimension, dim, of the array b must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdb}}×{\mathbf{nrhs}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdb}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $B$ is stored in
• ${\mathbf{b}}\left[\left(j-1\right)×{\mathbf{pdb}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{b}}\left[\left(i-1\right)×{\mathbf{pdb}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: the $n$ by $r$ right-hand side matrix $B$.
On exit: if ${\mathbf{equed}}=\mathrm{Nag_NoEquilibration}$, b is not modified.
If ${\mathbf{trans}}=\mathrm{Nag_NoTrans}$ and ${\mathbf{equed}}=\mathrm{Nag_RowEquilibration}$ or $\mathrm{Nag_RowAndColumnEquilibration}$, b is overwritten by ${D}_{R}B$.
If ${\mathbf{trans}}=\mathrm{Nag_Trans}$ or $\mathrm{Nag_ConjTrans}$ and ${\mathbf{equed}}=\mathrm{Nag_ColumnEquilibration}$ or $\mathrm{Nag_RowAndColumnEquilibration}$, b is overwritten by ${D}_{C}B$.
17:   pdbIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array b.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{nrhs}}\right)$.
18:   x[$\mathit{dim}$]doubleOutput
Note: the dimension, dim, of the array x must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdx}}×{\mathbf{nrhs}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdx}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $X$ is stored in
• ${\mathbf{x}}\left[\left(j-1\right)×{\mathbf{pdx}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{x}}\left[\left(i-1\right)×{\mathbf{pdx}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: if ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR or NE_SINGULAR_WP, the $n$ by $r$ solution matrix $X$ to the original system of equations. Note that the arrays $A$ and $B$ are modified on exit if ${\mathbf{equed}}\ne \mathrm{Nag_NoEquilibration}$, and the solution to the equilibrated system is ${D}_{C}^{-1}X$ if ${\mathbf{trans}}=\mathrm{Nag_NoTrans}$ and ${\mathbf{equed}}=\mathrm{Nag_ColumnEquilibration}$ or $\mathrm{Nag_RowAndColumnEquilibration}$, or ${D}_{R}^{-1}X$ if ${\mathbf{trans}}=\mathrm{Nag_Trans}$ or $\mathrm{Nag_ConjTrans}$ and ${\mathbf{equed}}=\mathrm{Nag_RowEquilibration}$ or $\mathrm{Nag_RowAndColumnEquilibration}$.
19:   pdxIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array x.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdx}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdx}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{nrhs}}\right)$.
20:   rconddouble *Output
On exit: if no constraints are violated, an estimate of the reciprocal condition number of the matrix $A$ (after equilibration if that is performed), computed as ${\mathbf{rcond}}=1.0/\left({‖A‖}_{1}{‖{A}^{-1}‖}_{1}\right)$.
21:   ferr[nrhs]doubleOutput
On exit: if ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR or NE_SINGULAR_WP, an estimate of the forward error bound for each computed solution vector, such that ${‖{\stackrel{^}{x}}_{j}-{x}_{j}‖}_{\infty }/{‖{x}_{j}‖}_{\infty }\le {\mathbf{ferr}}\left[j-1\right]$ where ${\stackrel{^}{x}}_{j}$ is the $j$th column of the computed solution returned in the array x and ${x}_{j}$ is the corresponding column of the exact solution $X$. The estimate is as reliable as the estimate for rcond, and is almost always a slight overestimate of the true error.
22:   berr[nrhs]doubleOutput
On exit: if ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR or NE_SINGULAR_WP, an estimate of the component-wise relative backward error of each computed solution vector ${\stackrel{^}{x}}_{j}$ (i.e., the smallest relative change in any element of $A$ or $B$ that makes ${\stackrel{^}{x}}_{j}$ an exact solution).
23:   recip_growth_factordouble *Output
On exit: if ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR, the reciprocal pivot growth factor $‖A‖/‖U‖$, where $‖.‖$ denotes the maximum absolute element norm. If ${\mathbf{recip_growth_factor}}\ll 1$, the stability of the $LU$ factorization of (equilibrated) $A$ could be poor. This also means that the solution x, condition estimate rcond, and forward error bound ferr could be unreliable. If the factorization fails with ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_SINGULAR, then ${\mathbf{recip_growth_factor}}$ contains the reciprocal pivot growth factor for the leading ${\mathbf{fail}}\mathbf{.}\mathbf{errnum}$ columns of $A$.
24:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INT
On entry, ${\mathbf{kl}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{kl}}\ge 0$.
On entry, ${\mathbf{ku}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ku}}\ge 0$.
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}\ge 0$.
On entry, ${\mathbf{nrhs}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nrhs}}\ge 0$.
On entry, ${\mathbf{pdab}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdab}}>0$.
On entry, ${\mathbf{pdafb}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdafb}}>0$.
On entry, ${\mathbf{pdb}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdb}}>0$.
On entry, ${\mathbf{pdx}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdx}}>0$.
NE_INT_2
On entry, ${\mathbf{pdb}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry, ${\mathbf{pdb}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{nrhs}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{nrhs}}\right)$.
On entry, ${\mathbf{pdx}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdx}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry, ${\mathbf{pdx}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{nrhs}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdx}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{nrhs}}\right)$.
NE_INT_3
On entry, ${\mathbf{pdab}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{kl}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{ku}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdab}}\ge {\mathbf{kl}}+{\mathbf{ku}}+1$.
On entry, ${\mathbf{pdafb}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{kl}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{ku}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdafb}}\ge 2×{\mathbf{kl}}+{\mathbf{ku}}+1$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
NE_SINGULAR
$U\left(⟨\mathit{\text{value}}⟩,⟨\mathit{\text{value}}⟩\right)$ is exactly zero. The factorization has been completed, but the factor $U$ is exactly singular, so the solution and error bounds could not be computed. ${\mathbf{rcond}}=0.0$ is returned.
NE_SINGULAR_WP
$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.

## 7  Accuracy

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

## 8  Parallelism and Performance

nag_dgbsvx (f07bbc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_dgbsvx (f07bbc) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.

The band storage scheme for the array ab is illustrated by the following example, when $n=6$, ${k}_{l}=1$, and ${k}_{u}=2$. Storage of the band matrix $A$ in the array ab:
 $order=Nag_ColMajor * * a13 a24 a35 a46 * a12 a23 a34 a45 a56 a11 a22 a33 a44 a55 a66 a21 a32 a43 a54 a65 * order=Nag_RowMajor * a11 a12 a13 a21 a22 a23 a24 a32 a33 a34 a35 a43 a44 a45 a46 a54 a55 a56 * a65 a66 * *$
The total number of floating-point operations required to solve the equations $AX=B$ depends upon the pivoting required, but if $n\gg {k}_{l}+{k}_{u}$ then it is approximately bounded by $\mathit{O}\left(n{k}_{l}\left({k}_{l}+{k}_{u}\right)\right)$ for the factorization and $\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_dgbrfs (f07bhc) 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_zgbsvx (f07bpc).

## 10  Example

This example solves the equations
 $AX=B ,$
where $A$ is the band matrix
 $A = -0.23 2.54 -3.66 0.00 -6.98 2.46 -2.73 -2.13 0.00 2.56 2.46 4.07 0.00 0.00 -4.78 -3.82 and B = 4.42 -36.01 27.13 -31.67 -6.14 -1.16 10.50 -25.82 .$
Estimates for the backward errors, forward errors, condition number and pivot growth are also output, together with information on the equilibration of $A$.

### 10.1  Program Text

Program Text (f07bbce.c)

### 10.2  Program Data

Program Data (f07bbce.d)

### 10.3  Program Results

Program Results (f07bbce.r)