NAG Library Routine Document

1Purpose

c09fyf extracts a selected set of discrete wavelet transform (DWT) coefficients from the full set of coefficients stored in compact form, as computed by c09faf (single level three-dimensional DWT) or c09fcf (multi-level three-dimensional DWT).

2Specification

Fortran Interface
 Subroutine c09fyf ( ilev, lenc, c, d, ldd, sdd,
 Integer, Intent (In) :: ilev, cindex, lenc, ldd, sdd Integer, Intent (Inout) :: icomm(260), ifail Real (Kind=nag_wp), Intent (In) :: c(lenc) Real (Kind=nag_wp), Intent (Inout) :: d(ldd,sdd,*)
#include nagmk26.h
 void c09fyf_ (const Integer *ilev, const Integer *cindex, const Integer *lenc, const double c[], double d[], const Integer *ldd, const Integer *sdd, Integer icomm[], Integer *ifail)

3Description

c09fyf is intended to be used after a call to either c09faf (single level three-dimensional DWT) or c09fcf (multi-level three-dimensional DWT), either of which must be preceded by a call to c09acf (three-dimensional wavelet filter initialization). Given an initial three-dimensional data set $A$, a prior call to c09faf or c09fcf computes the approximation coefficients (at the highest requested level in the case of c09fcf) and seven sets of detail coefficients (at all levels in the case of c09fcf) and stores these in compact form in a one-dimensional array c. c09fyf can then extract either the approximation coefficients or one of the sets of detail coefficients (at one of the levels following c09fcf) into a three-dimensional data set stored in d.
If a multi-level DWT was performed by a prior call to c09fcf then the dimensions of the three-dimensional data stored in d depend on the level extracted and are available from the arrays dwtlvm, dwtlvn and dwtlvfr as returned by c09fcf which contain the first, second and third dimensions respectively.
If a single level DWT was performed by a prior call to c09faf then the dimensions of the three-dimensional data stored in d can be determined from nwct, nwcn and nwcfr as returned by the setup routine c09acf.
See Section 2.1 in the C09 Chapter Introduction for a discussion of the three-dimensional DWT.

None.

5Arguments

Note: the following notation is used in this section:
• ${n}_{\mathrm{cm}}$ is the number of wavelet coefficients in the first dimension. Following a call to c09faf (i.e., when ${\mathbf{ilev}}=0$) this is equal to ${\mathbf{nwct}}/\left(8×{\mathbf{nwcn}}×{\mathbf{nwcfr}}\right)$ as returned by c09acf. Following a call to c09fcf transforming nwl levels, and when extracting at level ${\mathbf{ilev}}>0$, this is equal to ${\mathbf{dwtlvm}}\left({\mathbf{nwl}}-{\mathbf{ilev}}+1\right)$.
• ${n}_{\mathrm{cn}}$ is the number of wavelet coefficients in the second dimension. Following a call to c09faf (i.e., when ${\mathbf{ilev}}=0$) this is equal to nwcn as returned by c09acf. Following a call to c09fcf transforming nwl levels, and when extracting at level ${\mathbf{ilev}}>0$, this is equal to ${\mathbf{dwtlvn}}\left({\mathbf{nwl}}-{\mathbf{ilev}}+1\right)$.
• ${n}_{\mathrm{cfr}}$ is the number of wavelet coefficients in the third dimension. Following a call to c09faf (i.e., when ${\mathbf{ilev}}=0$) this is equal to nwcfr as returned by c09acf. Following a call to c09fcf transforming nwl levels, and when extracting at level ${\mathbf{ilev}}>0$, this is equal to ${\mathbf{dwtlvfr}}\left({\mathbf{nwl}}-{\mathbf{ilev}}+1\right)$
1:     $\mathbf{ilev}$ – IntegerInput
On entry: the level at which coefficients are to be extracted.
If ${\mathbf{ilev}}=0$, it is assumed that the coefficient array c was produced by a preceding call to the single level routine c09faf.
If ${\mathbf{ilev}}>0$, it is assumed that the coefficient array c was produced by a preceding call to the multi-level routine c09fcf.
Constraints:
• ${\mathbf{ilev}}=0$ (following a call to c09faf);
• $0\le {\mathbf{ilev}}\le {\mathbf{nwl}}$, where nwl is as used in a preceding call to c09fcf;
• if ${\mathbf{cindex}}=0$, ${\mathbf{ilev}}={\mathbf{nwl}}$ (following a call to c09fcf).
2:     $\mathbf{cindex}$ – IntegerInput
On entry: identifies which coefficients to extract. The coefficients are identified as follows:
${\mathbf{cindex}}=0$
The approximation coefficients, produced by application of the low pass filter over columns, rows and frames of $A$ (LLL). After a call to the multi-level transform routine c09fcf (which implies that ${\mathbf{ilev}}>0$) the approximation coefficients are available only for ${\mathbf{ilev}}={\mathbf{nwl}}$, where nwl is the value used in a preceding call to c09fcf.
${\mathbf{cindex}}=1$
The detail coefficients produced by applying the low pass filter over columns and rows of $A$ and the high pass filter over frames (LLH).
${\mathbf{cindex}}=2$
The detail coefficients produced by applying the low pass filter over columns, high pass filter over rows and low pass filter over frames of $A$ (LHL).
${\mathbf{cindex}}=3$
The detail coefficients produced by applying the low pass filter over columns of $A$ and high pass filter over rows and frames (LHH).
${\mathbf{cindex}}=4$
The detail coefficients produced by applying the high pass filter over columns of $A$ and low pass filter over rows and frames (HLL).
${\mathbf{cindex}}=5$
The detail coefficients produced by applying the high pass filter over columns, low pass filter over rows and high pass filter over frames of $A$ (HLH).
${\mathbf{cindex}}=6$
The detail coefficients produced by applying the high pass filter over columns and rows of $A$ and the low pass filter over frames (HHL).
${\mathbf{cindex}}=7$
The detail coefficients produced by applying the high pass filter over columns, rows and frames of $A$ (HHH).
Constraints:
• if ${\mathbf{ilev}}=0$, $0\le {\mathbf{cindex}}\le 7$;
• if ${\mathbf{ilev}}={\mathbf{nwl}}$, following a call to c09fcf transforming nwl levels, $0\le {\mathbf{cindex}}\le 7$;
• otherwise $1\le {\mathbf{cindex}}\le 7$.
3:     $\mathbf{lenc}$ – IntegerInput
On entry: the dimension of the array c as declared in the (sub)program from which c09fyf is called.
Constraint: lenc must be unchanged from the value used in the preceding call to either c09faf or c09fcf..
4:     $\mathbf{c}\left({\mathbf{lenc}}\right)$ – Real (Kind=nag_wp) arrayInput
On entry: DWT coefficients, as computed by c09faf or c09fcf.
5:     $\mathbf{d}\left({\mathbf{ldd}},{\mathbf{sdd}},*\right)$ – Real (Kind=nag_wp) arrayOutput
Note: the last dimension of the array d must be at least ${n}_{\mathrm{cfr}}$.
On exit: the requested coefficients.
If the DWT coefficients were computed by c09faf then
• if ${\mathbf{cindex}}=0$, the approximation coefficients are stored in ${\mathbf{d}}\left(i,\mathit{j},\mathit{k}\right)$, for $\mathit{i}=1,2,\dots ,{n}_{\mathrm{cm}}$, $\mathit{j}=1,2,\dots ,{n}_{\mathrm{cn}}$ and $\mathit{k}=1,2,\dots ,{n}_{\mathrm{cfr}}$;
• if $1\le {\mathbf{cindex}}\le 7$, the detail coefficients, as indicated by cindex, are stored in ${\mathbf{d}}\left(i,\mathit{j},\mathit{k}\right)$, for $\mathit{i}=1,2,\dots ,{n}_{\mathrm{cm}}$, $\mathit{j}=1,2,\dots ,{n}_{\mathrm{cn}}$ and $\mathit{k}=1,2,\dots ,{n}_{\mathrm{cfr}}$.
If the DWT coefficients were computed by c09fcf then
• if ${\mathbf{cindex}}=0$ and ${\mathbf{ilev}}={\mathbf{nwl}}$, the approximation coefficients are stored in ${\mathbf{d}}\left(i,\mathit{j},\mathit{k}\right)$, for $\mathit{i}=1,2,\dots ,{n}_{\mathrm{cm}}$, $\mathit{j}=1,2,\dots ,{n}_{\mathrm{cn}}$ and $\mathit{k}=1,2,\dots ,{n}_{\mathrm{cfr}}$;
• if $1\le {\mathbf{cindex}}\le 7$, the detail coefficients, as indicated by cindex, for level ilev are stored in ${\mathbf{d}}\left(i,\mathit{j},\mathit{k}\right)$, for $\mathit{i}=1,2,\dots ,{n}_{\mathrm{cm}}$, $\mathit{j}=1,2,\dots ,{n}_{\mathrm{cn}}$ and $\mathit{k}=1,2,\dots ,{n}_{\mathrm{cfr}}$.
6:     $\mathbf{ldd}$ – IntegerInput
On entry: the first dimension of the array d as declared in the (sub)program from which c09fyf is called.
Constraint: ${\mathbf{ldd}}\ge {n}_{\mathrm{cm}}$.
7:     $\mathbf{sdd}$ – IntegerInput
On entry: the second dimension of the array d as declared in the (sub)program from which c09fyf is called.
Constraint: ${\mathbf{sdd}}\ge {n}_{\mathrm{cn}}$.
8:     $\mathbf{icomm}\left(260\right)$ – Integer arrayCommunication Array
On entry: contains details of the discrete wavelet transform and the problem dimension as setup in the call to the initialization routine c09acf.
9:     $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation 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 argument, 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).

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{ilev}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ilev}}=0$ following a call to the single level routine c09faf.
On entry, ${\mathbf{ilev}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ilev}}>0$ following a call to the multi-level routine c09fcf.
On entry, ${\mathbf{ilev}}=〈\mathit{\text{value}}〉$ and ${\mathbf{nwl}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ilev}}\le {\mathbf{nwl}}$, where nwl is the number of levels used in the call to c09fcf.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{cindex}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{cindex}}\le 7$.
On entry, ${\mathbf{cindex}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{cindex}}\ge 0$.
${\mathbf{ifail}}=3$
On entry, ${\mathbf{lenc}}=〈\mathit{\text{value}}〉$ and ${n}_{\mathrm{ct}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{lenc}}\ge {n}_{\mathrm{ct}}$, where ${n}_{\mathrm{ct}}$ is the number of DWT coefficients computed in the preceding call to c09faf.
On entry, ${\mathbf{lenc}}=〈\mathit{\text{value}}〉$ and ${n}_{\mathrm{ct}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{lenc}}\ge {n}_{\mathrm{ct}}$, where ${n}_{\mathrm{ct}}$ is the number of DWT coefficients computed in the preceding call to c09fcf.
${\mathbf{ifail}}=4$
On entry, ${\mathbf{ldd}}=〈\mathit{\text{value}}〉$ and ${n}_{\mathrm{cm}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldd}}\ge {n}_{\mathrm{cm}}$, where ${n}_{\mathrm{cm}}$ is the number of DWT coefficients in the first dimension at the selected level ilev.
On entry, ${\mathbf{ldd}}=〈\mathit{\text{value}}〉$ and ${n}_{\mathrm{cm}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldd}}\ge {n}_{\mathrm{cm}}$, where ${n}_{\mathrm{cm}}$ is the number of DWT coefficients in the first dimension following the single level transform.
On entry, ${\mathbf{sdd}}=〈\mathit{\text{value}}〉$ and ${n}_{\mathrm{cn}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{sdd}}\ge {n}_{\mathrm{cn}}$, where ${n}_{\mathrm{cn}}$ is the number of DWT coefficients in the second dimension at the selected level ilev.
On entry, ${\mathbf{sdd}}=〈\mathit{\text{value}}〉$ and ${n}_{\mathrm{cn}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{sdd}}\ge {n}_{\mathrm{cn}}$, where ${n}_{\mathrm{cn}}$ is the number of DWT coefficients in the second dimension following the single level transform.
${\mathbf{ifail}}=5$
On entry, ${\mathbf{ilev}}=〈\mathit{\text{value}}〉$ and ${\mathbf{nwl}}=〈\mathit{\text{value}}〉$, but ${\mathbf{cindex}}=0$.
Constraint: ${\mathbf{cindex}}>0$ when ${\mathbf{ilev}}<{\mathbf{nwl}}$ in the preceding call to c09fcf.
${\mathbf{ifail}}=6$
Either the initialization routine has not been called first or icomm has been corrupted.
${\mathbf{ifail}}=-99$
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

Not applicable.

8Parallelism and Performance

c09fyf is not threaded in any implementation.