# NAG FL Interfacef01zdf (complex_​band_​pack)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

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

## 2Specification

Fortran Interface
 Subroutine f01zdf ( job, m, n, kl, ku, a, lda, b, ldb,
 Integer, Intent (In) :: m, n, kl, ku, lda, ldb Integer, Intent (Inout) :: ifail Complex (Kind=nag_wp), Intent (Inout) :: a(lda,n), b(ldb,*) Character (1), Intent (In) :: job
C Header Interface
#include <nag.h>
 void f01zdf_ (const char *job, const Integer *m, const Integer *n, const Integer *kl, const Integer *ku, Complex a[], const Integer *lda, Complex b[], const Integer *ldb, Integer *ifail, const Charlen length_job)
The routine may be called by the names f01zdf or nagf_matop_complex_band_pack.

## 3Description

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.

## 5Arguments

1: $\mathbf{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: $\mathbf{m}$Integer Input
3: $\mathbf{n}$Integer Input
On entry: $m$ and $n$, the number of rows and columns of the band matrix, respectively.
Constraints:
• ${\mathbf{m}}>0$;
• ${\mathbf{n}}>0$.
4: $\mathbf{kl}$Integer Input
On entry: ${k}_{l}$, the number of subdiagonals of the band matrix.
Constraint: ${\mathbf{kl}}\ge 0$.
5: $\mathbf{ku}$Integer Input
On entry: ${k}_{u}$, the number of superdiagonals of the band matrix.
Constraint: ${\mathbf{ku}}\ge 0$.
6: $\mathbf{a}\left({\mathbf{lda}},{\mathbf{n}}\right)$Complex (Kind=nag_wp) array Input/Output
On entry: if ${\mathbf{job}}=\text{'P'}$, the leading $m×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'}$, the leading $m×n$ part of a contains the band matrix stored in unpacked form. Elements of the leading $m×n$ part of a that are not within the banded part of the matrix are assigned the value zero.
7: $\mathbf{lda}$Integer Input
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: $\mathbf{b}\left({\mathbf{ldb}},*\right)$Complex (Kind=nag_wp) array Input/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'}$, b must contain the band matrix in packed form, in the leading $\left({k}_{l}+{k}_{u}+1\right)×\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}×{k}_{u}$ triangle, are not referenced and need not be assigned.
On exit: if ${\mathbf{job}}=\text{'P'}$, 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: $\mathbf{ldb}$Integer Input
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: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ 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).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-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}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{job}}=\text{'P'}$ or $\text{'U'}$.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{kl}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{kl}}\ge 0$.
${\mathbf{ifail}}=3$
On entry, ${\mathbf{ku}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ku}}\ge 0$.
${\mathbf{ifail}}=4$
On entry, ${\mathbf{lda}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{m}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{lda}}\ge {\mathbf{m}}$.
${\mathbf{ifail}}=5$
On entry, ${\mathbf{ldb}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{kl}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{ku}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ldb}}\ge {\mathbf{kl}}+{\mathbf{ku}}+1$.
${\mathbf{ifail}}=6$
On entry, ${\mathbf{m}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{m}}>0$.
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}>0$.
${\mathbf{ifail}}=-99$
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable.

## 8Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
f01zdf is not threaded in any implementation.

None.

## 10Example

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

### 10.1Program Text

Program Text (f01zdfe.f90)

### 10.2Program Data

Program Data (f01zdfe.d)

### 10.3Program Results

Program Results (f01zdfe.r)