# NAG Library Function Document

## 1Purpose

nag_dpttrf (f07jdc) computes the modified Cholesky factorization of a real $n$ by $n$ symmetric positive definite tridiagonal matrix $A$.

## 2Specification

 #include #include
 void nag_dpttrf (Integer n, double d[], double e[], NagError *fail)

## 3Description

nag_dpttrf (f07jdc) factorizes the matrix $A$ as
 $A=LDLT ,$
where $L$ is a unit lower bidiagonal matrix and $D$ is a diagonal matrix with positive diagonal elements. The factorization may also be regarded as having the form ${U}^{\mathrm{T}}DU$, where $U$ is a unit upper bidiagonal matrix.

None.

## 5Arguments

1:    $\mathbf{n}$IntegerInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
2:    $\mathbf{d}\left[\mathit{dim}\right]$doubleInput/Output
Note: the dimension, dim, of the array d must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: must contain the $n$ diagonal elements of the matrix $A$.
On exit: is overwritten by the $n$ diagonal elements of the diagonal matrix $D$ from the $LD{L}^{\mathrm{T}}$ factorization of $A$.
3:    $\mathbf{e}\left[\mathit{dim}\right]$doubleInput/Output
Note: the dimension, dim, of the array e must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$.
On entry: must contain the $\left(n-1\right)$ subdiagonal elements of the matrix $A$.
On exit: is overwritten by the $\left(n-1\right)$ subdiagonal elements of the lower bidiagonal matrix $L$. (e can also be regarded as containing the $\left(n-1\right)$ superdiagonal elements of the upper bidiagonal matrix $U$.)
4:    $\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{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 0$.
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_MAT_NOT_POS_DEF
The leading minor of order $n$ is not positive definite, the factorization was completed, but ${\mathbf{d}}\left[{\mathbf{n}}-1\right]\le 0$.
The leading minor of order $〈\mathit{\text{value}}〉$ is not positive definite, the factorization could not be completed.
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.

## 7Accuracy

The computed factorization satisfies an equation of the form
 $A+E=LDLT ,$
where
 $E∞=OεA∞$
and $\epsilon$ is the machine precision.
Following the use of this function, nag_dpttrs (f07jec) can be used to solve systems of equations $AX=B$, and nag_dptcon (f07jgc) can be used to estimate the condition number of $A$.

## 8Parallelism and Performance

nag_dpttrf (f07jdc) is not threaded in any implementation.

The total number of floating-point operations required to factorize the matrix $A$ is proportional to $n$.
The complex analogue of this function is nag_zpttrf (f07jrc).

## 10Example

This example factorizes the symmetric positive definite tridiagonal matrix $A$ given by
 $A = 4.0 -2.0 0.0 0.0 0.0 -2.0 10.0 -6.0 0.0 0.0 0.0 -6.0 29.0 15.0 0.0 0.0 0.0 15.0 25.0 8.0 0.0 0.0 0.0 8.0 5.0 .$

### 10.1Program Text

Program Text (f07jdce.c)

### 10.2Program Data

Program Data (f07jdce.d)

### 10.3Program Results

Program Results (f07jdce.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017