f07 Chapter Contents
f07 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_zpbequ (f07htc)

## 1  Purpose

nag_zpbequ (f07htc) computes a diagonal scaling matrix $S$ intended to equilibrate a complex $n$ by $n$ Hermitian positive definite band matrix $A$, with bandwidth $\left(2{k}_{d}+1\right)$, and reduce its condition number.

## 2  Specification

 #include #include
 void nag_zpbequ (Nag_OrderType order, Nag_UploType uplo, Integer n, Integer kd, const Complex ab[], Integer pdab, double s[], double *scond, double *amax, NagError *fail)

## 3  Description

nag_zpbequ (f07htc) 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  Arguments

1:     orderNag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or Nag_ColMajor.
2:     uploNag_UploTypeInput
On entry: indicates whether the upper or lower triangular part of $A$ is stored in the array ab, as follows:
${\mathbf{uplo}}=\mathrm{Nag_Upper}$
The upper triangle of $A$ is stored.
${\mathbf{uplo}}=\mathrm{Nag_Lower}$
The lower triangle of $A$ is stored.
Constraint: ${\mathbf{uplo}}=\mathrm{Nag_Upper}$ or $\mathrm{Nag_Lower}$.
3:     nIntegerInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
4:     kdIntegerInput
On entry: ${k}_{d}$, the number of superdiagonals of the matrix $A$ if ${\mathbf{uplo}}=\mathrm{Nag_Upper}$, or the number of subdiagonals if ${\mathbf{uplo}}=\mathrm{Nag_Lower}$.
Constraint: ${\mathbf{kd}}\ge 0$.
5:     ab[$\mathit{dim}$]const ComplexInput
Note: the dimension, dim, of the array ab must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdab}}×{\mathbf{n}}\right)$.
On entry: the upper or lower triangle of the Hermitian positive definite band matrix $A$ whose scaling factors are to be computed.
This is stored as a notional two-dimensional array with row elements or column elements stored contiguously. The storage of elements of ${A}_{ij}$, depends on the order and uplo arguments as follows:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Upper}$,
${A}_{ij}$ is stored in ${\mathbf{ab}}\left[{k}_{d}+i-j+\left(j-1\right)×{\mathbf{pdab}}\right]$, for $j=1,\dots ,n$ and $i=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,j-{k}_{d}\right),\dots ,j$;
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Lower}$,
${A}_{ij}$ is stored in ${\mathbf{ab}}\left[i-j+\left(j-1\right)×{\mathbf{pdab}}\right]$, for $j=1,\dots ,n$ and $i=j,\dots ,\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(n,j+{k}_{d}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Upper}$,
${A}_{ij}$ is stored in ${\mathbf{ab}}\left[j-i+\left(i-1\right)×{\mathbf{pdab}}\right]$, for $i=1,\dots ,n$ and $j=i,\dots ,\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(n,i+{k}_{d}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Lower}$,
${A}_{ij}$ is stored in ${\mathbf{ab}}\left[{k}_{d}+j-i+\left(i-1\right)×{\mathbf{pdab}}\right]$, for $i=1,\dots ,n$ and $j=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,i-{k}_{d}\right),\dots ,i$.
Only the elements of the array ab corresponding to the diagonal elements of $A$ are referenced. (Row $\left({k}_{d}+1\right)$ of ab when ${\mathbf{uplo}}=\mathrm{Nag_Upper}$, row $1$ of ab when ${\mathbf{uplo}}=\mathrm{Nag_Lower}$.)
6:     pdabIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) of the matrix $A$ in the array ab.
Constraint: ${\mathbf{pdab}}\ge {\mathbf{kd}}+1$.
7:     s[n]doubleOutput
On exit: if NE_NOERROR, s contains the diagonal elements of the scaling matrix $S$.
8:     sconddouble *Output
On exit: if NE_NOERROR, 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$.
9:     amaxdouble *Output
On exit: $\mathrm{max}\left|{a}_{ij}\right|$. If amax is very close to overflow or underflow, the matrix $A$ should be scaled.
10:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{kd}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{kd}}\ge 0$.
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 0$.
On entry, ${\mathbf{pdab}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdab}}>0$.
NE_INT_2
On entry, ${\mathbf{pdab}}=〈\mathit{\text{value}}〉$ and ${\mathbf{kd}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdab}}\ge {\mathbf{kd}}+1$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
NE_MAT_NOT_POS_DEF
The $〈\mathit{\text{value}}〉$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 function is nag_dpbequ (f07hfc).

## 9  Example

This example equilibrates the Hermitian positive definite matrix $A$ given by
 $A = 9.39 -i1.08-1.73i -i0 -i0 1.08+1.73i -i1.69 -0.04+0.29i×1010 -i0 0 -0.04-0.29i×1010 2.65×1020 -0.33+2.24i×1010 0 -i0 -0.33-2.24i×1010 -i2.17 .$
Details of the scaling factors and the scaled matrix are output.

### 9.1  Program Text

Program Text (f07htce.c)

### 9.2  Program Data

Program Data (f07htce.d)

### 9.3  Program Results

Program Results (f07htce.r)