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

NAG Library Routine Document

C09EAF

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

C09EAF computes the two-dimensional discrete wavelet transform (DWT) at a single level. The initialization routine C09ABF must be called first to set up the DWT options.

2  Specification

SUBROUTINE C09EAF ( M, N, A, LDA, CA, LDCA, CH, LDCH, CV, LDCV, CD, LDCD, ICOMM, IFAIL)
INTEGER  M, N, LDA, LDCA, LDCH, LDCV, LDCD, ICOMM(180), IFAIL
REAL (KIND=nag_wp)  A(LDA,N), CA(LDCA,*), CH(LDCH,*), CV(LDCV,*), CD(LDCD,*)

3  Description

C09EAF computes the two-dimensional DWT of a given input data array, considered as a matrix A, 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, A, first over columns and then to the result over rows. The matrix of approximation (or smooth) coefficients, Ca, is produced by the low pass filter over columns and rows; the matrix of horizontal coefficients, Ch, is produced by the high pass filter over columns and the low pass filter over rows; the matrix of vertical coefficients, Cv, is produced by the low pass filter over columns and the high pass filter over rows; and the matrix of diagonal coefficients, Cd, is produced by the high pass filter over columns and rows. 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, nct, of coefficients computed for Ca, Ch, Cv, and Cd together and the number of columns of each coefficients matrix, ncn, are returned by the initialization routine C09ABF. These values can be used to calculate the number of rows of each coefficients matrix, ncm, using the formula ncm=nct/4ncn.

4  References

Daubechies I (1992) Ten Lectures on Wavelets SIAM, Philadelphia

5  Parameters

1:     M – INTEGERInput
On entry: number of rows, m, of data matrix A.
Constraint: this must be the same as the value M passed to the initialization routine C09ABF.
2:     N – INTEGERInput
On entry: number of columns, n, of data matrix A.
Constraint: this must be the same as the value N passed to the initialization routine C09ABF.
3:     A(LDA,N) – REAL (KIND=nag_wp) arrayInput
On entry: the m by n data matrix A.
4:     LDA – INTEGERInput
On entry: the first dimension of the array A as declared in the (sub)program from which C09EAF is called.
Constraint: LDAM.
5:     CA(LDCA,*) – REAL (KIND=nag_wp) arrayOutput
Note: the second dimension of the array CA must be at least ncn where ncn is the parameter NWCN returned by routine C09ABF.
On exit: contains the ncm by ncn matrix of approximation coefficients, Ca.
6:     LDCA – INTEGERInput
On entry: the first dimension of the array CA as declared in the (sub)program from which C09EAF is called.
Constraint: LDCAncm where ncm=nct/4ncn and ncn, nct are returned by the initialization routine C09ABF.
7:     CH(LDCH,*) – REAL (KIND=nag_wp) arrayOutput
Note: the second dimension of the array CH must be at least ncn where ncn is the parameter NWCN returned by routine C09ABF.
On exit: contains the ncm by ncn matrix of horizontal coefficients, Ch.
8:     LDCH – INTEGERInput
On entry: the first dimension of the array CH as declared in the (sub)program from which C09EAF is called.
Constraint: LDCHncm where ncm=nct/4ncn and ncn, nct are returned by the initialization routine C09ABF.
9:     CV(LDCV,*) – REAL (KIND=nag_wp) arrayOutput
Note: the second dimension of the array CV must be at least ncn where ncn is the parameter NWCN returned by routine C09ABF.
On exit: contains the ncm by ncn matrix of vertical coefficients, Cv.
10:   LDCV – INTEGERInput
On entry: the first dimension of the array CV as declared in the (sub)program from which C09EAF is called.
Constraint: LDCVncm where ncm=nct/4ncn and ncn, nct are returned by the initialization routine C09ABF.
11:   CD(LDCD,*) – REAL (KIND=nag_wp) arrayOutput
Note: the second dimension of the array CD must be at least ncn where ncn is the parameter NWCN returned by routine C09ABF.
On exit: contains the ncm by ncn matrix of diagonal coefficients, Cd.
12:   LDCD – INTEGERInput
On entry: the first dimension of the array CD as declared in the (sub)program from which C09EAF is called.
Constraint: LDCDncm where ncm=nct/4ncn and ncn, nct are returned by the initialization routine C09ABF.
13:   ICOMM(180) – 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 C09ABF.
14:   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,M is inconsistent with the value passed to the initialization routine C09ABF,
orN is inconsistent with the value passed to the initialization routine C09ABF.
IFAIL=2
On entry,LDA<M.
IFAIL=3
On entry,LDCA<ncm where ncm=nct/4ncn and nct, ncn are returned by the initialization routine C09ABF,
orLDCH<ncm,
orLDCV<ncm,
orLDCD<ncm.
IFAIL=6
On entry, the initialization routine C09ACF has not been called first or it has been called with WTRANS='M', or the communication array ICOMM has become corrupted.

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.

8  Further Comments

None.

9  Example

This example computes the two-dimensional discrete wavelet decomposition for a 6×6 input matrix using the Daubechies wavelet, WAVNAM='DB4', with half point symmetric end extension.

9.1  Program Text

Program Text (c09eafe.f90)

9.2  Program Data

Program Data (c09eafe.d)

9.3  Program Results

Program Results (c09eafe.r)


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

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