C09 Chapter Contents
C09 Chapter Introduction
NAG Library Manual

NAG Library Routine DocumentC09EBF

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.

1  Purpose

C09EBF computes the inverse 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 C09EBF ( M, N, CA, LDCA, CH, LDCH, CV, LDCV, CD, LDCD, B, LDB, ICOMM, IFAIL)
 INTEGER M, N, LDCA, LDCH, LDCV, LDCD, LDB, ICOMM(180), IFAIL REAL (KIND=nag_wp) CA(LDCA,*), CH(LDCH,*), CV(LDCV,*), CD(LDCD,*), B(LDB,N)

3  Description

C09EBF performs the inverse operation of routine C09EAF. That is, given sets of approximation, horizontal, vertical and diagonal coefficients computed by routine C09EAF using a DWT as set up by the initialization routine C09ABF, on a real matrix, $B$, C09EBF will reconstruct $B$.

None.

5  Parameters

1:     M – INTEGERInput
On entry: number of rows, $m$, of data matrix $B$.
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 $B$.
Constraint: this must be the same as the value N passed to the initialization routine C09ABF.
3:     CA(LDCA,$*$) – REAL (KIND=nag_wp) arrayInput
Note: the second dimension of the array CA must be at least ${n}_{\mathrm{cn}}$ where ${n}_{\mathrm{cn}}$ is the parameter NWCN returned by routine C09ABF.
On entry: contains the ${n}_{\mathrm{cm}}$ by ${n}_{\mathrm{cn}}$ matrix of approximation coefficients, ${C}_{a}$. This array will normally be the result of some transformation on the coefficients computed by routine C09EAF.
4:     LDCA – INTEGERInput
On entry: the first dimension of the array CA as declared in the (sub)program from which C09EBF is called.
Constraint: ${\mathbf{LDCA}}\ge {n}_{\mathrm{cm}}$ where ${n}_{\mathrm{cm}}={n}_{\mathrm{ct}}/\left(4{n}_{\mathrm{cn}}\right)$ and ${n}_{\mathrm{cn}}$, ${n}_{\mathrm{ct}}$ are returned by the initialization routine C09ABF.
5:     CH(LDCH,$*$) – REAL (KIND=nag_wp) arrayInput
Note: the second dimension of the array CH must be at least ${n}_{\mathrm{cn}}$ where ${n}_{\mathrm{cn}}$ is the parameter NWCN returned by routine C09ABF.
On entry: contains the ${n}_{\mathrm{cm}}$ by ${n}_{\mathrm{cn}}$ matrix of horizontal coefficients, ${C}_{h}$. This array will normally be the result of some transformation on the coefficients computed by routine C09EAF.
6:     LDCH – INTEGERInput
On entry: the first dimension of the array CH as declared in the (sub)program from which C09EBF is called.
Constraint: ${\mathbf{LDCH}}\ge {n}_{\mathrm{cm}}$ where ${n}_{\mathrm{cm}}={n}_{\mathrm{ct}}/\left(4{n}_{\mathrm{cn}}\right)$ and ${n}_{\mathrm{cn}}$, ${n}_{\mathrm{ct}}$ are returned by the initialization routine C09ABF.
7:     CV(LDCV,$*$) – REAL (KIND=nag_wp) arrayInput
Note: the second dimension of the array CV must be at least ${n}_{\mathrm{cn}}$ where ${n}_{\mathrm{cn}}$ is the parameter NWCN returned by routine C09ABF.
On entry: contains the ${n}_{\mathrm{cm}}$ by ${n}_{\mathrm{cn}}$ matrix of vertical coefficients, ${C}_{v}$. This array will normally be the result of some transformation on the coefficients computed by routine C09EAF.
8:     LDCV – INTEGERInput
On entry: the first dimension of the array CV as declared in the (sub)program from which C09EBF is called.
Constraint: ${\mathbf{LDCV}}\ge {n}_{\mathrm{cm}}$ where ${n}_{\mathrm{cm}}={n}_{\mathrm{ct}}/\left(4{n}_{\mathrm{cn}}\right)$ and ${n}_{\mathrm{cn}}$, ${n}_{\mathrm{ct}}$ are returned by the initialization routine C09ABF.
9:     CD(LDCD,$*$) – REAL (KIND=nag_wp) arrayInput
Note: the second dimension of the array CD must be at least ${n}_{\mathrm{cn}}$ where ${n}_{\mathrm{cn}}$ is the parameter NWCN returned by routine C09ABF.
On entry: contains the ${n}_{\mathrm{cm}}$ by ${n}_{\mathrm{cn}}$ matrix of diagonal coefficients, ${C}_{d}$. This array will normally be the result of some transformation on the coefficients computed by routine C09EAF.
10:   LDCD – INTEGERInput
On entry: the first dimension of the array CD as declared in the (sub)program from which C09EBF is called.
Constraint: ${\mathbf{LDCD}}\ge {n}_{\mathrm{cm}}$ where ${n}_{\mathrm{cm}}={n}_{\mathrm{ct}}/\left(4{n}_{\mathrm{cn}}\right)$ and ${n}_{\mathrm{cn}}$, ${n}_{\mathrm{ct}}$ are returned by the initialization routine C09ABF.
11:   B(LDB,N) – REAL (KIND=nag_wp) arrayOutput
On exit: the $m$ by $n$ reconstructed matrix, $B$, based on the input approximation, horizontal, vertical and diagonal coefficients and the transform options supplied to the initialization routine C09ABF.
12:   LDB – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which C09EBF is called.
Constraint: ${\mathbf{LDB}}\ge {\mathbf{M}}$.
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\text{​ 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\text{​ 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 $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=1$
 On entry, ${\mathbf{LDCA}}<{n}_{\mathrm{cm}}$, where ${n}_{\mathrm{cm}}={n}_{\mathrm{ct}}/\left(4{n}_{\mathrm{cn}}\right)$ and ${n}_{\mathrm{ct}}$, ${n}_{\mathrm{cn}}$ are returned by the initialization routine C09ABF, or ${\mathbf{LDCH}}<{n}_{\mathrm{cm}}$, or ${\mathbf{LDCV}}<{n}_{\mathrm{cm}}$, or ${\mathbf{LDCD}}<{n}_{\mathrm{cm}}$.
${\mathbf{IFAIL}}=2$
On entry, ${\mathbf{LDB}}<{\mathbf{M}}$.
${\mathbf{IFAIL}}=4$
 On entry, M is inconsistent with the value passed to the initialization routine C09ABF, or N is inconsistent with the value passed to the initialization routine C09ABF.
${\mathbf{IFAIL}}=6$
On entry, the initialization routine C09ACF has not been called first or it has been called with ${\mathbf{WTRANS}}=\text{'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.