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_zpoequ (f07ft)

## Purpose

nag_lapack_zpoequ (f07ft) computes a diagonal scaling matrix S $S$ intended to equilibrate a complex n $n$ by n $n$ Hermitian positive definite matrix A $A$ and reduce its condition number.

## Syntax

[s, scond, amax, info] = f07ft(a, 'n', n)
[s, scond, amax, info] = nag_lapack_zpoequ(a, 'n', n)

## Description

nag_lapack_zpoequ (f07ft) computes a diagonal scaling matrix S $S$ chosen so that
 sj = 1 / sqrt(ajj) . $sj=1 / ajj .$
This means that the matrix B $B$ given by
 B = SAS , $B=SAS ,$
has diagonal elements equal to unity. This in turn means that the condition number of B $B$, κ2(B) ${\kappa }_{2}\left(B\right)$, is within a factor n $n$ of the matrix of smallest possible condition number over all possible choices of diagonal scalings (see Corollary 7.6 of Higham (2002)).

## References

Higham N J (2002) Accuracy and Stability of Numerical Algorithms (2nd Edition) SIAM, Philadelphia

## Parameters

### Compulsory Input Parameters

1:     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 matrix A$A$ whose scaling factors are to be computed. Only the diagonal elements of the array a are referenced.

### 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:     s(n) – double array
If ${\mathbf{INFO}}={\mathbf{0}}$, s contains the diagonal elements of the scaling matrix S$S$.
2:     scond – double scalar
If ${\mathbf{INFO}}={\mathbf{0}}$, scond contains the ratio of the smallest value of s to the largest value of s. If scond0.1${\mathbf{scond}}\ge 0.1$ and amax is neither too large nor too small, it is not worth scaling by S$S$.
3:     amax – double scalar
max|aij|$\mathrm{max}|{a}_{ij}|$. If amax is very close to overflow or underflow, the matrix A$A$ should be scaled.
4:     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

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: n, 2: a, 3: lda, 4: s, 5: scond, 6: amax, 7: 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.
INFO > 0${\mathbf{INFO}}>0$
If info = i${\mathbf{info}}=i$, the i$i$th diagonal element of A$A$ is not positive (and hence A$A$ cannot be positive definite).

## Accuracy

The computed scale factors will be close to the exact scale factors.

The real analogue of this function is nag_lapack_dpoequ (f07ff).

## Example

```function nag_lapack_zpoequ_example
a = [3.23,  1.51 - 1.92i,  190000 + 84000i,  0.42 + 2.5i;
0 + 0i,  3.58 + 0i,  -23000 + 111000i,  -1.18 + 1.37i;
0 + 0i,  0 + 0i,  40900000000 + 0i,  233000 - 14000i;
0 + 0i,  0 + 0i,  0 + 0i,  4.29 + 0i];
[s, scond, amax, info] = nag_lapack_zpoequ(a)
```
```

s =

0.5564
0.5285
0.0000
0.4828

scond =

8.8867e-06

amax =

4.0900e+10

info =

0

```
```function f07ft_example
a = [3.23,  1.51 - 1.92i,  190000 + 84000i,  0.42 + 2.5i;
0 + 0i,  3.58 + 0i,  -23000 + 111000i,  -1.18 + 1.37i;
0 + 0i,  0 + 0i,  40900000000 + 0i,  233000 - 14000i;
0 + 0i,  0 + 0i,  0 + 0i,  4.29 + 0i];
[s, scond, amax, info] = f07ft(a)
```
```

s =

0.5564
0.5285
0.0000
0.4828

scond =

8.8867e-06

amax =

4.0900e+10

info =

0

```