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_dpptri (f07gj)

## Purpose

nag_lapack_dpptri (f07gj) computes the inverse of a real symmetric positive definite matrix A$A$, where A$A$ has been factorized by nag_lapack_dpptrf (f07gd), using packed storage.

## Syntax

[ap, info] = f07gj(uplo, n, ap)
[ap, info] = nag_lapack_dpptri(uplo, n, ap)

## Description

nag_lapack_dpptri (f07gj) is used to compute the inverse of a real symmetric positive definite matrix A$A$, the function must be preceded by a call to nag_lapack_dpptrf (f07gd), which computes the Cholesky factorization of A$A$, using packed storage.
If uplo = 'U'${\mathbf{uplo}}=\text{'U'}$, A = UTU$A={U}^{\mathrm{T}}U$ and A1${A}^{-1}$ is computed by first inverting U$U$ and then forming (U1)UT$\left({U}^{-1}\right){U}^{-\mathrm{T}}$.
If uplo = 'L'${\mathbf{uplo}}=\text{'L'}$, A = LLT$A=L{L}^{\mathrm{T}}$ and A1${A}^{-1}$ is computed by first inverting L$L$ and then forming LT(L1)${L}^{-\mathrm{T}}\left({L}^{-1}\right)$.

## References

Du Croz J J and Higham N J (1992) Stability of methods for matrix inversion IMA J. Numer. Anal. 12 1–19

## Parameters

### Compulsory Input Parameters

1:     uplo – string (length ≥ 1)
Specifies how A$A$ has been factorized.
uplo = 'U'${\mathbf{uplo}}=\text{'U'}$
A = UTU$A={U}^{\mathrm{T}}U$, where U$U$ is upper triangular.
uplo = 'L'${\mathbf{uplo}}=\text{'L'}$
A = LLT$A=L{L}^{\mathrm{T}}$, where L$L$ is lower triangular.
Constraint: uplo = 'U'${\mathbf{uplo}}=\text{'U'}$ or 'L'$\text{'L'}$.
2:     n – int64int32nag_int scalar
n$n$, the order of the matrix A$A$.
Constraint: n0${\mathbf{n}}\ge 0$.
3:     ap( : $:$) – double array
Note: the dimension of the array ap must be at least max (1,n × (n + 1) / 2)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×\left({\mathbf{n}}+1\right)/2\right)$.
The Cholesky factor of A$A$ stored in packed form, as returned by nag_lapack_dpptrf (f07gd).

None.

None.

### Output Parameters

1:     ap( : $:$) – double array
Note: the dimension of the array ap must be at least max (1,n × (n + 1) / 2)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×\left({\mathbf{n}}+1\right)/2\right)$.
The factorization stores the n$n$ by n$n$ matrix A1${A}^{-1}$.
More precisely,
• if uplo = 'U'${\mathbf{uplo}}=\text{'U'}$, the upper triangle of A1${A}^{-1}$ must be stored with element Aij${A}_{ij}$ in ap(i + j(j1) / 2)${\mathbf{ap}}\left(i+j\left(j-1\right)/2\right)$ for ij$i\le j$;
• if uplo = 'L'${\mathbf{uplo}}=\text{'L'}$, the lower triangle of A1${A}^{-1}$ must be stored with element Aij${A}_{ij}$ in ap(i + (2nj)(j1) / 2)${\mathbf{ap}}\left(i+\left(2n-j\right)\left(j-1\right)/2\right)$ for ij$i\ge j$.
2:     info – int64int32nag_int scalar
info = 0${\mathbf{info}}=0$ unless the function detects an error (see Section [Error Indicators and Warnings]).

## Error Indicators and Warnings

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

info = i${\mathbf{info}}=-i$
If info = i${\mathbf{info}}=-i$, parameter i$i$ had an illegal value on entry. The parameters are numbered as follows:
1: uplo, 2: n, 3: ap, 4: info.
W INFO > 0${\mathbf{INFO}}>0$
If info = i${\mathbf{info}}=i$, the i$i$th diagonal element of the Cholesky factor is zero; the Cholesky factor is singular and the inverse of A$A$ cannot be computed.

## Accuracy

The computed inverse X$X$ satisfies
 ‖XA − I‖2 ≤ c(n)εκ2(A)   and   ‖AX − I‖2 ≤ c(n)εκ2(A) , $‖XA-I‖2≤c(n)εκ2(A) and ‖AX-I‖2≤c(n)εκ2(A) ,$
where c(n)$c\left(n\right)$ is a modest function of n$n$, ε$\epsilon$ is the machine precision and κ2(A)${\kappa }_{2}\left(A\right)$ is the condition number of A$A$ defined by
 κ2(A) = ‖A‖2‖A − 1‖2 . $κ2(A)=‖A‖2‖A-1‖2 .$

The total number of floating point operations is approximately (2/3)n3$\frac{2}{3}{n}^{3}$.
The complex analogue of this function is nag_lapack_zpptri (f07gw).

## Example

```function nag_lapack_dpptri_example
uplo = 'L';
n = int64(4);
ap = [2.039607805437114;
-1.529705854077835;
0.2745625891934577;
-0.04902903378454601;
1.640121946685673;
-0.2499814119483738;
0.6737303907389101;
0.7887488055748053;
0.6616575633742563;
0.5346894269298685];
[apOut, info] = nag_lapack_dpptri(uplo, n, ap)
```
```

apOut =

0.6995
0.7769
0.7508
-0.9340
1.4239
1.8255
-1.8841
4.0688
-2.9342
3.4978

info =

0

```
```function f07gj_example
uplo = 'L';
n = int64(4);
ap = [2.039607805437114;
-1.529705854077835;
0.2745625891934577;
-0.04902903378454601;
1.640121946685673;
-0.2499814119483738;
0.6737303907389101;
0.7887488055748053;
0.6616575633742563;
0.5346894269298685];
[apOut, info] = f07gj(uplo, n, ap)
```
```

apOut =

0.6995
0.7769
0.7508
-0.9340
1.4239
1.8255
-1.8841
4.0688
-2.9342
3.4978

info =

0

```