NAG FL Interface
c09abf (dim2_​init)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

c09abf returns the details of the chosen two-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 approximation, horizontal, vertical and diagonal coefficients and the number of coefficients in the second dimension for the single-level case. This routine must be called before any of the two-dimensional transform routines in this chapter.

2 Specification

Fortran Interface
Subroutine c09abf ( wavnam, wtrans, mode, m, n, nwlmax, nf, nwct, nwcn, icomm, ifail)
Integer, Intent (In) :: m, n
Integer, Intent (Inout) :: ifail
Integer, Intent (Out) :: nwlmax, nf, nwct, nwcn, icomm(180)
Character (*), Intent (In) :: wavnam
Character (1), Intent (In) :: wtrans, mode
C Header Interface
#include <nag.h>
void  c09abf_ (const char *wavnam, const char *wtrans, const char *mode, const Integer *m, const Integer *n, Integer *nwlmax, Integer *nf, Integer *nwct, Integer *nwcn, Integer icomm[], Integer *ifail, const Charlen length_wavnam, const Charlen length_wtrans, const Charlen length_mode)
The routine may be called by the names c09abf or nagf_wav_dim2_init.

3 Description

Two-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) of data matrix A, c09abf 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 approximation, horizontal, vertical and diagonal coefficients (over all levels in the multi-level DWT case); and ncn, the number of coefficients in the second 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 two-dimensional transform routines in this chapter.

4 References

None.

5 Arguments

1: wavnam Character(*) Input
On entry: the name of the mother wavelet. See the C09 Chapter Introduction for details.
wavnam='HAAR'​ or ​'DB1'
Haar wavelet, also known as 'DB1' as a special case of the Daubechies wavelet.
wavnam='DBn', where n=2,3,,38
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='COIFn', where n=1,2,,17
Coiflet wavelet of order n.
wavnam='BEYL'
Beylkin wavelet.
wavnam='VAID'
Vaidyanathan wavelet.
wavnam='SYMn', where n=2,3,,20
Symlet wavelet of order n.
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, 3.7, 3.9, 4.4, 5.5 or 6.8
Biorthogonal wavelet of order x.y. For example wavnam='BIOR3.1' is the name for the biorthogonal wavelet of order 3.1.
wavnam='RBIOx.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, 3.7, 3.9, 4.4, 5.5 or 6.8
Reverse biorthogonal wavelet of order x.y. For example wavnam='RBIO3.1' is the name for the reverse biorthogonal wavelet of order 3.1.
Constraint: wavnam='HAAR', ​'DB1', 'DB2', 'DB3', 'DB4', 'DB5', 'DB6', 'DB7', 'DB8', 'DB9', 'DB10', 'DB11', 'DB12', 'DB13', 'DB14', 'DB15', 'DB16', 'DB17', 'DB18', 'DB19', 'DB20', 'DB21', 'DB22', 'DB23', 'DB24', 'DB25', 'DB26', 'DB27', 'DB28', 'DB29', 'DB30', 'DB31', 'DB32', 'DB33', 'DB34', 'DB35', 'DB36', 'DB37', 'DB38', 'COIF1', 'COIF2', 'COIF3', 'COIF4', 'COIF5', 'COIF6', 'COIF7', 'COIF8', 'COIF9', 'COIF10', 'COIF11', 'COIF12', 'COIF13', 'COIF14', 'COIF15', 'COIF16', 'COIF17', 'BEYL', 'VAID', 'SYM2', 'SYM3', 'SYM4', 'SYM5', 'SYM6', 'SYM7', 'SYM8', 'SYM9', 'SYM10', 'SYM11', 'SYM12', 'SYM13', 'SYM14', 'SYM15', 'SYM16', 'SYM17', 'SYM18', 'SYM19', 'SYM20', 'BIOR1.1', 'BIOR1.3', 'BIOR1.5', 'BIOR2.2', 'BIOR2.4', 'BIOR2.6', 'BIOR2.8', 'BIOR3.1', 'BIOR3.3', 'BIOR3.5', 'BIOR3.7', 'BIOR3.9', 'BIOR4.4', 'BIOR5.5', 'BIOR6.8', 'RBIO1.1', 'RBIO1.3', 'RBIO1.5', 'RBIO2.2', 'RBIO2.4', 'RBIO2.6', 'RBIO2.8', 'RBIO3.1', 'RBIO3.3', 'RBIO3.5', 'RBIO3.7', 'RBIO3.9', 'RBIO4.4', 'RBIO5.5' or 'RBIO6.8'.
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 Integer Input
On entry: the number of elements, m, in the first dimension (number of rows of data matrix A) of the input data.
Constraint: m2.
5: n Integer Input
On entry: the number of elements, n, in the second dimension (number of columns of data matrix A) of the input data.
Constraint: n2.
6: nwlmax Integer Output
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 2lmaxmin(m,n)<2lmax+1, for lmax an integer.
If wtrans='S', nwlmax is not set.
7: nf Integer Output
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.
8: nwct Integer Output
On exit: the total number of wavelet coefficients, nct, that will be generated. When wtrans='S' the number of rows required in each of the output coefficient matrices can be calculated as ncm=nct/(4ncn). When wtrans='M' the length of the array used to store all of the coefficient matrices must be at least nct.
9: nwcn Integer Output
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.
10: icomm(180) Integer array Communication 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.
11: ifail Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. 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=value was an illegal value.
ifail=2
On entry, wtrans=value was an illegal value.
ifail=3
On entry, mode=value was an illegal value.
ifail=4
On entry, m=value.
Constraint: m2.
On entry, n=value.
Constraint: n2.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
c09abf is not threaded in any implementation.

9 Further Comments

None.

10 Example

This example computes the two-dimensional multi-level resolution for a 6×6 matrix by a discrete wavelet transform using the Haar wavelet with whole-point symmetric end extensions. 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 vertical detail coefficients from the first level, before a reconstruction is performed.

10.1 Program Text

Program Text (c09abfe.f90)

10.2 Program Data

Program Data (c09abfe.d)

10.3 Program Results

Program Results (c09abfe.r)