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_dgb_norm (f16rb)

Purpose

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

Syntax

[result] = f16rb(job, m, kl, ku, ab, 'n', n)
[result] = nag_blast_dgb_norm(job, m, kl, ku, ab, 'n', n)

Description

Given a real m$m$ by n$n$ banded matrix, A$A$, nag_blast_dgb_norm (f16rb) calculates one of the values given by
 ‖A‖1 = maxj  ∑ i = 1m|aij|${‖A‖}_{1}=\underset{j}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}\sum _{i=1}^{m}|{a}_{ij}|$ (the 1$1$-norm of A$A$), ‖A‖∞ = maxi  ∑ j = 1n|aij|${‖A‖}_{\infty }=\underset{i}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}\sum _{j=1}^{n}|{a}_{ij}|$ (the ∞$\infty$-norm of A$A$), ‖A‖F = ( ∑ i = 1m ∑ j = 1n|aij|2)1 / 2${‖A‖}_{F}={\left(\sum _{i=1}^{m}\sum _{j=1}^{n}{|{a}_{ij}|}^{2}\right)}^{1/2}$ (the Frobenius norm of A$A$),   or maxi,j |aij|$\underset{i,j}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}|{a}_{ij}|$ (the maximum absolute element value of A$A$).
If m$m$ or n$n$ is 1$1$ then additionally nag_blast_dgb_norm (f16rb) can calculate the value A2 = sqrt(ai2)${‖A‖}_{2}=\sqrt{\sum {a}_{i}^{2}}$ (the 2$2$-norm of A$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:     job – string (length ≥ 1)
Specifies the value to be returned.
job = 'One_Norm'${\mathbf{job}}=\text{'One_Norm'}$
The 1$1$-norm.
job = 'Two_Norm'${\mathbf{job}}=\text{'Two_Norm'}$
The 2$2$-norm of a row or column vector.
job = 'Inf_Norm'${\mathbf{job}}=\text{'Inf_Norm'}$
The $\infty$-norm.
job = 'Frobenius_Norm'${\mathbf{job}}=\text{'Frobenius_Norm'}$
The Frobenius (or Euclidean) norm.
job = 'Max_Norm'${\mathbf{job}}=\text{'Max_Norm'}$
The value maxi,j |aij|$\underset{i,j}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}|{a}_{ij}|$ (not a norm).
Constraint: job = 'One_Norm'${\mathbf{job}}=\text{'One_Norm'}$, 'Two_Norm'$\text{'Two_Norm'}$, 'Inf_Norm'$\text{'Inf_Norm'}$, 'Frobenius_Norm'$\text{'Frobenius_Norm'}$ or 'Max_Norm'$\text{'Max_Norm'}$.
2:     m – int64int32nag_int scalar
m$m$, the number of rows of the matrix A$A$. If m0${\mathbf{m}}\le 0$ on input, nag_blast_dgb_norm (f16rb) returns 0$0$.
3:     kl – int64int32nag_int scalar
kl${k}_{l}$, the number of subdiagonals within the band of A$A$. If kl0${\mathbf{kl}}\le 0$ on input, nag_blast_dgb_norm (f16rb) returns 0$0$.
4:     ku – int64int32nag_int scalar
ku${k}_{u}$, the number of superdiagonals within the band of A$A$. If ku0${\mathbf{ku}}\le 0$ on input, nag_blast_dgb_norm (f16rb) returns 0$0$.
5:     ab(ldab, : $:$) – double array
The first dimension of the array ab must be at least kl + ku + 1${\mathbf{kl}}+{\mathbf{ku}}+1$
The second dimension of the array must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The m$m$ by n$n$ band matrix A$A$.
The matrix is stored in rows 1$1$ to kl + ku + 1${k}_{l}+{k}_{u}+1$, more precisely, the element Aij${A}_{ij}$ must be stored in
 ab(ku + 1 + i − j,j)  for ​max (1,j − ku) ≤ i ≤ min (m,j + kl).$abku+1+i-jj for ​max(1,j-ku)≤i≤min(m,j+kl).$

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The second dimension of the array ab.
n$n$, the number of columns of the matrix A$A$. If n0${\mathbf{n}}\le 0$ on input, nag_blast_dgb_norm (f16rb) returns 0$0$.

ldab

Output Parameters

1:     result – double scalar
The result of the function.

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

```function nag_blast_dgb_norm_example
kl = int64(2);
ku = int64(2);
m  = int64(6);
a = [ 1, 1, 0, 0;
2, 2, 2, 0;
3, 3, 3, 3;
0, 4, 4, 4;
0, 0, 5, 5;
0, 0, 0, 6];
ab = zeros(5, 6);
% Convert a to packed storage
[a, ab, ifail] = nag_matop_real_band_pack('p', kl, ku, a, ab);

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

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

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

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

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

Norms of banded matrix ab:

One norm           =   18.0000
Infinity norm      =   12.0000
Frobenious norm    =   13.5647
Maximum norm       =    6.0000

```
```function f16rb_example
kl = int64(2);
ku = int64(2);
m  = int64(6);
a = [ 1, 1, 0, 0;
2, 2, 2, 0;
3, 3, 3, 3;
0, 4, 4, 4;
0, 0, 5, 5;
0, 0, 0, 6];
ab = zeros(5, 6);
% Convert a to packed storage
[a, ab, ifail] = f01zc('p', kl, ku, a, ab);

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

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

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

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

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

Norms of banded matrix ab:

One norm           =   18.0000
Infinity norm      =   12.0000
Frobenious norm    =   13.5647
Maximum norm       =    6.0000

```