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_zpptri (f07gw)

## Purpose

nag_lapack_zpptri (f07gw) computes the inverse of a complex Hermitian positive definite matrix A$A$, where A$A$ has been factorized by nag_lapack_zpptrf (f07gr), using packed storage.

## Syntax

[ap, info] = f07gw(uplo, n, ap)
[ap, info] = nag_lapack_zpptri(uplo, n, ap)

## Description

nag_lapack_zpptri (f07gw) is used to compute the inverse of a complex Hermitian positive definite matrix A$A$, the function must be preceded by a call to nag_lapack_zpptrf (f07gr), which computes the Cholesky factorization of A$A$, using packed storage.
If uplo = 'U'${\mathbf{uplo}}=\text{'U'}$, A = UHU$A={U}^{\mathrm{H}}U$ and A1${A}^{-1}$ is computed by first inverting U$U$ and then forming (U1)UH$\left({U}^{-1}\right){U}^{-\mathrm{H}}$.
If uplo = 'L'${\mathbf{uplo}}=\text{'L'}$, A = LLH$A=L{L}^{\mathrm{H}}$ and A1${A}^{-1}$ is computed by first inverting L$L$ and then forming LH(L1)${L}^{-\mathrm{H}}\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 = UHU$A={U}^{\mathrm{H}}U$, where U$U$ is upper triangular.
uplo = 'L'${\mathbf{uplo}}=\text{'L'}$
A = LLH$A=L{L}^{\mathrm{H}}$, 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( : $:$) – complex 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_zpptrf (f07gr).

None.

None.

### Output Parameters

1:     ap( : $:$) – complex 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 real floating point operations is approximately (8/3)n3$\frac{8}{3}{n}^{3}$.
The real analogue of this function is nag_lapack_dpptri (f07gj).

## Example

```function nag_lapack_zpptri_example
uplo = 'L';
n = int64(4);
ap = [1.797220075561143;
0.8401864749527325 + 1.068316577423342i;
1.057188279741849 - 0.467388502622712i;
0.233694251311356 - 1.391037210186643i;
1.316353439509685 + 0i;
-0.4701749470106329 + 0.3130658155999466i;
0.08335250923944192 + 0.03676071443037458i;
1.560392977137124 + 0i;
0.9359617337923402 + 0.9899692192815736i;
0.6603332973655893 + 0i];
[apOut, info] = nag_lapack_zpptri(uplo, n, ap)
```
```

apOut =

5.4691 + 0.0000i
-1.2624 - 1.5491i
-2.9746 - 0.9616i
1.1962 + 2.9772i
1.1024 + 0.0000i
0.8989 - 0.5672i
-0.9826 - 0.2566i
2.1589 + 0.0000i
-1.3756 - 1.4550i
2.2934 + 0.0000i

info =

0

```
```function f07gw_example
uplo = 'L';
n = int64(4);
ap = [1.797220075561143;
0.8401864749527325 + 1.068316577423342i;
1.057188279741849 - 0.467388502622712i;
0.233694251311356 - 1.391037210186643i;
1.316353439509685 + 0i;
-0.4701749470106329 + 0.3130658155999466i;
0.08335250923944192 + 0.03676071443037458i;
1.560392977137124 + 0i;
0.9359617337923402 + 0.9899692192815736i;
0.6603332973655893 + 0i];
[apOut, info] = f07gw(uplo, n, ap)
```
```

apOut =

5.4691 + 0.0000i
-1.2624 - 1.5491i
-2.9746 - 0.9616i
1.1962 + 2.9772i
1.1024 + 0.0000i
0.8989 - 0.5672i
-0.9826 - 0.2566i
2.1589 + 0.0000i
-1.3756 - 1.4550i
2.2934 + 0.0000i

info =

0

```