﻿ c09cd Method
c09cd computes the inverse one-dimensional multi-level discrete wavelet transform (DWT). This method reconstructs data from (possibly filtered or otherwise manipulated) wavelet transform coefficients calculated by c09cc from an original set of data. The initialization method C09 Communication class constructor must be called first to set up the DWT options.

# Syntax

C#
```public static void c09cd(
int nwlinv,
double[] c,
int n,
double[] y,
C09..::..C09Communications communications,
out int ifail
)```
Visual Basic
```Public Shared Sub c09cd ( _
nwlinv As Integer, _
c As Double(), _
n As Integer, _
y As Double(), _
communications As C09..::..C09Communications, _
<OutAttribute> ByRef ifail As Integer _
)```
Visual C++
```public:
static void c09cd(
int nwlinv,
array<double>^ c,
int n,
array<double>^ y,
C09..::..C09Communications^ communications,
[OutAttribute] int% ifail
)```
F#
```static member c09cd :
nwlinv : int *
c : float[] *
n : int *
y : float[] *
communications : C09..::..C09Communications *
ifail : int byref -> unit
```

#### Parameters

nwlinv
Type: System..::..Int32
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 parameter nwl as used in the computation of the wavelet coefficients using c09cc. The data will be reconstructed to level $\left({\mathbf{nwl}}-{\mathbf{nwlinv}}\right)$, where level $0$ is the original input dataset provided to c09cc.
Constraint: $1\le {\mathbf{nwlinv}}\le {\mathbf{nwl}}$, where nwl is the value used in a preceding call to c09cc.
c
Type: array<System..::..Double>[]()[][]
An array of size [lenc]
On entry: the coefficients of a multi-level wavelet transform of the dataset.
Let $q\left(\mathit{i}\right)$ be the number of coefficients (of each type) at level $\mathit{i}$, for $\mathit{i}={n}_{\mathrm{fwd}},{n}_{\mathrm{fwd}}-1,\dots ,1$. Then, setting ${k}_{1}=q\left({n}_{\mathrm{fwd}}\right)$ and ${k}_{\mathit{j}+1}={k}_{\mathit{j}}+q\left({n}_{\mathrm{fwd}}-\mathit{j}+1\right)$, for $\mathit{j}=1,2,\dots ,{n}_{\mathrm{fwd}}$, the coefficients are stored in c as follows:
${\mathbf{c}}\left[\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,{k}_{1}$
Contains the level ${n}_{\mathrm{fwd}}$ approximation coefficients, ${a}_{{n}_{\mathrm{fwd}}}$.
${\mathbf{c}}\left[\mathit{i}-1\right]$, for $\mathit{i}={k}_{1}+1,\dots ,{k}_{2}$
Contains the level ${n}_{\mathrm{fwd}}$ detail coefficients ${d}_{{n}_{\mathrm{fwd}}}$.
${\mathbf{c}}\left[\mathit{i}-1\right]$, for $\mathit{i}={k}_{j}+1,\dots ,{k}_{j+1}$
Contains the level ${n}_{\mathrm{fwd}}-\mathit{j}+1$ detail coefficients, for $\mathit{j}=2,3,\dots ,{n}_{\mathrm{fwd}}$.
The values $q\left(\mathit{i}\right)$, for $\mathit{i}={n}_{\mathrm{fwd}},{n}_{\mathrm{fwd}}-1,\dots ,1$, are contained in dwtlev which is produced as output by a preceding call to c09cc. See c09cc for details.
n
Type: System..::..Int32
On entry: $n$, the length of the data array, $y$, to be reconstructed. For a full reconstruction of nwl levels, where nwl is as supplied to c09cc, this must be the same as parameter n used in the call to c09cc. For a partial reconstruction of ${\mathbf{nwlinv}}<{\mathbf{nwl}}$, this must be equal to ${\mathbf{dwtlev}}\left[{\mathbf{nwlinv}}+1\right]$, as returned from c09cc.
y
Type: array<System..::..Double>[]()[][]
An array of size [n]
On exit: the dataset reconstructed from the multi-level wavelet transform coefficients and the transformation options supplied to the initialization method c09aa.
communications
Type: NagLibrary..::..C09..::..C09Communications
An Object of type C09.c09cdCommunications.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# Description

c09cd performs the inverse operation of c09cc. That is, given a set of wavelet coefficients, computed up to level ${n}_{\mathrm{fwd}}$ by c09cc using a DWT as set up by the initialization method C09 Communication class constructor, on a real data array of length $n$, c09cd will reconstruct the data array ${y}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,n$, from which the coefficients were derived. If the original input dataset is level $0$, then it is possible to terminate reconstruction at a higher level by specifying fewer than the number of levels used in the call to c09cc. This results in a partial reconstruction.

None.

# Error Indicators and Warnings

Errors or warnings detected by the method:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{nwlinv}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{nwlinv}}\ge 1$.
On entry, nwlinv is larger than the number of levels computed by the preceding call to c09cc: ${\mathbf{nwlinv}}=〈\mathit{\text{value}}〉$, expected $\text{}=〈\mathit{\text{value}}〉$.
${\mathbf{ifail}}=2$
On entry, lenc is set too small: ${\mathbf{lenc}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{lenc}}\ge 〈\mathit{\text{value}}〉$.
${\mathbf{ifail}}=4$
On entry, n is inconsistent with the value passed to the initialization method: ${\mathbf{n}}=〈\mathit{\text{value}}〉$, n should be $〈\mathit{\text{value}}〉$.
${\mathbf{ifail}}=6$
Either the initialization method has not been called first or array icomm has been corrupted.
Either the initialization method was called with ${\mathbf{wtrans}}=\text{"S"}$ or array icomm has been corrupted.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
${\mathbf{ifail}}=-9000$
An error occured, see message report.
${\mathbf{ifail}}=-8000$
Negative dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$

# Accuracy

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.

None.