F07 Chapter Contents
F07 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF07FTF (ZPOEQU)

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

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

## 2  Specification

 SUBROUTINE F07FTF ( N, A, LDA, S, SCOND, AMAX, INFO)
 INTEGER N, LDA, INFO REAL (KIND=nag_wp) S(N), SCOND, AMAX COMPLEX (KIND=nag_wp) A(LDA,*)
The routine may be called by its LAPACK name zpoequ.

## 3  Description

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

## 4  References

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

## 5  Parameters

1:     N – INTEGERInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{N}}\ge 0$.
2:     A(LDA,$*$) – COMPLEX (KIND=nag_wp) arrayInput
Note: the second dimension of the array A must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
On entry: the matrix $A$ whose scaling factors are to be computed. Only the diagonal elements of the array A are referenced.
3:     LDA – INTEGERInput
On entry: the first dimension of the array A as declared in the (sub)program from which F07FTF (ZPOEQU) is called.
Constraint: ${\mathbf{LDA}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
4:     S(N) – REAL (KIND=nag_wp) arrayOutput
On exit: if ${\mathbf{INFO}}={\mathbf{0}}$, S contains the diagonal elements of the scaling matrix $S$.
5:     SCOND – REAL (KIND=nag_wp)Output
On exit: if ${\mathbf{INFO}}={\mathbf{0}}$, SCOND contains the ratio of the smallest value of S to the largest value of S. If ${\mathbf{SCOND}}\ge 0.1$ and AMAX is neither too large nor too small, it is not worth scaling by $S$.
6:     AMAX – REAL (KIND=nag_wp)Output
On exit: $\mathrm{max}\left|{a}_{ij}\right|$. If AMAX is very close to overflow or underflow, the matrix $A$ should be scaled.
7:     INFO – INTEGEROutput
On exit: ${\mathbf{INFO}}=0$ unless the routine detects an error (see Section 6).

## 6  Error Indicators and Warnings

Errors or warnings detected by the routine:
${\mathbf{INFO}}<0$
If ${\mathbf{INFO}}=-i$, the $i$th argument had an illegal value. An explanatory message is output, and execution of the program is terminated.
${\mathbf{INFO}}>0$
If ${\mathbf{INFO}}=i$, the $i$th diagonal element of $A$ is not positive (and hence $A$ cannot be positive definite).

## 7  Accuracy

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

The real analogue of this routine is F07FFF (DPOEQU).

## 9  Example

This example equilibrates the Hermitian positive definite matrix $A$ given by
 $A = (3.23 -(1.51-1.92i 1.90+0.84i×1050 -0.42+2.50i (1.51+1.92i -(3.58 -0.23+1.11i×1050 -1.18+1.37i 1.90-0.84i×105 -0.23-1.11i×105 -4.09×1010 (2.33-0.14i×105 (0.42-2.50i (-1.18-1.37i 2.33+0.14i×1050 -4.29 .$
Details of the scaling factors and the scaled matrix are output.

### 9.1  Program Text

Program Text (f07ftfe.f90)

### 9.2  Program Data

Program Data (f07ftfe.d)

### 9.3  Program Results

Program Results (f07ftfe.r)