F07 Chapter Contents
F07 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF07BTF (ZGBEQU)

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

F07BTF (ZGBEQU) computes diagonal scaling matrices ${D}_{R}$ and ${D}_{C}$ intended to equilibrate a complex $m$ by $n$ band matrix $A$ of band width $\left({k}_{l}+{k}_{u}+1\right)$, and reduce its condition number.

## 2  Specification

 SUBROUTINE F07BTF ( M, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND, AMAX, INFO)
 INTEGER M, N, KL, KU, LDAB, INFO REAL (KIND=nag_wp) R(M), C(N), ROWCND, COLCND, AMAX COMPLEX (KIND=nag_wp) AB(LDAB,*)
The routine may be called by its LAPACK name zgbequ.

## 3  Description

F07BTF (ZGBEQU) computes the diagonal scaling matrices. The diagonal scaling matrices are chosen to try to make the elements of largest absolute value in each row and column of the matrix $B$ given by
 $B = DR A DC$
have absolute value $1$. The diagonal elements of ${D}_{R}$ and ${D}_{C}$ are restricted to lie in the safe range $\left(\delta ,1/\delta \right)$, where $\delta$ is the value returned by routine X02AMF. Use of these scaling factors is not guaranteed to reduce the condition number of $A$ but works well in practice.

None.

## 5  Parameters

1:     $\mathrm{M}$ – INTEGERInput
On entry: $m$, the number of rows of the matrix $A$.
Constraint: ${\mathbf{M}}\ge 0$.
2:     $\mathrm{N}$ – INTEGERInput
On entry: $n$, the number of columns of the matrix $A$.
Constraint: ${\mathbf{N}}\ge 0$.
3:     $\mathrm{KL}$ – INTEGERInput
On entry: ${k}_{l}$, the number of subdiagonals of the matrix $A$.
Constraint: ${\mathbf{KL}}\ge 0$.
4:     $\mathrm{KU}$ – INTEGERInput
On entry: ${k}_{u}$, the number of superdiagonals of the matrix $A$.
Constraint: ${\mathbf{KU}}\ge 0$.
5:     $\mathrm{AB}\left({\mathbf{LDAB}},*\right)$ – COMPLEX (KIND=nag_wp) arrayInput
Note: the second dimension of the array AB must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
On entry: the $m$ by $n$ band matrix $A$ whose scaling factors are to be computed.
The matrix is stored in rows $1$ to ${k}_{l}+{k}_{u}+1$, more precisely, the element ${A}_{ij}$ must be stored in
 $ABku+1+i-jj for ​max1,j-ku≤i≤minm,j+kl.$
See Section 9 in F07BNF (ZGBSV) for further details.
6:     $\mathrm{LDAB}$ – INTEGERInput
On entry: the first dimension of the array AB as declared in the (sub)program from which F07BTF (ZGBEQU) is called.
Constraint: ${\mathbf{LDAB}}\ge {\mathbf{KL}}+{\mathbf{KU}}+1$.
7:     $\mathrm{R}\left({\mathbf{M}}\right)$ – REAL (KIND=nag_wp) arrayOutput
On exit: if ${\mathbf{INFO}}={\mathbf{0}}$ or ${\mathbf{INFO}}>\mathbf{M}$, R contains the row scale factors, the diagonal elements of ${D}_{R}$. The elements of R will be positive.
8:     $\mathrm{C}\left({\mathbf{N}}\right)$ – REAL (KIND=nag_wp) arrayOutput
On exit: if ${\mathbf{INFO}}={\mathbf{0}}$, C contains the column scale factors, the diagonal elements of ${D}_{C}$. The elements of C will be positive.
9:     $\mathrm{ROWCND}$ – REAL (KIND=nag_wp)Output
On exit: if ${\mathbf{INFO}}={\mathbf{0}}$ or ${\mathbf{INFO}}>\mathbf{M}$, ROWCND contains the ratio of the smallest value of ${\mathbf{R}}\left(i\right)$ to the largest value of ${\mathbf{R}}\left(i\right)$. If ${\mathbf{ROWCND}}\ge 0.1$ and AMAX is neither too large nor too small, it is not worth scaling by ${D}_{R}$.
10:   $\mathrm{COLCND}$ – REAL (KIND=nag_wp)Output
On exit: if ${\mathbf{INFO}}={\mathbf{0}}$, COLCND contains the ratio of the smallest value of ${\mathbf{C}}\left(i\right)$ to the largest value of ${\mathbf{C}}\left(i\right)$.
If ${\mathbf{COLCND}}\ge 0.1$, it is not worth scaling by ${D}_{C}$.
11:   $\mathrm{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.
12:   $\mathrm{INFO}$ – INTEGEROutput
On exit: ${\mathbf{INFO}}=0$ unless the routine detects an error (see Section 6).

## 6  Error Indicators and Warnings

${\mathbf{INFO}}<0$
If ${\mathbf{INFO}}=-i$, argument $i$ had an illegal value. An explanatory message is output, and execution of the program is terminated.
${\mathbf{INFO}}>0 \text{and} {\mathbf{INFO}}\le {\mathbf{M}}$
Row $〈\mathit{\text{value}}〉$ of $A$ is exactly zero.
${\mathbf{INFO}}>{\mathbf{M}}$
Column $〈\mathit{\text{value}}〉$ of $A$ is exactly zero.

## 7  Accuracy

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

Not applicable.

## 9  Further Comments

The real analogue of this routine is F07BFF (DGBEQU).

## 10  Example

This example equilibrates the complex band matrix $A$ given by
 $A = -1.65+2.26i -2.05-0.85i×10-10 -(0.97-2.84i ((0 -0.00+6.30i -1.48-1.75i×10-10 (-3.99+4.01i ((0.59-0.48i -0 (-0.77+2.83i -1.06+1.94i×1010 (3.33-1.04i×1010 -0 -(0 -(0.48-1.09i -0.46-1.72i .$
Details of the scaling factors, and the scaled matrix are output.

### 10.1  Program Text

Program Text (f07btfe.f90)

### 10.2  Program Data

Program Data (f07btfe.d)

### 10.3  Program Results

Program Results (f07btfe.r)