nag_dwt_2d (c09eac) computes the two-dimensional discrete wavelet transform (DWT) at a single level. The initialization function 
nag_wfilt_2d (c09abc) must be called first to set up the DWT options.
 
nag_dwt_2d (c09eac) computes the two-dimensional DWT of a given input data array, considered as a matrix 
, 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 and then to the result over rows. The matrix of approximation (or smooth) coefficients, 
, is produced by the low pass filter over columns and rows; the matrix of horizontal coefficients, 
, is produced by the high pass filter over columns and the low pass filter over rows; the matrix of vertical coefficients, 
, is produced by the low pass filter over columns and the high pass filter over rows; and the matrix of diagonal coefficients, 
, 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, 
, of coefficients computed for 
, 
, 
, and 
 together and the number of columns of each coefficients matrix, 
, are returned by the initialization function 
nag_wfilt_2d (c09abc). These values can be used to calculate the number of rows of each coefficients matrix, 
, using the formula 
.
 
- 1:
  
      – IntegerInput
- 
On entry: number of rows, , of data matrix . Constraint:
  
this must be the same as the value  m passed to the initialization function  nag_wfilt_2d (c09abc). 
 
- 2:
  
      – IntegerInput
- 
On entry: number of columns, , of data matrix . Constraint:
  
this must be the same as the value  n passed to the initialization function  nag_wfilt_2d (c09abc). 
 
- 3:
  
      – const doubleInput
- 
Note: the th element of the matrix  is stored in . On entry: the  by  data matrix . 
- 4:
  
      – IntegerInput
- 
On entry: the stride separating matrix row elements in  the array  a. 
 Constraint:
  .
 
- 5:
  
      – doubleOutput
- 
Note: the dimension,  dim, of the array  ca
must be at least
  where   is the argument  nwcn returned by function  nag_wfilt_2d (c09abc). 
 The th element of the matrix  is stored in . On exit: contains the  by  matrix of approximation coefficients, . 
- 6:
  
      – IntegerInput
- 
On entry: the stride separating matrix row elements in  the array  ca. 
 Constraint:
    where   and  ,   are returned by the initialization function  nag_wfilt_2d (c09abc). 
 
- 7:
  
      – doubleOutput
- 
Note: the dimension,  dim, of the array  ch
must be at least
  where   is the argument  nwcn returned by function  nag_wfilt_2d (c09abc). 
 The th element of the matrix  is stored in . On exit: contains the  by  matrix of horizontal coefficients, . 
- 8:
  
      – IntegerInput
- 
On entry: the stride separating matrix row elements in  the array  ch. 
 Constraint:
    where   and  ,   are returned by the initialization function  nag_wfilt_2d (c09abc). 
 
- 9:
  
      – doubleOutput
- 
Note: the dimension,  dim, of the array  cv
must be at least
  where   is the argument  nwcn returned by function  nag_wfilt_2d (c09abc). 
 The th element of the matrix  is stored in . On exit: contains the  by  matrix of vertical coefficients, . 
- 10:
  
    – IntegerInput
- 
On entry: the stride separating matrix row elements in  the array  cv. 
 Constraint:
    where   and  ,   are returned by the initialization function  nag_wfilt_2d (c09abc). 
 
- 11:
  
    – doubleOutput
- 
Note: the dimension,  dim, of the array  cd
must be at least
  where   is the argument  nwcn returned by function  nag_wfilt_2d (c09abc). 
 The th element of the matrix  is stored in . On exit: contains the  by  matrix of diagonal coefficients, . 
- 12:
  
    – IntegerInput
- 
On entry: the stride separating matrix row elements in  the array  cd. 
 Constraint:
    where   and  ,   are returned by the initialization function  nag_wfilt_2d (c09abc). 
 
- 13:
  
    – IntegerCommunication Array
- 
On entry: contains details of the discrete wavelet transform and the problem dimension as setup in the call to the initialization function  nag_wfilt_2d (c09abc). 
 
- 14:
  
    – NagError *Input/Output
- 
The NAG error argument (see  Section 3.7 in How to Use the NAG Library and its Documentation). 
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.
Please consult the 
x06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the 
Users' Note for your implementation for any additional implementation-specific information.
None.