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_dpttrf (f07jd)

## Purpose

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

## Syntax

[d, e, info] = f07jd(d, e, 'n', n)
[d, e, info] = nag_lapack_dpttrf(d, e, 'n', n)

## Description

nag_lapack_dpttrf (f07jd) 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.

## Parameters

### Compulsory Input Parameters

1:     $\mathrm{d}\left(:\right)$ – double array
The dimension of the array d must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
Must contain the $n$ diagonal elements of the matrix $A$.
2:     $\mathrm{e}\left(:\right)$ – double array
The dimension of the array e must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$
Must contain the $\left(n-1\right)$ subdiagonal elements of the matrix $A$.

### Optional Input Parameters

1:     $\mathrm{n}$int64int32nag_int scalar
Default: the dimension of the array d.
$n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.

### Output Parameters

1:     $\mathrm{d}\left(:\right)$ – double array
The dimension of the array d will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
Stores the $n$ diagonal elements of the diagonal matrix $D$ from the $LD{L}^{\mathrm{T}}$ factorization of $A$.
2:     $\mathrm{e}\left(:\right)$ – double array
The dimension of the array e will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$
Stores 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$.)
3:     $\mathrm{info}$int64int32nag_int scalar
${\mathbf{info}}=0$ unless the function detects an error (see Error Indicators and Warnings).

## Error Indicators and Warnings

${\mathbf{info}}<0$
If ${\mathbf{info}}=-i$, argument $i$ had an illegal value. An explanatory message is output, and execution of the program is terminated.
${\mathbf{info}}>0 \text{and} {\mathbf{info}}<{\mathbf{n}}$
The leading minor of order $_$ is not positive definite, the factorization could not be completed.
${\mathbf{info}}>0 \text{and} {\mathbf{info}}={\mathbf{n}}$
The leading minor of order $n$ is not positive definite, the factorization was completed, but ${\mathbf{d}}\left({\mathbf{n}}\right)\le 0$.

## Accuracy

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_lapack_dpttrs (f07je) can be used to solve systems of equations $AX=B$, and nag_lapack_dptcon (f07jg) can be used to estimate the condition number of $A$.

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_lapack_zpttrf (f07jr).

## Example

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 .$
```function f07jd_example

fprintf('f07jd example results\n\n');

% Symmetric tridiagonal A stored as two diagonals
d = [ 4     10     29     25     5];
e = [-2     -6     15     8       ];

[df, ef, info] = f07jd( ...
d, e);

disp('Details of factorization');
disp('The diagonal elements of D');
disp(df);
disp('Sub-diagonal elements of the Cholesky factor L');
disp(ef);

```
```f07jd example results

Details of factorization
The diagonal elements of D
4     9    25    16     1

Sub-diagonal elements of the Cholesky factor L
-0.5000   -0.6667    0.6000    0.5000

```