# NAG C Library Function Document

## 1Purpose

nag_dpbstf (f08ufc) computes a split Cholesky factorization of a real symmetric positive definite band matrix.

## 2Specification

 #include #include
 void nag_dpbstf (Nag_OrderType order, Nag_UploType uplo, Integer n, Integer kb, double bb[], Integer pdbb, NagError *fail)

## 3Description

nag_dpbstf (f08ufc) computes a split Cholesky factorization of a real symmetric positive definite band matrix $B$. It is designed to be used in conjunction with nag_dsbgst (f08uec).
The factorization has the form $B={S}^{\mathrm{T}}S$, where $S$ is a band matrix of the same bandwidth as $B$ and the following structure: $S$ is upper triangular in the first $\left(n+k\right)/2$ rows, and transposed — hence, lower triangular — in the remaining rows. For example, if $n=9$ and $k=2$, then
 $S = s11 s12 s13 s22 s23 s24 s33 s34 s35 s44 s45 s55 s64 s65 s66 s75 s76 s77 s86 s87 s88 s97 s98 s99 .$

None.

## 5Arguments

1:    $\mathbf{order}$Nag_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.3.1.3 in How to Use the NAG Library and its Documentation for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or $\mathrm{Nag_ColMajor}$.
2:    $\mathbf{uplo}$Nag_UploTypeInput
On entry: indicates whether the upper or lower triangular part of $B$ is stored.
${\mathbf{uplo}}=\mathrm{Nag_Upper}$
The upper triangular part of $B$ is stored.
${\mathbf{uplo}}=\mathrm{Nag_Lower}$
The lower triangular part of $B$ is stored.
Constraint: ${\mathbf{uplo}}=\mathrm{Nag_Upper}$ or $\mathrm{Nag_Lower}$.
3:    $\mathbf{n}$IntegerInput
On entry: $n$, the order of the matrix $B$.
Constraint: ${\mathbf{n}}\ge 0$.
4:    $\mathbf{kb}$IntegerInput
On entry: if ${\mathbf{uplo}}=\mathrm{Nag_Upper}$, the number of superdiagonals, ${k}_{b}$, of the matrix $B$.
If ${\mathbf{uplo}}=\mathrm{Nag_Lower}$, the number of subdiagonals, ${k}_{b}$, of the matrix $B$.
Constraint: ${\mathbf{kb}}\ge 0$.
5:    $\mathbf{bb}\left[\mathit{dim}\right]$doubleInput/Output
Note: the dimension, dim, of the array bb must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdbb}}×{\mathbf{n}}\right)$.
On entry: the $n$ by $n$ symmetric positive definite band matrix $B$.
This is stored as a notional two-dimensional array with row elements or column elements stored contiguously. The storage of elements of ${B}_{ij}$, depends on the order and uplo arguments as follows:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Upper}$,
${B}_{ij}$ is stored in ${\mathbf{bb}}\left[{k}_{b}+i-j+\left(j-1\right)×{\mathbf{pdbb}}\right]$, for $j=1,\dots ,n$ and $i=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,j-{k}_{b}\right),\dots ,j$;
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Lower}$,
${B}_{ij}$ is stored in ${\mathbf{bb}}\left[i-j+\left(j-1\right)×{\mathbf{pdbb}}\right]$, for $j=1,\dots ,n$ and $i=j,\dots ,\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(n,j+{k}_{b}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Upper}$,
${B}_{ij}$ is stored in ${\mathbf{bb}}\left[j-i+\left(i-1\right)×{\mathbf{pdbb}}\right]$, for $i=1,\dots ,n$ and $j=i,\dots ,\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(n,i+{k}_{b}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Lower}$,
${B}_{ij}$ is stored in ${\mathbf{bb}}\left[{k}_{b}+j-i+\left(i-1\right)×{\mathbf{pdbb}}\right]$, for $i=1,\dots ,n$ and $j=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,i-{k}_{b}\right),\dots ,i$.
On exit: $B$ is overwritten by the elements of its split Cholesky factor $S$.
6:    $\mathbf{pdbb}$IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) of the matrix $B$ in the array bb.
Constraint: ${\mathbf{pdbb}}\ge {\mathbf{kb}}+1$.
7:    $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{kb}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{kb}}\ge 0$.
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 0$.
On entry, ${\mathbf{pdbb}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdbb}}>0$.
NE_INT_2
On entry, ${\mathbf{pdbb}}=〈\mathit{\text{value}}〉$ and ${\mathbf{kb}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdbb}}\ge {\mathbf{kb}}+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.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_POS_DEF
The factorization could not be completed, because the updated element $b\left(〈\mathit{\text{value}}〉,〈\mathit{\text{value}}〉\right)$ would be the square root of a negative number. Hence $B$ is not positive definite. This may indicate an error in forming the matrix $B$.

## 7Accuracy

The computed factor $S$ is the exact factor of a perturbed matrix $\left(B+E\right)$, where
 $E≤ck+1εSTS,$
$c\left(k+1\right)$ is a modest linear function of $k+1$, and $\epsilon$ is the machine precision. It follows that $\left|{e}_{ij}\right|\le c\left(k+1\right)\epsilon \sqrt{\left({b}_{ii}{b}_{jj}\right)}$.

## 8Parallelism and Performance

nag_dpbstf (f08ufc) 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.
Please consult the x06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

The total number of floating-point operations is approximately $n{\left(k+1\right)}^{2}$, assuming $n\gg k$.
A call to nag_dpbstf (f08ufc) may be followed by a call to nag_dsbgst (f08uec) to solve the generalized eigenproblem $Az=\lambda Bz$, where $A$ and $B$ are banded and $B$ is positive definite.
The complex analogue of this function is nag_zpbstf (f08utc).

## 10Example

See Section 10 in nag_dsbgst (f08uec).