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_dgbtrf (f07bd)

## Purpose

nag_lapack_dgbtrf (f07bd) computes the LU$LU$ factorization of a real m$m$ by n$n$ band matrix.

## Syntax

[ab, ipiv, info] = f07bd(m, kl, ku, ab, 'n', n)
[ab, ipiv, info] = nag_lapack_dgbtrf(m, kl, ku, ab, 'n', n)

## Description

nag_lapack_dgbtrf (f07bd) forms the LU$LU$ factorization of a real m$m$ by n$n$ band matrix A$A$ using partial pivoting, with row interchanges. Usually m = n$m=n$, and then, if A$A$ has kl${k}_{l}$ nonzero subdiagonals and ku${k}_{u}$ nonzero superdiagonals, the factorization has the form A = PLU$A=PLU$, where P$P$ is a permutation matrix, L$L$ is a lower triangular matrix with unit diagonal elements and at most kl${k}_{l}$ nonzero elements in each column, and U$U$ is an upper triangular band matrix with kl + ku${k}_{l}+{k}_{u}$ superdiagonals.
Note that L$L$ is not a band matrix, but the nonzero elements of L$L$ can be stored in the same space as the subdiagonal elements of A$A$. U$U$ is a band matrix but with kl${k}_{l}$ additional superdiagonals compared with A$A$. These additional superdiagonals are created by the row interchanges.

## References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

## Parameters

### Compulsory Input Parameters

1:     m – int64int32nag_int scalar
m$m$, the number of rows of the matrix A$A$.
Constraint: m0${\mathbf{m}}\ge 0$.
2:     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$.
3:     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$.
4:     ab(ldab, : $:$) – double array
The first dimension of the array ab 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)$
The m$m$ by n$n$ matrix A$A$.
The matrix is stored in rows kl + 1${k}_{l}+1$ to 2kl + ku + 1$2{k}_{l}+{k}_{u}+1$; the first kl${k}_{l}$ rows need not be set, more precisely, the element Aij${A}_{ij}$ must be stored in
 ab(kl + ku + 1 + i − j,j) = Aij  for ​max (1,j − ku) ≤ i ≤ min (m,j + kl).$abkl+ku+1+i-jj=Aij for ​max(1,j-ku)≤i≤min(m,j+kl).$
See Section [Further Comments] in (f07ba) for further details.

### Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The second dimension of the array ab.
n$n$, the number of columns of the matrix A$A$.
Constraint: n0${\mathbf{n}}\ge 0$.

ldab

### Output Parameters

1:     ab(ldab, : $:$) – double array
The first dimension of the array ab 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)$
ldab2 × kl + ku + 1$\mathit{ldab}\ge 2×{\mathbf{kl}}+{\mathbf{ku}}+1$.
If info0${\mathbf{info}}\ge 0$, ab stores details of the factorization.
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$.
2:     ipiv(min (m,n)$\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{m}},{\mathbf{n}}\right)$) – int64int32nag_int array
The pivot indices that define the permutation matrix. At the i$\mathit{i}$th step, if ipiv(i) > i${\mathbf{ipiv}}\left(\mathit{i}\right)>\mathit{i}$ then row i$\mathit{i}$ of the matrix A$A$ was interchanged with row ipiv(i)${\mathbf{ipiv}}\left(\mathit{i}\right)$, for i = 1,2,,min (m,n)$\mathit{i}=1,2,\dots ,\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(m,n\right)$. ipiv(i)i${\mathbf{ipiv}}\left(i\right)\le i$ indicates that, at the i$i$th step, a row interchange was not required.
3:     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: m, 2: n, 3: kl, 4: ku, 5: ab, 6: ldab, 7: ipiv, 8: 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 > 0${\mathbf{INFO}}>0$
If info = i${\mathbf{info}}=i$, U(i,i)$U\left(i,i\right)$ is exactly zero. The factorization has been completed, but the factor U$U$ is exactly singular, and division by zero will occur if it is used to solve a system of equations.

## Accuracy

The computed factors L$L$ and U$U$ are the exact factors of a perturbed matrix A + E$A+E$, where
 |E| ≤ c(k)εP|L||U| , $|E|≤c(k)εP|L||U| ,$
c(k)$c\left(k\right)$ is a modest linear function of k = kl + ku + 1$k={k}_{l}+{k}_{u}+1$, and ε$\epsilon$ is the machine precision. This assumes kmin (m,n)$k\ll \mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(m,n\right)$.

The total number of floating point operations varies between approximately 2nkl(ku + 1)$2n{k}_{l}\left({k}_{u}+1\right)$ and 2nkl(kl + ku + 1)$2n{k}_{l}\left({k}_{l}+{k}_{u}+1\right)$, depending on the interchanges, assuming m = nkl$m=n\gg {k}_{l}$ and nku$n\gg {k}_{u}$.
A call to nag_lapack_dgbtrf (f07bd) may be followed by calls to the functions:
• nag_lapack_dgbtrs (f07be) to solve AX = B$AX=B$ or ATX = B${A}^{\mathrm{T}}X=B$;
• nag_lapack_dgbcon (f07bg) to estimate the condition number of A$A$.
The complex analogue of this function is nag_lapack_zgbtrf (f07br).

## Example

```function nag_lapack_dgbtrf_example
m = int64(4);
kl = int64(1);
ku = int64(2);
ab = [0, 0, 0, 0;
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];
[abOut, ipiv, info] = nag_lapack_dgbtrf(m, kl, ku, ab)
```
```

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

ipiv =

2
3
3
4

info =

0

```
```function f07bd_example
m = int64(4);
kl = int64(1);
ku = int64(2);
ab = [0, 0, 0, 0;
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];
[abOut, ipiv, info] = f07bd(m, kl, ku, ab)
```
```

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

ipiv =

2
3
3
4

info =

0

```