F16 Chapter Contents
F16 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF16RBF

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

F16RBF calculates the value of the $1$-norm, the $\infty$-norm, the Frobenius norm or the maximum absolute value of the elements of a real $m$ by $n$ band matrix, stored in banded form.
It can also be used to compute the value of the $2$-norm of a row $n$-vector or a column $m$-vector.

## 2  Specification

 FUNCTION F16RBF ( INORM, M, N, KL, KU, AB, LDAB)
 REAL (KIND=nag_wp) F16RBF
 INTEGER INORM, M, N, KL, KU, LDAB REAL (KIND=nag_wp) AB(LDAB,*)

## 3  Description

Given a real $m$ by $n$ banded matrix, $A$, F16RBF calculates one of the values given by
 ${‖A‖}_{1}=\underset{j}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}\sum _{i=1}^{m}\left|{a}_{ij}\right|$ (the $1$-norm of $A$), ${‖A‖}_{\infty }=\underset{i}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}\sum _{j=1}^{n}\left|{a}_{ij}\right|$ (the $\infty$-norm of $A$), ${‖A‖}_{F}={\left(\sum _{i=1}^{m}\sum _{j=1}^{n}{\left|{a}_{ij}\right|}^{2}\right)}^{1/2}$ (the Frobenius norm of $A$),   or $\underset{i,j}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}\left|{a}_{ij}\right|$ (the maximum absolute element value of $A$).
If $m$ or $n$ is $1$ then additionally F16RBF can calculate the value ${‖A‖}_{2}=\sqrt{\sum {a}_{i}^{2}}$ (the $2$-norm of $A$).

## 4  References

Basic Linear Algebra Subprograms Technical (BLAST) Forum (2001) Basic Linear Algebra Subprograms Technical (BLAST) Forum Standard University of Tennessee, Knoxville, Tennessee http://www.netlib.org/blas/blast-forum/blas-report.pdf

## 5  Parameters

1:     INORM – INTEGERInput
On entry: specifies the value to be returned. The integer codes shown below can be replaced by the equivalent named constants of the form NAG_?_NORM. These named constants are available via the nag_library module and are also used in the example program for clarity.
${\mathbf{INORM}}=171$ (NAG_ONE_NORM)
The $1$-norm.
${\mathbf{INORM}}=173$ (NAG_TWO_NORM)
The $2$-norm of a row or column vector.
${\mathbf{INORM}}=175$ (NAG_INF_NORM)
The $\infty$-norm.
${\mathbf{INORM}}=174$ (NAG_FROBENIUS_NORM)
The Frobenius (or Euclidean) norm.
${\mathbf{INORM}}=177$ (NAG_MAX_NORM)
The value $\underset{i,j}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}\left|{a}_{ij}\right|$ (not a norm).
Constraints:
• ${\mathbf{INORM}}=171$, $173$, $174$, $175$ or $177$;
• if ${\mathbf{INORM}}=173$, ${\mathbf{M}}=1$ or ${\mathbf{N}}=1$.
2:     M – INTEGERInput
On entry: $m$, the number of rows of the matrix $A$. If ${\mathbf{M}}\le 0$ on input, F16RBF returns $0$.
3:     N – INTEGERInput
On entry: $n$, the number of columns of the matrix $A$. If ${\mathbf{N}}\le 0$ on input, F16RBF returns $0$.
4:     KL – INTEGERInput
On entry: ${k}_{l}$, the number of subdiagonals within the band of $A$. If ${\mathbf{KL}}\le 0$ on input, F16RBF returns $0$.
5:     KU – INTEGERInput
On entry: ${k}_{u}$, the number of superdiagonals within the band of $A$. If ${\mathbf{KU}}\le 0$ on input, F16RBF returns $0$.
6:     AB(LDAB,$*$) – REAL (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$.
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.$
7:     LDAB – INTEGERInput
On entry: the first dimension of the array AB as declared in the (sub)program from which F16RBF is called.
Constraint: ${\mathbf{LDAB}}\ge {\mathbf{KL}}+{\mathbf{KU}}+1$.

## 6  Error Indicators and Warnings

If any constraint on an input parameter is violated, an error message is printed and program execution is terminated.

## 7  Accuracy

The BLAS standard requires accurate implementations which avoid unnecessary over/underflow (see Section 2.7 of Basic Linear Algebra Subprograms Technical (BLAST) Forum (2001)).

None.

## 9  Example

Calculates the various norms of a $6$ by $4$ banded matrix with two subdiagonals and one superdiagonal.

### 9.1  Program Text

Program Text (f16rbfe.f90)

### 9.2  Program Data

Program Data (f16rbfe.d)

### 9.3  Program Results

Program Results (f16rbfe.r)