NAG Library Routine Document
C09FAF
Note: before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.
1 Purpose
C09FAF computes the three-dimensional discrete wavelet transform (DWT) at a single level. The initialization routine
C09ACF must be called first to set up the DWT options.
2 Specification
INTEGER
M, N, FR, LDA, SDA, LENC, ICOMM(260), IFAIL
REAL (KIND=nag_wp)
A(LDA,SDA,FR), C(LENC)
3 Description
C09FAF computes the three-dimensional DWT of a given input three-dimensional data array, considered as a number of two-dimensional frames, at a single level. For a chosen wavelet filter pair, the output coefficients are obtained by applying convolution and downsampling by two to the input,
, first over columns, next over rows and finally across frames. The three-dimensional approximation coefficients are produced by the low pass filter over columns, rows and frames. In addition there are 7 sets of three-dimensional detail coefficients, each corresponding to a different order of low pass and high pass filters (see the
C09 Chapter Introduction). All coefficients are packed into a single array. To reduce distortion effects at the ends of the data array, several end extension methods are commonly used. Those provided are: periodic or circular convolution end extension, half-point symmetric end extension, whole-point symmetric end extension and zero end extension. The total number,
, of coefficients computed is returned by the initialization routine
C09ACF.
4 References
Daubechies I (1992) Ten Lectures on Wavelets SIAM, Philadelphia
5 Parameters
- 1: M – INTEGERInput
On entry: the first dimension of the input data: the number of rows of each two-dimensional frame.
Constraint:
this must be the same as the value
M passed to the initialization routine
C09ACF.
- 2: N – INTEGERInput
On entry: the second dimension of the input data: the number of columns of each two-dimensional frame.
Constraint:
this must be the same as the value
N passed to the initialization routine
C09ACF.
- 3: FR – INTEGERInput
On entry: the third dimension of the input data: the number of two-dimensional frames.
Constraint:
this must be the same as the value
FR passed to the initialization routine
C09ACF.
- 4: A(LDA,SDA,FR) – REAL (KIND=nag_wp) arrayInput
-
On entry: the by by input three-dimensional array .
- 5: LDA – INTEGERInput
On entry: the first dimension of the array
A as declared in the (sub)program from which C09FAF is called.
Constraint:
.
- 6: SDA – INTEGERInput
On entry: the second dimension of the array
A as declared in the (sub)program from which C09FAF is called.
Constraint:
.
- 7: LENC – INTEGERInput
On entry: the dimension of the array
C as declared in the (sub)program from which C09FAF is called.
Constraint:
, where
is the total number of wavelet coefficients, as returned by
C09ACF.
- 8: C(LENC) – REAL (KIND=nag_wp) arrayOutput
-
On exit: the coefficients of the discrete wavelet transform. The
sets of coefficients are stored in the following order: approximation coefficients (LLL) first, followed by
sets of detail coefficients: LLH, LHL, LHH, HLL, HLH, HHL, HHH, where L indicates the low pass filter, and H the high pass filter being applied to, respectively, the columns of length
M, the rows of length
N and then the frames of length
FR. Note that for computational efficiency reasons each set of coefficients is stored in the order
(see output parameters
NWCFR,
NWCT and
NWCN in
C09ACF). See
Section 9 for details of how to access each set of coefficients in order to perform extraction from
C following a call to this routine, or insertion into
C before a call to the three-dimensional inverse routine
C09FBF.
- 9: ICOMM() – 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.
On exit: contains additional information on the computed transform.
- 10: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
-
On entry,
.
Constraint:
, the value of
FR on initialization (see
C09ACF).
On entry,
.
Constraint:
, the value of
M on initialization (see
C09ACF).
On entry,
.
Constraint:
, the value of
N on initialization (see
C09ACF).
-
On entry, and .
Constraint: .
On entry, and .
Constraint: .
-
On entry,
and
.
Constraint:
, where
is the number of DWT coefficients returned by
C09ACF in parameter
NWCT.
-
Either the initialization routine
C09ACF has not been called first or the communication array
ICOMM has been corrupted.
The initialization routine was called with .
-
Dynamic memory allocation failed.
7 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.
9 Example
This example computes the three-dimensional discrete wavelet decomposition for
input data using the Haar wavelet,
, with half point end extension, prints the wavelet coefficients and then reconstructs the original data using
C09FBF. This example also demonstrates in general how to access any set of coefficients following a single level transform.
9.1 Program Text
Program Text (c09fafe.f90)
9.2 Program Data
Program Data (c09fafe.d)
9.3 Program Results
Program Results (c09fafe.r)