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_zpotri (f07fw)

## Purpose

nag_lapack_zpotri (f07fw) computes the inverse of a complex Hermitian positive definite matrix A$A$, where A$A$ has been factorized by nag_lapack_zpotrf (f07fr).

## Syntax

[a, info] = f07fw(uplo, a, 'n', n)
[a, info] = nag_lapack_zpotri(uplo, a, 'n', n)

## Description

nag_lapack_zpotri (f07fw) 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_zpotrf (f07fr), which computes the Cholesky factorization of A$A$.
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:     a(lda, : $:$) – complex array
The first dimension of the array a must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The second dimension of the array must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The upper triangular matrix U$U$ if uplo = 'U'${\mathbf{uplo}}=\text{'U'}$ or the lower triangular matrix L$L$ if uplo = 'L'${\mathbf{uplo}}=\text{'L'}$, as returned by nag_lapack_zpotrf (f07fr).

### Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The first dimension of the array a The second dimension of the array a.
n$n$, the order of the matrix A$A$.
Constraint: n0${\mathbf{n}}\ge 0$.

lda

### Output Parameters

1:     a(lda, : $:$) – complex array
The first dimension of the array a will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The second dimension of the array will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
ldamax (1,n)$\mathit{lda}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
U$U$ stores the upper triangle of A1${A}^{-1}$ if uplo = 'U'${\mathbf{uplo}}=\text{'U'}$; L$L$ stores the lower triangle of A1${A}^{-1}$ if uplo = 'L'${\mathbf{uplo}}=\text{'L'}$.
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: a, 4: lda, 5: info.
It is possible that info refers to a parameter that is omitted from the MATLAB interface. This usually indicates that an error in one of the other input parameters has caused an incorrect value to be inferred.
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_dpotri (f07fj).

## Example

```function nag_lapack_zpotri_example
uplo = 'L';
a = [complex(3.23),  0 + 0i,  0 + 0i,  0 + 0i;
1.51 + 1.92i,  3.58 + 0i,  0 + 0i,  0 + 0i;
1.9 - 0.84i,  -0.23 - 1.11i,  4.09 + 0i,  0 + 0i;
0.42 - 2.5i,  -1.18 - 1.37i,  2.33 + 0.14i,  4.29 + 0i];
[a, info] = nag_lapack_zpotrf(uplo, a);
[aOut, info] = nag_lapack_zpotri(uplo, a)
```
```

aOut =

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

info =

0

```
```function f07fw_example
uplo = 'L';
a = [complex(3.23),  0 + 0i,  0 + 0i,  0 + 0i;
1.51 + 1.92i,  3.58 + 0i,  0 + 0i,  0 + 0i;
1.9 - 0.84i,  -0.23 - 1.11i,  4.09 + 0i,  0 + 0i;
0.42 - 2.5i,  -1.18 - 1.37i,  2.33 + 0.14i,  4.29 + 0i];
[a, info] = f07fr(uplo, a);
[aOut, info] = f07fw(uplo, a)
```
```

aOut =

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

info =

0

```