NAG C Library Function Document

nag_wfilt (c09aac)


nag_wfilt (c09aac) returns the details of the chosen one-dimensional discrete wavelet filter. For a chosen mother wavelet, discrete wavelet transform type (single-level or multi-level DWT or MODWT) and end extension method, this function returns the maximum number of levels of resolution (appropriate to a multi-level transform), the filter length, and the number of approximation coefficients (equal to the number of detail coefficients) for a single-level DWT or MODWT or the total number of coefficients for a multi-level DWT or MODWT. This function must be called before any of the one-dimensional discrete transform functions in this chapter.


#include <nag.h>
#include <nagc09.h>
void  nag_wfilt (Nag_Wavelet wavnam, Nag_WaveletTransform wtrans, Nag_WaveletMode mode, Integer n, Integer *nwlmax, Integer *nf, Integer *nwc, Integer icomm[], NagError *fail)


One-dimensional discrete wavelet transforms (DWT) or maximum overlap wavelet transforms (MODWT) 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 a given length, n, of the input data array, x, nag_wfilt (c09aac) returns the dimension details for the transform determined by this combination. The dimension details are: lmax, the maximum number of levels of resolution that that could be computed were a multi-level DWT/MODWT applied; nf, the filter length; nc the number of approximation (or detail) coefficients for a single-level DWT/MODWT or the total number of coefficients generated by a multi-level DWT/MODWT over lmax levels. These values are also stored in the communication array icomm, as are the input choices, so that they may be conveniently communicated to the one-dimensional transform functions in this chapter.




1:     wavnam Nag_WaveletInput
On entry: the name of the mother wavelet. See the c09 Chapter Introduction for details.
Haar wavelet.
wavnam=Nag_Daubechiesn, where n=2,3,,38
Daubechies wavelet with n vanishing moments (2n coefficients). For example, wavnam=Nag_Daubechies4 is the name for the Daubechies wavelet with 4 vanishing moments (8 coefficients).
wavnam=Nag_Coifletn, where n=1,2,,17
Coiflet wavelet of order n.
Beylkin wavelet.
Vaidyanathan wavelet.
wavnam=Nag_Symletn, where n=2,3,,20
Symlet wavelet of order n.
wavnam=Nag_Biorthogonalx_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=Nag_Biorthogonal1_1 is the name for the Biorthogonal wavelet of order 1.1.
wavnam=Nag_Reverse_Biorthogonalx_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=Nag_Reverse_Biorthogonal1_1 is the name for the reverse biorthogonal wavelet of order 1.1.
Constraint: wavnam=Nag_Haar, Nag_Daubechies2, Nag_Daubechies3, Nag_Daubechies4, Nag_Daubechies5, Nag_Daubechies6, Nag_Daubechies7, Nag_Daubechies8, Nag_Daubechies9, Nag_Daubechies10, Nag_Daubechies11, Nag_Daubechies12, Nag_Daubechies13, Nag_Daubechies14, Nag_Daubechies15, Nag_Daubechies16, Nag_Daubechies17, Nag_Daubechies18, Nag_Daubechies19, Nag_Daubechies20, Nag_Daubechies21, Nag_Daubechies22, Nag_Daubechies23, Nag_Daubechies24, Nag_Daubechies25, Nag_Daubechies26, Nag_Daubechies27, Nag_Daubechies28, Nag_Daubechies29, Nag_Daubechies30, Nag_Daubechies31, Nag_Daubechies32, Nag_Daubechies33, Nag_Daubechies34, Nag_Daubechies35, Nag_Daubechies36, Nag_Daubechies37, Nag_Daubechies38, Nag_Coiflet1, Nag_Coiflet2, Nag_Coiflet3, Nag_Coiflet4, Nag_Coiflet5, Nag_Coiflet6, Nag_Coiflet7, Nag_Coiflet8, Nag_Coiflet9, Nag_Coiflet10, Nag_Coiflet11, Nag_Coiflet12, Nag_Coiflet13, Nag_Coiflet14, Nag_Coiflet15, Nag_Coiflet16, Nag_Coiflet17, Nag_Beylkin, Nag_Vaidyanathan, Nag_Symlet2, Nag_Symlet3, Nag_Symlet4, Nag_Symlet5, Nag_Symlet6, Nag_Symlet7, Nag_Symlet8, Nag_Symlet9, Nag_Symlet10, Nag_Symlet11, Nag_Symlet12, Nag_Symlet13, Nag_Symlet14, Nag_Symlet15, Nag_Symlet16, Nag_Symlet17, Nag_Symlet18, Nag_Symlet19, Nag_Symlet20, Nag_Biorthogonal1_1, Nag_Biorthogonal1_3, Nag_Biorthogonal1_5, Nag_Biorthogonal2_2, Nag_Biorthogonal2_4, Nag_Biorthogonal2_6, Nag_Biorthogonal2_8, Nag_Biorthogonal3_1, Nag_Biorthogonal3_3, Nag_Biorthogonal3_5, Nag_Biorthogonal3_7, Nag_Biorthogonal3_9, Nag_Biorthogonal4_4, Nag_Biorthogonal5_5, Nag_Biorthogonal6_8, Nag_Reverse_Biorthogonal1_1, Nag_Reverse_Biorthogonal1_3, Nag_Reverse_Biorthogonal1_5, Nag_Reverse_Biorthogonal2_2, Nag_Reverse_Biorthogonal2_4, Nag_Reverse_Biorthogonal2_6, Nag_Reverse_Biorthogonal2_8, Nag_Reverse_Biorthogonal3_1, Nag_Reverse_Biorthogonal3_3, Nag_Reverse_Biorthogonal3_5, Nag_Reverse_Biorthogonal3_7, Nag_Reverse_Biorthogonal3_9, Nag_Reverse_Biorthogonal4_4, Nag_Reverse_Biorthogonal5_5 or Nag_Reverse_Biorthogonal6_8.
2:     wtrans Nag_WaveletTransformInput
On entry: the type of discrete wavelet transform that is to be applied.
Single-level decomposition or reconstruction by discrete wavelet transform.
Multiresolution, by a multi-level DWT or its inverse.
Single-level decomposition or reconstruction by maximal overlap discrete wavelet transform.
Multi-level resolution by a maximal overlap discrete wavelet transform or its inverse.
Constraint: wtrans=Nag_SingleLevel, Nag_MultiLevel, Nag_MODWTSingle or Nag_MODWTMulti.
3:     mode Nag_WaveletModeInput
On entry: the end extension method. Note that only periodic end extension is currently available for the MODWT.
Periodic end extension.
Half-point symmetric end extension.
Whole-point symmetric end extension.
Zero end extension.
  • mode=Nag_Periodic, Nag_HalfPointSymmetric, Nag_WholePointSymmetric or Nag_ZeroPadded for DWT;
  • mode=Nag_Periodic for MODWT.
