# NAG CL Interfacec09ddc (dim1_​mxolap_​multi_​inv)

Settings help

CL Name Style:

## 1Purpose

c09ddc computes the inverse one-dimensional multi-level maximal overlap discrete wavelet transform (MODWT). This function reconstructs data from (possibly filtered or otherwise manipulated) wavelet transform coefficients calculated by c09dcc from an original set of data. The initialization function c09aac must be called first to set up the MODWT options.

## 2Specification

 #include
 void c09ddc (Integer nwlinv, Nag_WaveletCoefficients keepa, Integer lenc, const double c[], Integer n, double y[], const Integer icomm[], NagError *fail)
The function may be called by the names: c09ddc, nag_wav_dim1_mxolap_multi_inv or nag_imlmodwt.

## 3Description

c09ddc performs the inverse operation of c09dcc. That is, given a set of wavelet coefficients computed by c09dcc using a MODWT as set up by the initialization function c09aac on a real array of length $n$, c09ddc will reconstruct the data array ${y}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,n$, from which the coefficients were derived.

## 4References

Percival D B and Walden A T (2000) Wavelet Methods for Time Series Analysis Cambridge University Press

## 5Arguments

1: $\mathbf{nwlinv}$Integer Input
On entry: the number of levels to be used in the inverse multi-level transform. The number of levels must be less than or equal to ${n}_{\mathrm{fwd}}$, which has the value of argument nwl as used in the computation of the wavelet coefficients using c09dcc. The data will be reconstructed to level $\left({\mathbf{nwl}}-{\mathbf{nwlinv}}\right)$, where level $0$ is the original input dataset provided to c09dcc.
Constraint: $1\le {\mathbf{nwlinv}}\le {n}_{\mathrm{fwd}}$, where ${n}_{\mathrm{fwd}}$ is the value used in a preceding call to c09dcc.
2: $\mathbf{keepa}$Nag_WaveletCoefficients Input
On entry: determines whether the approximation coefficients are stored in array c for every level of the computed transform or else only for the final level. In both cases, the detail coefficients are stored in c for every level computed.
${\mathbf{keepa}}=\mathrm{Nag_StoreAll}$
Retain approximation coefficients for all levels computed.
${\mathbf{keepa}}=\mathrm{Nag_StoreFinal}$
Retain approximation coefficients for only the final level computed.
Constraint: ${\mathbf{keepa}}=\mathrm{Nag_StoreAll}$ or $\mathrm{Nag_StoreFinal}$.
3: $\mathbf{lenc}$Integer Input
On entry: the dimension of the array c.
Constraints:
• if ${\mathbf{keepa}}=\mathrm{Nag_StoreFinal}$, ${\mathbf{lenc}}\ge \left({n}_{l}+1\right)×{n}_{a}$;
• if ${\mathbf{keepa}}=\mathrm{Nag_StoreAll}$, ${\mathbf{lenc}}\ge 2×{n}_{l}×{n}_{a}$, where ${n}_{a}$ is the number of approximation or detail coefficients at each level and is unchanged from the preceding call to c09dcc.
4: $\mathbf{c}\left[{\mathbf{lenc}}\right]$const double Input
On entry: the coefficients of a multi-level wavelet transform of the dataset.
The coefficients are stored in c as follows:
If ${\mathbf{keepa}}=\mathrm{Nag_StoreFinal}$,
${\mathbf{C}}\left(1:{n}_{a}\right)$
Contains the level ${n}_{l}$ approximation coefficients;
${\mathbf{C}}\left({n}_{a}+\left(i-1\right)×{n}_{d}+1:{n}_{a}+i×{n}_{d}\right)$
Contains the level $\left({n}_{l}-\mathit{i}+1\right)$ detail coefficients, for $\mathit{i}=1,2,\dots ,{n}_{l}$;
If ${\mathbf{keepa}}=\mathrm{Nag_StoreAll}$,
${\mathbf{C}}\left(\left(i-1\right)×{n}_{a}+1:i×{n}_{a}\right)$
Contains the level $\left({n}_{l}-\mathit{i}+1\right)$ approximation coefficients, for $\mathit{i}=1,2,\dots ,{n}_{l}$;
${\mathbf{C}}\left({n}_{l}×{n}_{a}+\left(i-1\right)×{n}_{d}+1:{n}_{l}×{n}_{a}+i×{n}_{d}\right)$
Contains the level $\mathit{i}$ detail coefficients, for $\mathit{i}=1,2,\dots ,{n}_{l}$.
The values ${n}_{a}$ and ${n}_{d}$ denote the numbers of approximation and detail coefficients respectively, which are equal. This number is returned as output in na from a preceding call to c09dcc. See c09dcc for details.
5: $\mathbf{n}$Integer Input
On entry: $n$, the length of the data array, $y$, to be reconstructed.
Constraint: This must be the same as the value n passed to the initialization function c09aac.
6: $\mathbf{y}\left[{\mathbf{n}}\right]$double Output
On exit: the dataset reconstructed from the multi-level wavelet transform coefficients and the transformation options supplied to the initialization function c09aac.
7: $\mathbf{icomm}\left[100\right]$const Integer Communication Array
On entry: contains details of the discrete wavelet transform and the problem dimension for the forward transform previously computed by c09dcc.
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.
NE_ARRAY_DIM_LEN
On entry, lenc is set too small: ${\mathbf{lenc}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{lenc}}\ge ⟨\mathit{\text{value}}⟩$.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INITIALIZATION
On entry, n is inconsistent with the value passed to the initialization function: ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$, n should be $⟨\mathit{\text{value}}⟩$.
On entry, the initialization function c09aac has not been called first or it has not been called with ${\mathbf{wtrans}}=\mathrm{Nag_MODWTMulti}$, or the communication array icomm has become corrupted.
NE_INT
On entry, ${\mathbf{nwlinv}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nwlinv}}\ge 1$.
NE_INT_2
On entry, nwlinv is larger than the number of levels computed by the preceding call to c09dcc: ${\mathbf{nwlinv}}=⟨\mathit{\text{value}}⟩$, expected $⟨\mathit{\text{value}}⟩$.
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.

## 7Accuracy

The accuracy of the wavelet transform depends only on the floating-point operations used in the convolution and downsampling and should thus be close to machine precision.