f04 Chapter Contents
f04 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_real_cholesky_skyline_solve (f04mcc)

## 1  Purpose

nag_real_cholesky_skyline_solve (f04mcc) computes the approximate solution of a system of real linear equations with multiple right-hand sides, $AX=B$, where $A$ is a symmetric positive definite variable-bandwidth matrix, which has previously been factorized by nag_real_cholesky_skyline (f01mcc). Related systems may also be solved.

## 2  Specification

 #include #include
 void nag_real_cholesky_skyline_solve (Nag_SolveSystem selct, Integer n, Integer nrhs, const double al[], Integer lal, const double d[], const Integer row[], const double b[], Integer tdb, double x[], Integer tdx, NagError *fail)

## 3  Description

The normal use of nag_real_cholesky_skyline_solve (f04mcc) is the solution of the systems $AX=B$, following a call of nag_real_cholesky_skyline (f01mcc) to determine the Cholesky factorization $A=LD{L}^{\mathrm{T}}$ of the symmetric positive definite variable-bandwidth matrix $A$.
However, the function may be used to solve any one of the following systems of linear algebraic equations:
 $LDLT X =B ​ (usual system)$ (1)
 $LDX =B ​ (lower triangular system)$ (2)
 $DLT X =B ​ (upper triangular system)$ (3)
 $LLT X =B$ (4)
 $LX =B ​ (unit lower triangular system)$ (5)
 $LT X =B ​ (unit upper triangular system)$ (6)
$L$ denotes a unit lower triangular variable-bandwidth matrix of order $n$, $D$ a diagonal matrix of order $n$, and $B$ a set of right-hand sides.
The matrix $L$ is represented by the elements lying within its envelope, i.e., between the first nonzero of each row and the diagonal (see Section 9 for an example). The width ${\mathbf{row}}\left[i\right]$ of the $i$th row is the number of elements between the first nonzero element and the element on the diagonal inclusive.

## 4  References

Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag

## 5  Arguments

1:     selctNag_SolveSystemInput
On entry: selct must specify the type of system to be solved, as follows:
• if ${\mathbf{selct}}=\mathrm{Nag_LDLTX}$: solve ${LDL}^{TX}=B$;
• if ${\mathbf{selct}}=\mathrm{Nag_LDX}$: solve $LDX=B$;
• if ${\mathbf{selct}}=\mathrm{Nag_DLTX}$: solve ${DL}^{\mathrm{T}}X=B$;
• if ${\mathbf{selct}}=\mathrm{Nag_LLTX}$: solve ${LL}^{\mathrm{T}}X=B$;
• if ${\mathbf{selct}}=\mathrm{Nag_LX}$: solve $LX=B$;
• if ${\mathbf{selct}}=\mathrm{Nag_LTX}$: solve ${L}^{\mathrm{T}}X=B$.
Constraint: ${\mathbf{selct}}=\mathrm{Nag_LDLTX}$, $\mathrm{Nag_LDX}$, $\mathrm{Nag_DLTX}$, $\mathrm{Nag_LLTX}$, $\mathrm{Nag_LX}$ or $\mathrm{Nag_LTX}$.
2:     nIntegerInput
On entry: $n$, the order of the matrix $L$.
Constraint: ${\mathbf{n}}\ge 1$.
3:     nrhsIntegerInput
On entry: $r$, the number of right-hand sides.
Constraint: ${\mathbf{nrhs}}\ge 1$.
4:     al[lal]const doubleInput
On entry: the elements within the envelope of the lower triangular matrix $L$, taken in row by row order, as returned by nag_real_cholesky_skyline (f01mcc). The unit diagonal elements of $L$ must be stored explicitly.
5:     lalIntegerInput
On entry: the dimension of the array al.
Constraint: ${\mathbf{lal}}\ge {\mathbf{row}}\left[0\right]+{\mathbf{row}}\left[1\right]+\cdots +{\mathbf{row}}\left[n-1\right]$.
6:     d[n]const doubleInput
On entry: the diagonal elements of the diagonal matrix $D$. d is not referenced if ${\mathbf{selct}}=\mathrm{Nag_LLTX}$, $\mathrm{Nag_LX}$ or $\mathrm{Nag_LTX}$
7:     row[n]const IntegerInput
On entry: ${\mathbf{row}}\left[i\right]$ must contain the width of row $i$ of $L$, i.e., the number of elements between the first (left-most) nonzero element and the element on the diagonal, inclusive.
Constraint: $1\le {\mathbf{row}}\left[i\right]\le i+1$ for $i=0,1,\dots ,n-1$.
8:     b[${\mathbf{n}}×{\mathbf{tdb}}$]const doubleInput
Note: the $\left(i,j\right)$th element of the matrix $B$ is stored in ${\mathbf{b}}\left[\left(i-1\right)×{\mathbf{tdb}}+j-1\right]$.
On entry: the $n$ by $r$ right-hand side matrix $B$. See also Section 8.
9:     tdbIntegerInput
On entry: the stride separating matrix column elements in the array b.
Constraint: ${\mathbf{tdb}}\ge {\mathbf{nrhs}}$.
10:   x[${\mathbf{n}}×{\mathbf{tdx}}$]doubleOutput
Note: the $\left(i,j\right)$th element of the matrix $X$ is stored in ${\mathbf{x}}\left[\left(i-1\right)×{\mathbf{tdx}}+j-1\right]$.
On exit: the $n$ by $r$ solution matrix $X$. See also Section 8.
11:   tdxIntegerInput
On entry: the stride separating matrix column elements in the array x.
Constraint: ${\mathbf{tdx}}\ge {\mathbf{nrhs}}$.
12:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

