# NAG CL Interfacec09eyc (dim2_​coeff_​ext)

Settings help

CL Name Style:

## 1Purpose

c09eyc extracts a selected set of discrete wavelet transform (DWT) coefficients from the full set of coefficients stored in compact form, as computed by c09ecc (two-dimensional DWT).

## 2Specification

 #include
 void c09eyc (Integer ilev, Integer cindex, Integer lenc, const double c[], double d[], Integer pdd, Integer icomm[], NagError *fail)
The function may be called by the names: c09eyc, nag_wav_dim2_coeff_ext or nag_wav_2d_coeff_ext.

## 3Description

c09eyc is intended to be used after a call to c09ecc (two-dimensional DWT), which in turn should be preceded by a call to c09abc (two-dimensional wavelet filter initialization). Given an initial two-dimensional data set $A$, a prior call to c09ecc computes the approximation coefficients (at the highest requested level) and three sets of detail coefficients at all levels and stores these in compact form in a one-dimensional array c. c09eyc can then extract either the approximation coefficients or one of the sets of detail coefficients at one of the levels into a matrix $D$. The dimensions of $D$ depend on the level extracted and are available from the arrays dwtlvm and dwtlvn as returned by c09ecc which contain the first and second dimensions respectively. See Section 2.1 in the C09 Chapter Introduction for a discussion of the two-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, which, at level ilev, is equal to ${\mathbf{dwtlvm}}\left[{\mathbf{nwl}}-{\mathbf{ilev}}\right]$ as returned by a call to c09ecc transforming nwl levels.
• ${n}_{\mathrm{cn}}$ is the number of wavelet coefficients in the second dimension, which, at level ilev, is equal to ${\mathbf{dwtlvn}}\left[{\mathbf{nwl}}-{\mathbf{ilev}}\right]$ as returned by a call to c09ecc transforming nwl levels.
1: $\mathbf{ilev}$Integer Input
On entry: the level at which coefficients are to be extracted.
Constraints:
• $1\le {\mathbf{ilev}}\le {\mathbf{nwl}}$, where nwl is as used in a preceding call to c09ecc;
• if ${\mathbf{cindex}}=0$, ${\mathbf{ilev}}={\mathbf{nwl}}$.
2: $\mathbf{cindex}$Integer Input
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 and rows of the original matrix (LL). The approximation coefficients are available only for ${\mathbf{ilev}}={\mathbf{nwl}}$, where nwl is the value used in a preceding call to c09ecc.
${\mathbf{cindex}}=1$
The vertical detail coefficients produced by applying the low pass filter over columns of the original matrix and the high pass filter over rows (LH).
${\mathbf{cindex}}=2$
The horizontal detail coefficients produced by applying the high pass filter over columns of the original matrix and the low pass filter over rows (HL).
${\mathbf{cindex}}=3$
The diagonal detail coefficients produced by applying the high pass filter over columns and rows of the original matrix (HH).
Constraint: $0\le {\mathbf{cindex}}\le 3$ when ${\mathbf{ilev}}={\mathbf{nwl}}$ as used in c09ecc, otherwise $1\le {\mathbf{cindex}}\le 3$.
3: $\mathbf{lenc}$Integer Input
On entry: the dimension of the array c.
Constraint: lenc must be unchanged from the value used in the preceding call to c09ecc.
4: $\mathbf{c}\left[{\mathbf{lenc}}\right]$const double Input
On entry: DWT coefficients, as computed by a preceding call to c09ecc.
5: $\mathbf{d}\left[\mathit{dim}\right]$double Output
Note: the dimension, dim, of the array d must be at least ${\mathbf{pdd}}×{n}_{\mathrm{cn}}$.
On exit: the requested coefficients.
If ${\mathbf{ilev}}={\mathbf{nwl}}$ (as used in c09ecc) and ${\mathbf{cindex}}=0$, the ${n}_{\mathit{cm}}×{n}_{\mathit{cn}}$ approximation coefficients ${a}_{ij}$ are stored in ${\mathbf{d}}\left[\left(\mathit{j}-1\right)×{\mathbf{pdd}}+i-1\right]$, for $\mathit{i}=1,2,\dots ,{n}_{\mathit{cm}}$ and $\mathit{j}=1,2,\dots ,{n}_{\mathit{cn}}$.
Otherwise the ${n}_{\mathit{cm}}×{n}_{\mathit{cn}}$ level ilev detail coefficients (of type specified by cindex) ${d}_{ij}$ are stored in ${\mathbf{d}}\left[\left(\mathit{j}-1\right)×{\mathbf{pdd}}+i-1\right]$, for $\mathit{i}=1,2,\dots ,{n}_{\mathit{cm}}$ and $\mathit{j}=1,2,\dots ,{n}_{\mathit{cn}}$.
6: $\mathbf{pdd}$Integer Input
On entry: the stride separating row elements in the two-dimensional data stored in the array d.
Constraint: ${\mathbf{pdd}}\ge {n}_{\mathrm{cm}}$.
7: $\mathbf{icomm}\left[180\right]$Integer Communication Array
On entry: contains details of the discrete wavelet transform and the problem dimension as setup in the call to the initialization function c09abc.
8: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INITIALIZATION
Either the initialization function has not been called first or icomm has been corrupted.
Either the initialization function was called with ${\mathbf{wtrans}}=\mathrm{Nag_SingleLevel}$ or icomm has been corrupted.
NE_INT
On entry, ${\mathbf{cindex}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{cindex}}\le 3$.
On entry, ${\mathbf{cindex}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{cindex}}\ge 0$.
On entry, ${\mathbf{ilev}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ilev}}\ge 1$.
NE_INT_2
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 c09ecc.
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 a previous call to c09ecc.
On entry, ${\mathbf{pdd}}=⟨\mathit{\text{value}}⟩$ and ${n}_{\mathrm{cm}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdd}}\ge {n}_{\mathrm{cm}}$, where ${n}_{\mathrm{cm}}$ is the number of DWT coefficients in the first dimension at the selected level ilev.
NE_INT_3
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 c09ecc.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

Not applicable.