hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_matop_real_band_pack (f01zc)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_matop_real_band_pack (f01zc) copies a real band matrix stored in a packed array into an unpacked array, or vice versa.

Syntax

[a, b, ifail] = f01zc(job, kl, ku, a, b, 'm', m, 'n', n)
[a, b, ifail] = nag_matop_real_band_pack(job, kl, ku, a, b, 'm', m, 'n', n)
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 22: m was made optional

Description

nag_matop_real_band_pack (f01zc) unpacks a band matrix that is stored in a packed array, or packs a band matrix that is stored in an unpacked array. The band matrix has m rows, n columns, kl nonzero subdiagonals, and ku nonzero superdiagonals. This function is intended for possible use in conjunction with functions from Chapters F07 and F08, where functions that use band matrices store them in the packed form described below.

References

None.

Parameters

Compulsory Input Parameters

1:     job – string (length ≥ 1)
Specifies whether the band matrix is to be packed or unpacked.
job='P' (Pack)
The band matrix is to be packed into array b.
job='U' (Unpack)
The band matrix is to be unpacked into array a.
Constraint: job='P' or 'U'.
2:     kl int64int32nag_int scalar
kl, the number of subdiagonals of the band matrix.
Constraint: kl0.
3:     ku int64int32nag_int scalar
ku, the number of superdiagonals of the band matrix.
Constraint: ku0.
4:     aldan – double array
lda, the first dimension of the array, must satisfy the constraint ldam.
If job='P', then the leading m by n part of a must contain the band matrix stored in unpacked form. Elements of the array that lie outside the banded part of the matrix are not referenced and need not be assigned.
5:     bldb: – double array
The first dimension of the array b must be at least kl+ku+1.
The second dimension of the array b must be at least minm+ku,n.
If job='U', then b must contain the band matrix in packed form, in the leading kl+ku+1 by minm+ku,n part of the array. The matrix is packed column by column, with the leading diagonal of the matrix in row ku+1 of b, the first superdiagonal starting at position 2 in row ku, the first subdiagonal starting at position 1 in row ku+2, and so on. Elements of b that are not needed to store the band matrix, for instance the leading ku by ku triangle, are not referenced and need not be assigned.

Optional Input Parameters

1:     m int64int32nag_int scalar
2:     n int64int32nag_int scalar
Default: For m, the first dimension of the array a. the second dimension of the array a.
m and n, the number of rows and columns of the band matrix, respectively.
Constraints:
  • m>0;
  • n>0.

Output Parameters

1:     aldan – double array
If job='U', then the leading m by n part of a contains the band matrix stored in unpacked form. Elements of the leading m by n part of a that are not within the banded part of the matrix are assigned the value zero.
2:     bldb: – double array
The first dimension of the array b will be kl+ku+1.
The second dimension of the array b will be minm+ku,n.
If job='P', then b contains the band matrix stored in packed form. Elements of b that are not needed to store the band matrix are not referenced.
3:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
On entry,job'P' or 'U'.
   ifail=2
On entry,kl<0.
   ifail=3
On entry,ku<0.
   ifail=4
On entry,lda<m.
   ifail=5
On entry,ldb<kl+ku+1.
   ifail=6
On entry,m<1,
orn<1.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

Not applicable.

Further Comments

None.

Example

This example reads a matrix A in unpacked form, and copies it to the packed matrix B.
function f01zc_example


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

job = 'Pack';
kl = int64(1);
ku = int64(1);
n  = 5;
a = [1.1, 1.2, 0,   0,   0;
     2.1, 2.2, 2.3, 0,   0;
     0,   3.2, 3.3, 3.4, 0;
     0,   0,   4.3, 4.4, 4.5;
     0,   0,   0,   5.4, 5.5];
b = zeros(kl+ku+1,n);

[A, ab, ifail] = f01zc(job, kl, ku, a, b);

disp('Unpacked Matrix A:');
disp(A);
fprintf('\n');
disp('Packed Matrix AB:');
disp(ab);


f01zc example results

Unpacked Matrix A:
    1.1000    1.2000         0         0         0
    2.1000    2.2000    2.3000         0         0
         0    3.2000    3.3000    3.4000         0
         0         0    4.3000    4.4000    4.5000
         0         0         0    5.4000    5.5000


Packed Matrix AB:
         0    1.2000    2.3000    3.4000    4.5000
    1.1000    2.2000    3.3000    4.4000    5.5000
    2.1000    3.2000    4.3000    5.4000         0


PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015