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_zpttrf (f07jr)

## Purpose

nag_lapack_zpttrf (f07jr) computes the modified Cholesky factorization of a complex $n$ by $n$ Hermitian positive definite tridiagonal matrix $A$.

## Syntax

[d, e, info] = f07jr(d, e, 'n', n)
[d, e, info] = nag_lapack_zpttrf(d, e, 'n', n)

## Description

nag_lapack_zpttrf (f07jr) factorizes the matrix $A$ as
 $A=LDLH ,$
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{H}}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)$ – complex 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{H}}$ factorization of $A$.
2:     $\mathrm{e}\left(:\right)$ – complex 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=LDLH ,$
where
 $E∞=OεA∞$
and $\epsilon$ is the machine precision.
Following the use of this function, nag_lapack_zpttrs (f07js) can be used to solve systems of equations $AX=B$, and nag_lapack_zptcon (f07ju) 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 real analogue of this function is nag_lapack_dpttrf (f07jd).

## Example

This example factorizes the Hermitian positive definite tridiagonal matrix $A$ given by
 $A = 16.0i+00.0 16.0-16.0i 0.0i+0.0 0.0i+0.0 16.0+16.0i 41.0i+00.0 18.0+9.0i 0.0i+0.0 0.0i+00.0 18.0-09.0i 46.0i+0.0 1.0+4.0i 0.0i+00.0 0.0i+00.0 1.0-4.0i 21.0i+0.0 .$
```function f07jr_example

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

% Hermitian tridiagonal A stored as two diagonals
d = [ 16            41          46            21];
e = [ 16 + 16i      18 - 9i      1 - 4i         ];

% Factorize
[df, ef, info] = f07jr( ...
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);

```
```f07jr example results

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

Sub-diagonal elements of the Cholesky factor L
1.0000 + 1.0000i   2.0000 - 1.0000i   1.0000 - 4.0000i

```