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_blast_zgb_norm (f16ub)

## Purpose

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

## Syntax

[result] = f16ub(job, m, kl, ku, ab, 'n', n)
[result] = nag_blast_zgb_norm(job, m, kl, ku, ab, 'n', n)

## Description

Given a complex $m$ by $n$ band matrix, $A$, nag_blast_zgb_norm (f16ub) 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 nag_blast_zgb_norm (f16ub) can calculate the value ${‖A‖}_{2}=\sqrt{\sum {\left|{a}_{i}\right|}^{2}}$ (the $2$-norm of $A$).

## 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

## Parameters

### Compulsory Input Parameters

1:     $\mathrm{job}$ – string (length ≥ 1)
Specifies the value to be returned.
${\mathbf{job}}=\text{'O'}$
The $1$-norm.
${\mathbf{job}}=\text{'T'}$
The $2$-norm of a row or column vector.
${\mathbf{job}}=\text{'I'}$
The $\infty$-norm.
${\mathbf{job}}=\text{'F'}$
The Frobenius (or Euclidean) norm.
${\mathbf{job}}=\text{'M'}$
The value $\underset{i,j}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}\left|{a}_{ij}\right|$ (not a norm).
Constraints:
• ${\mathbf{job}}=\text{'O'}$, $\text{'T'}$, $\text{'I'}$, $\text{'F'}$ or $\text{'M'}$;
• if ${\mathbf{job}}=\text{'T'}$, ${\mathbf{m}}=1$ or ${\mathbf{n}}=1$.
2:     $\mathrm{m}$int64int32nag_int scalar
$m$, the number of rows of the matrix $A$. If ${\mathbf{m}}\le 0$ on input, nag_blast_zgb_norm (f16ub) returns $0$.
3:     $\mathrm{kl}$int64int32nag_int scalar
${k}_{l}$, the number of subdiagonals within the band of $A$. If ${\mathbf{kl}}\le 0$ on input, nag_blast_zgb_norm (f16ub) returns $0$.
4:     $\mathrm{ku}$int64int32nag_int scalar
${k}_{u}$, the number of superdiagonals within the band of $A$. If ${\mathbf{ku}}\le 0$ on input, nag_blast_zgb_norm (f16ub) returns $0$.
5:     $\mathrm{ab}\left(\mathit{ldab},:\right)$ – complex array
The first dimension of the array ab must be at least ${\mathbf{kl}}+{\mathbf{ku}}+1$.
The second dimension of the array ab must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
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.$

### Optional Input Parameters

1:     $\mathrm{n}$int64int32nag_int scalar
Default: the second dimension of the array ab.
$n$, the number of columns of the matrix $A$. If ${\mathbf{n}}\le 0$ on input, nag_blast_zgb_norm (f16ub) returns $0$.

### Output Parameters

1:     $\mathrm{result}$ – double scalar
The result of the function.

## Error Indicators and Warnings

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

## 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.

## Example

Reads in a $6$ by $4$ banded complex matrix $A$ with two subdiagonals and one superdiagonal, and prints the four norms of $A$.
```function f16ub_example

fprintf('f16ub example results\n\n');

kl = int64(2);
ku = int64(1);
m  = int64(6);
a = [ 1+i, 1+2i, 0,    0;
2+i, 2+2i, 2+3i, 0;
3+i, 3+2i, 3+3i, 3+4i;
0,   4+2i, 4+3i, 4+4i;
0,   0,    5+3i, 5+4i;
0,   0,    0,    6+4i];
ab = complex(zeros(4, 6));
% Convert a to packed storage
[a, ab, ifail] = f01zd( ...
'p', kl, ku, a, ab);

fprintf('\nNorms of banded matrix ab:\n\n');

r_one = f16ub('o', m, kl, ku, ab);
fprintf('One norm           = %9.4f\n', r_one);

r_inf = f16ub('i', m, kl, ku, ab);
fprintf('Infinity norm      = %9.4f\n', r_inf);

r_fro = f16ub('f', m, kl, ku, ab);
fprintf('Frobenious norm    = %9.4f\n', r_fro);

r_max = f16ub('m', m, kl, ku, ab);
fprintf('Maximum norm       = %9.4f\n', r_max);

```
```f16ub example results

Norms of banded matrix ab:

One norm           =   24.2711
Infinity norm      =   16.0105
Frobenious norm    =   17.4069
Maximum norm       =    7.2111
```