c09cc computes the one-dimensional multi-level discrete wavelet transform (DWT). The initialization method C09 Communication class constructor must be called first to set up the DWT options.

Syntax

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

Parameters

n
Type: System..::..Int32
On entry: the number of elements, n, in the data array x.
Constraint: this must be the same as the value n passed to the initialization method c09aa.
x
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: x contains the one-dimensional input dataset xi, for i=1,2,,n.
c
Type: array<System..::..Double>[]()[][]
An array of size [lenc]
On exit: let qi denote the number of coefficients (of each type) produced by the wavelet transform at level i, for i=nfwd,nfwd-1,,1. These values are returned in dwtlev. Setting k1=qnfwd and kj+1=kj+qnfwd-j+1, for j=1,2,,nfwd, the coefficients are stored as follows:
c[i-1], for i=1,2,,k1
Contains the level nfwd approximation coefficients, anfwd.
c[i-1], for i=k1+1,,k2 
Contains the level nfwd detail coefficients dnfwd.
c[i-1], for i=kj+1,,kj+1
Contains the level nfwd-j+1 detail coefficients, for j=2,3,,nfwd.
dwtlev
Type: array<System..::..Int32>[]()[][]
An array of size [nwl+1]
On exit: the number of transform coefficients at each level. dwtlev[0] and dwtlev[1] contain the number, qnfwd, of approximation and detail coefficients respectively, for the final level of resolution (these are equal); dwtlev[i-1] contains the number of detail coefficients, qnfwd-i+2, for the (nfwd-i+2)th level, for i=3,4,,nfwd+1.
communications
Type: NagLibrary..::..C09..::..C09Communications
An Object of type C09.c09ccCommunications.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

c09cc computes the multi-level DWT of one-dimensional data. For a given wavelet and end extension method, c09cc will compute a multi-level transform of a data array, xi, for i=1,2,,n, using a specified number, nfwd, of levels. The number of levels specified, nfwd, must be no more than the value lmax returned in nwlmax by the initialization method C09 Communication class constructor for the given problem. The transform is returned as a set of coefficients for the different levels (packed into a single array) and a representation of the multi-level structure.
The notation used here assigns level 0 to the input dataset, x, with level 1 being the first set of coefficients computed, with the detail coefficients, d1, being stored while the approximation coefficients, a1, are used as the input to a repeat of the wavelet transform. This process is continued until, at level nfwd, both the detail coefficients, dnfwd, and the approximation coefficients, anfwd are retained. The output array, C, stores these sets of coefficients in reverse order, starting with anfwd followed by dnfwd,dnfwd-1,,d1.

References

None.

Error Indicators and Warnings

Errors or warnings detected by the method:
ifail=1
On entry, n is inconsistent with the value passed to the initialization method: n=value, n should be value.
ifail=3
On entry, lenc is set too small: lenc=value.
Constraint: lencvalue.
ifail=5
On entry, nwl=value.
Constraint: nwl1.
On entry, nwl is larger than the maximum number of levels returned by the initialization method: nwl=value, maximum =value.
ifail=7
Either the initialization method has not been called first or array icomm has been corrupted.
Either the initialization method was called with wtrans="S" or array icomm has been corrupted.
ifail=-999
Dynamic memory allocation failed.
ifail=-9000
An error occured, see message report.
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters 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.

Parallelism and Performance

None.

Further Comments

The wavelet coefficients at each level can be extracted from the output array c using the information contained in dwtlev on exit (see the descriptions of c and dwtlev in [Parameters]). For example, given an input data set, x, denoising can be carried out by applying a thresholding operation to the detail coefficients at every level. The elements c[i-1], for i=k1+1,,knfwd+1, as described in [Parameters], contain the detail coefficients, d^ij, for i=nfwd,nfwd-1,,1 and j=1,2,,qi, where d^ij=dij+σεij and σεij is the transformed noise term. If some threshold parameter α is chosen, a simple hard thresholding rule can be applied as
d-ij=0,if ​d^ijαd^ij,if ​d^ij>α,
taking d-ij to be an approximation to the required detail coefficient without noise, dij. The resulting coefficients can then be used as input to c09cd in order to reconstruct the denoised signal.
See the references given in the introduction to this chapter for a more complete account of wavelet denoising and other applications.

Example

See Also