# NAG CL Interfacec09ebc (dim2_​sngl_​inv)

## 1Purpose

c09ebc computes the inverse two-dimensional discrete wavelet transform (DWT) at a single level. The initialization function c09abc must be called first to set up the DWT options.

## 2Specification

 #include
 void c09ebc (Integer m, Integer n, const double ca[], Integer ldca, const double ch[], Integer ldch, const double cv[], Integer ldcv, const double cd[], Integer ldcd, double b[], Integer ldb, const Integer icomm[], NagError *fail)
The function may be called by the names: c09ebc, nag_wav_dim2_sngl_inv or nag_idwt_2d.

## 3Description

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

None.

## 5Arguments

1: $\mathbf{m}$Integer Input
On entry: number of rows, $m$, of data matrix $B$.
Constraint: this must be the same as the value m passed to the initialization function c09abc.
2: $\mathbf{n}$Integer Input
On entry: number of columns, $n$, of data matrix $B$.
Constraint: this must be the same as the value n passed to the initialization function c09abc.
3: $\mathbf{ca}\left[\mathit{dim}\right]$const double Input
Note: the dimension, dim, of the array ca must be at least ${\mathbf{ldca}}×{n}_{\mathrm{cn}}$ where ${n}_{\mathrm{cn}}$ is the argument nwcn returned by function c09abc.
The $\left(i,j\right)$th element of the matrix is stored in ${\mathbf{ca}}\left[\left(j-1\right)×{\mathbf{ldca}}+i-1\right]$.
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 function c09eac.
4: $\mathbf{ldca}$Integer Input
On entry: the stride separating matrix row elements in the array ca.
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 function c09abc.
5: $\mathbf{ch}\left[\mathit{dim}\right]$const double Input
Note: the dimension, dim, of the array ch must be at least ${\mathbf{ldch}}×{n}_{\mathrm{cn}}$ where ${n}_{\mathrm{cn}}$ is the argument nwcn returned by function c09abc.
The $\left(i,j\right)$th element of the matrix is stored in ${\mathbf{ch}}\left[\left(j-1\right)×{\mathbf{ldch}}+i-1\right]$.
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 function c09eac.
6: $\mathbf{ldch}$Integer Input
On entry: the stride separating matrix row elements in the array ch.
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 function c09abc.
7: $\mathbf{cv}\left[\mathit{dim}\right]$const double Input
Note: the dimension, dim, of the array cv must be at least ${\mathbf{ldcv}}×{n}_{\mathrm{cn}}$ where ${n}_{\mathrm{cn}}$ is the argument nwcn returned by function c09abc.
The $\left(i,j\right)$th element of the matrix is stored in ${\mathbf{cv}}\left[\left(j-1\right)×{\mathbf{ldcv}}+i-1\right]$.
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 function c09eac.
8: $\mathbf{ldcv}$Integer Input
On entry: the stride separating matrix row elements in the array cv.
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 function c09abc.
9: $\mathbf{cd}\left[\mathit{dim}\right]$const double Input
Note: the dimension, dim, of the array cd must be at least ${\mathbf{ldcd}}×{n}_{\mathrm{cn}}$ where ${n}_{\mathrm{cn}}$ is the argument nwcn returned by function c09abc.
The $\left(i,j\right)$th element of the matrix is stored in ${\mathbf{cd}}\left[\left(j-1\right)×{\mathbf{ldcd}}+i-1\right]$.
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 function c09eac.
10: $\mathbf{ldcd}$Integer Input
On entry: the stride separating matrix row elements in the array cd.
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 function c09abc.
11: $\mathbf{b}\left[{\mathbf{ldb}}×{\mathbf{n}}\right]$double Output
Note: the $\left(i,j\right)$th element of the matrix $B$ is stored in ${\mathbf{b}}\left[\left(j-1\right)×{\mathbf{ldb}}+i-1\right]$.
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 function c09abc.
12: $\mathbf{ldb}$Integer Input
On entry: the stride separating matrix row elements in the array b.
Constraint: ${\mathbf{ldb}}\ge {\mathbf{m}}$.
13: $\mathbf{icomm}\left[180\right]$const Integer Communication Array
On entry: contains details of the discrete wavelet transform and the problem dimension as setup in the call to the initialization function c09abc.
14: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INITIALIZATION
Either the initialization function has not been called first or icomm has been corrupted.
Either the initialization function was called with ${\mathbf{wtrans}}=\mathrm{Nag_MultiLevel}$ or icomm has been corrupted.
NE_INT
On entry, ${\mathbf{ldca}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldca}}\ge 〈\mathit{\text{value}}〉$, the number of wavelet coefficients in the first dimension.
On entry, ${\mathbf{ldcd}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldcd}}\ge 〈\mathit{\text{value}}〉$, the number of wavelet coefficients in the first dimension.
On entry, ${\mathbf{ldch}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldch}}\ge 〈\mathit{\text{value}}〉$, the number of wavelet coefficients in the first dimension.
On entry, ${\mathbf{ldcv}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldcv}}\ge 〈\mathit{\text{value}}〉$, the number of wavelet coefficients in the first dimension.
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{m}}=〈\mathit{\text{value}}〉$, the value of m on initialization (see c09abc).
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}=〈\mathit{\text{value}}〉$, the value of n on initialization (see c09abc).
NE_INT_2
On entry, ${\mathbf{ldb}}=〈\mathit{\text{value}}〉$ and ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldb}}\ge {\mathbf{m}}$.
NE_INTERNAL_ERROR
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 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

## 7Accuracy

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.

## 8Parallelism and Performance

c09ebc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
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.