NE_2_INT_ARG_GT
On entry, ${\mathbf{row}}\left[i\right]=〈\mathit{\text{value}}〉$ while $i=〈\mathit{\text{value}}〉$. These arguments must satisfy ${\mathbf{row}}\left[i\right]\le i+1$.
NE_2_INT_ARG_LT
On entry, ${\mathbf{lal}}=〈\mathit{\text{value}}〉$ while ${\mathbf{row}}\left[0\right]+\cdots +{\mathbf{row}}\left[n-1\right]=〈\mathit{\text{value}}〉$. These arguments must satisfy ${\mathbf{lal}}\ge {\mathbf{row}}\left[0\right]+\cdots +{\mathbf{row}}\left[n-1\right]$.
On entry, ${\mathbf{tdb}}=〈\mathit{\text{value}}〉$ while ${\mathbf{nrhs}}=〈\mathit{\text{value}}〉$. These arguments must satisfy ${\mathbf{tdb}}\ge {\mathbf{nrhs}}$.
On entry, ${\mathbf{tdx}}=〈\mathit{\text{value}}〉$ while ${\mathbf{nrhs}}=〈\mathit{\text{value}}〉$. These arguments must satisfy ${\mathbf{tdx}}\ge {\mathbf{nrhs}}$.
On entry, argument selct had an illegal value.
NE_INT_ARG_LT
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 1$.
On entry, ${\mathbf{nrhs}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{nrhs}}\ge 1$.
On entry, ${\mathbf{row}}\left[〈\mathit{\text{value}}〉\right]$ must not be less than 1: ${\mathbf{row}}\left[〈\mathit{\text{value}}〉\right]=〈\mathit{\text{value}}〉$.
NE_NOT_UNIT_DIAG
The lower triangular matrix $L$ has at least one diagonal element which is not equal to unity. The first non-unit element has been located in the array ${\mathbf{al}}\left[〈\mathit{\text{value}}〉\right]$.
NE_ZERO_DIAG
The diagonal matrix $D$ is singular as it has at least one zero element. The first zero element has been located in the array ${\mathbf{d}}\left[〈\mathit{\text{value}}〉\right]$.

## 7  Accuracy

The usual backward error analysis of the solution of triangular system applies: each computed solution vector is exact for slightly perturbed matrices $L$ and $D$, as appropriate (see pages 25-27 and 54-55 of Wilkinson and Reinsch (1971)).

The time taken by nag_real_cholesky_skyline_solve (f04mcc) is approximately proportional to $pr$, where $p={\mathbf{row}}\left[0\right]+{\mathbf{row}}\left[1\right]+\cdots +{\mathbf{row}}\left[n-1\right]$.
The function may be called with the same actual array supplied for the arguments b and x, in which case the solution matrix will overwrite the right-hand side matrix.

## 9  Example

To solve the system of equations $AX=B$, where
 $A = 1 2 0 0 5 0 2 5 3 0 14 0 0 3 13 0 18 0 0 0 0 16 8 24 5 14 18 8 55 17 0 0 0 24 17 77 and B = 6 -10 15 -21 11 0-3 00 -24 51 -39 46 -67 .$
Here $A$ is symmetric and positive definite and must first be factorized by nag_real_cholesky_skyline (f01mcc).

### 9.1  Program Text

Program Text (f04mcce.c)

### 9.2  Program Data

Program Data (f04mcce.d)

### 9.3  Program Results

Program Results (f04mcce.r)