4:     n IntegerInput
On entry: the number of elements, n, in the input data array, x.
Constraint: n2.
5:     nwlmax Integer *Output
On exit: the maximum number of levels of resolution, lmax, that can be computed when a multi-level discrete wavelet transform is applied. It is such that 2lmaxn<2lmax+1, for lmax an integer.
6:     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.
7:     nwc Integer *Output
On exit: for a single-level transform (wtrans=Nag_SingleLevel or Nag_MODWTSingle), the number of approximation coefficients that would be generated for the given problem size, mother wavelet, extension method and type of transform; this is also the corresponding number of detail coefficients. For a multi-level transform (wtrans=Nag_MultiLevel or Nag_MODWTMulti) the total number of coefficients that would be generated over lmax levels and with keepa=Nag_StoreAll for MODWT.
8:     icomm[100] IntegerCommunication Array
On exit: contains details of the wavelet transform and the problem dimension which is to be communicated to the one-dimensional discrete transform functions in this chapter.
9:     fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

Error Indicators and Warnings

Dynamic memory allocation failed.
See Section in How to Use the NAG Library and its Documentation for further information.
On entry, argument value had an illegal value.
On entry, wtrans=Nag_MODWTSingle or Nag_MODWTMulti and modeNag_Periodic.
Constraint: mode=Nag_Periodic when wtrans=Nag_MODWTSingle or Nag_MODWTMulti.
On entry, n=value.
Constraint: n2.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.


Not applicable.

Parallelism and Performance

nag_wfilt (c09aac) is not threaded in any implementation.

Further Comments



This example computes the one-dimensional multi-level resolution for 8 values by a discrete wavelet transform using the Haar wavelet with zero end extensions. The length of the wavelet filter, the number of levels of resolution, the number of approximation coefficients at each level and the total number of wavelet coefficients are printed.

Program Text

Program Text (c09aace.c)

Program Data

Program Data (c09aace.d)

Program Results

Program Results (c09aace.r)