F01 Chapter Contents
F01 Chapter Introduction
NAG Library Manual

NAG Library Routine DocumentF01ZDF

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

F01ZDF copies a complex band matrix stored in a packed array into an unpacked array, or vice versa.

2  Specification

 SUBROUTINE F01ZDF ( JOB, M, N, KL, KU, A, LDA, B, LDB, IFAIL)
 INTEGER M, N, KL, KU, LDA, LDB, IFAIL COMPLEX (KIND=nag_wp) A(LDA,N), B(LDB,*) CHARACTER(1) JOB

3  Description

F01ZDF 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, ${k}_{l}$ nonzero subdiagonals, and ${k}_{u}$ nonzero superdiagonals. This routine is intended for possible use in conjunction with routines from Chapters F06, F07 and F08, where routines that use band matrices store them in the packed form described below.

None.

5  Parameters

1:     JOB – CHARACTER(1)Input
On entry: specifies whether the band matrix is to be packed or unpacked.
${\mathbf{JOB}}=\text{'P'}$ (Pack)
The band matrix is to be packed into array B.
${\mathbf{JOB}}=\text{'U'}$ (Unpack)
The band matrix is to be unpacked into array A.
Constraint: ${\mathbf{JOB}}=\text{'P'}$ or $\text{'U'}$.
2:     M – INTEGERInput
3:     N – INTEGERInput
On entry: $m$ and $n$, the number of rows and columns of the band matrix, respectively.
Constraints:
• ${\mathbf{M}}>0$;
• ${\mathbf{N}}>0$.
4:     KL – INTEGERInput
On entry: ${k}_{l}$, the number of subdiagonals of the band matrix.
Constraint: ${\mathbf{KL}}\ge 0$.
5:     KU – INTEGERInput
On entry: ${k}_{u}$, the number of superdiagonals of the band matrix.
Constraint: ${\mathbf{KU}}\ge 0$.
6:     A(LDA,N) – COMPLEX (KIND=nag_wp) arrayInput/Output
On entry: if ${\mathbf{JOB}}=\text{'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.
On exit: if ${\mathbf{JOB}}=\text{'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.
7:     LDA – INTEGERInput
On entry: the first dimension of the array A as declared in the (sub)program from which F01ZDF is called.
Constraint: ${\mathbf{LDA}}\ge {\mathbf{M}}$.
8:     B(LDB,$*$) – COMPLEX (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array B must be at least $\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{M}}+{\mathbf{KU}},{\mathbf{N}}\right)$.
On entry: if ${\mathbf{JOB}}=\text{'U'}$, then B must contain the band matrix in packed form, in the leading $\left({k}_{l}+{k}_{u}+1\right)$ by $\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(m+{k}_{u},n\right)$ part of the array. The matrix is packed column by column, with the leading diagonal of the matrix in row $\left({k}_{u}+1\right)$ of B, the first superdiagonal starting at position $2$ in row ${k}_{u}$, the first subdiagonal starting at position $1$ in row $\left({k}_{u}+2\right)$, and so on. Elements of B that are not needed to store the band matrix, for instance the leading ${k}_{u}$ by ${k}_{u}$ triangle, are not referenced and need not be assigned.
On exit: if ${\mathbf{JOB}}=\text{'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.
9:     LDB – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which F01ZDF is called.
Constraint: ${\mathbf{LDB}}\ge \left({\mathbf{KL}}+{\mathbf{KU}}+1\right)$.
10:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=1$
 On entry, ${\mathbf{JOB}}\ne \text{'P'}$ or $\text{'U'}$.
${\mathbf{IFAIL}}=2$
 On entry, ${\mathbf{KL}}<0$.
${\mathbf{IFAIL}}=3$
 On entry, ${\mathbf{KU}}<0$.
${\mathbf{IFAIL}}=4$
 On entry, ${\mathbf{LDA}}<{\mathbf{M}}$.
${\mathbf{IFAIL}}=5$
 On entry, ${\mathbf{LDB}}<{\mathbf{KL}}+{\mathbf{KU}}+1$.
${\mathbf{IFAIL}}=6$
 On entry, ${\mathbf{M}}<1$, or ${\mathbf{N}}<1$.

Not applicable.

None.

9  Example

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

9.1  Program Text

Program Text (f01zdfe.f90)

9.2  Program Data

Program Data (f01zdfe.d)

9.3  Program Results

Program Results (f01zdfe.r)