C09ACF (PDF version)
C09 Chapter Contents
C09 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

C09ACF

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.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

C09ACF returns the details of the chosen three-dimensional discrete wavelet filter. For a chosen mother wavelet, discrete wavelet transform type (single-level or multi-level DWT) and end extension method, this routine returns the maximum number of levels of resolution (appropriate to a multi-level transform), the filter length, the total number of coefficients and the number of wavelet coefficients in the second and third dimensions for the single-level case. This routine must be called before any of the three-dimensional transform routines in this chapter.

2  Specification

SUBROUTINE C09ACF ( WAVNAM, WTRANS, MODE, M, N, FR, NWL, NF, NWCT, NWCN, NWCFR, ICOMM, IFAIL)
INTEGER  M, N, FR, NWL, NF, NWCT, NWCN, NWCFR, ICOMM(260), IFAIL
CHARACTER(*)  WAVNAM
CHARACTER(1)  WTRANS, MODE

3  Description

Three-dimensional discrete wavelet transforms (DWT) are characterised by the mother wavelet, the end extension method and whether multiresolution analysis is to be performed. For the selected combination of choices for these three characteristics, and for given dimensions (m×n×fr) of data array A, C09ACF returns the dimension details for the transform determined by this combination. The dimension details are: lmax, the maximum number of levels of resolution that would be computed were a multi-level DWT applied; nf, the filter length; nct the total number of wavelet coefficients (over all levels in the multi-level DWT case); ncn, the number of coefficients in the second dimension for a single-level DWT; and ncfr, the number of coefficients in the third dimension for a single-level DWT. These values are also stored in the communication array ICOMM, as are the input choices, so that they may be conveniently communicated to the three-dimensional transform routines in this chapter.

4  References

None.

5  Parameters

1:     WAVNAM – CHARACTER(*)Input
On entry: the name of the mother wavelet. See the C09 Chapter Introduction for details.
WAVNAM='HAAR'
Haar wavelet.
WAVNAM='DBn', where n=2,3,,10
Daubechies wavelet with n vanishing moments (2n coefficients). For example, WAVNAM='DB4' is the name for the Daubechies wavelet with 4 vanishing moments (8 coefficients).
WAVNAM='BIORx.y', where x.y can be one of 1.1, 1.3, 1.5, 2.2, 2.4, 2.6, 2.8, 3.1, 3.3, 3.5 or 3.7
Biorthogonal wavelet of order x.y. For example WAVNAM='BIOR3.1' is the name for the biorthogonal wavelet of order 3.1.
Constraint: WAVNAM='HAAR', 'DB2', 'DB3', 'DB4', 'DB5', 'DB6', 'DB7', 'DB8', 'DB9', 'DB10', 'BIOR1.1', 'BIOR1.3', 'BIOR1.5', 'BIOR2.2', 'BIOR2.4', 'BIOR2.6', 'BIOR2.8', 'BIOR3.1', 'BIOR3.3', 'BIOR3.5' or 'BIOR3.7'.
2:     WTRANS – CHARACTER(1)Input
On entry: the type of discrete wavelet transform that is to be applied.
WTRANS='S'
Single-level decomposition or reconstruction by discrete wavelet transform.
WTRANS='M'
Multiresolution, by a multi-level DWT or its inverse.
Constraint: WTRANS='S' or 'M'.
3:     MODE – CHARACTER(1)Input
On entry: the end extension method.
MODE='P'
Periodic end extension.
MODE='H'
Half-point symmetric end extension.
MODE='W'
Whole-point symmetric end extension.
MODE='Z'
Zero end extension.
Constraint: MODE='P', 'H', 'W' or 'Z'.
4:     M – INTEGERInput
On entry: the number of elements, m, in the first dimension (number of rows of each two-dimensional frame) of the input data, A.
Constraint: M2.
5:     N – INTEGERInput
On entry: the number of elements, n, in the second dimension (number of columns of each two-dimensional frame) of the input data, A.
Constraint: N2.
6:     FR – INTEGERInput
On entry: the number of elements, fr, in the third dimension (number of frames) of the input data, A.
Constraint: FR2.
7:     NWL – INTEGEROutput
On exit: the maximum number of levels of resolution, lmax, that can be computed if a multi-level discrete wavelet transform is applied (WTRANS='M'). It is such that 2lmax minm,n,fr <2lmax+1, for lmax an integer.
If WTRANS='S', NWL is not set.
8:     NF – INTEGEROutput
On exit: the filter length, nf, for the supplied mother wavelet. This is used to determine the number of coefficients to be generated by the chosen transform.
9:     NWCT – INTEGEROutput
On exit: the total number of wavelet coefficients, nct, that will be generated. When WTRANS='S' the number of rows required (i.e., the first dimension of each two-dimensional frame) in each of the output coefficient arrays can be calculated as ncm=nct/8×ncn×ncfr. When WTRANS='M' the length of the array used to store all of the coefficient matrices must be at least nct.
10:   NWCN – INTEGEROutput
On exit: for a single-level transform (WTRANS='S'), the number of coefficients that would be generated in the second dimension, ncn, for each coefficient type. For a multi-level transform (WTRANS='M') this is set to 1.
11:   NWCFR – INTEGEROutput
On exit: for a single-level transform (WTRANS='S'), the number of coefficients that would be generated in the third dimension, ncfr, for each coefficient type. For a multi-level transform (WTRANS='M') this is set to 1.
12:   ICOMM(260) – INTEGER arrayCommunication Array
On exit: contains details of the wavelet transform and the problem dimension which is to be communicated to the two-dimensional discrete transform routines in this chapter.
13:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. 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 -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
On entry, WAVNAM had an illegal value.
IFAIL=2
On entry, WTRANS had an illegal value.
IFAIL=3
On entry, MODE had an illegal value.
IFAIL=4
On entry, FR=value.
Constraint: FR2.
On entry, M=value.
Constraint: M2.
On entry, N=value.
Constraint: N2.

7  Accuracy

Not applicable.

8  Further Comments

None.

9  Example

This example computes the three-dimensional multi-level resolution for 8×8×8 input data by a discrete wavelet transform using the Daubechies wavelet with four vanishing moments (see WAVNAM='DB4' in C09ACF) and zero end extension. The number of levels of transformation actually performed is one less than the maximum possible. This number of levels, the length of the wavelet filter, the total number of coefficients and the number of coefficients in each dimension for each level are printed along with the approximation coefficients from the first level, before a reconstruction is performed. This example also demonstrates in general how to access any set of coefficients at any level following a multi-level transform.

9.1  Program Text

Program Text (c09acfe.f90)

9.2  Program Data

Program Data (c09acfe.d)

9.3  Program Results

Program Results (c09acfe.r)


C09ACF (PDF version)
C09 Chapter Contents
C09 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012