# NAG FL Interfacec09aaf (dim1_​init)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

c09aaf 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 routine 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 routine must be called before any of the one-dimensional discrete transform routines in this chapter.

## 2Specification

Fortran Interface
 Subroutine c09aaf ( mode, n, nf, nwc,
 Integer, Intent (In) :: n Integer, Intent (Inout) :: ifail Integer, Intent (Out) :: nwlmax, nf, nwc, icomm(100) Character (*), Intent (In) :: wavnam Character (1), Intent (In) :: wtrans, mode
#include <nag.h>
 void c09aaf_ (const char *wavnam, const char *wtrans, const char *mode, const Integer *n, Integer *nwlmax, Integer *nf, Integer *nwc, Integer icomm[], Integer *ifail, const Charlen length_wavnam, const Charlen length_wtrans, const Charlen length_mode)
The routine may be called by the names c09aaf or nagf_wav_dim1_init.

## 3Description

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$, c09aaf returns the dimension details for the transform determined by this combination. The dimension details are: ${l}_{\mathrm{max}}$, the maximum number of levels of resolution that that could be computed were a multi-level DWT/MODWT applied; ${n}_{f}$, the filter length; ${n}_{c}$ 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 ${l}_{\mathrm{max}}$ 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 routines in this chapter.

None.

## 5Arguments

1: $\mathbf{wavnam}$Character(*) Input
On entry: the name of the mother wavelet. See the C09 Chapter Introduction for details.
${\mathbf{wavnam}}=\text{'HAAR'}\text{​ or ​}\text{'DB1'}$
Haar wavelet, also known as $\text{'DB1'}$ as a special case of the Daubechies wavelet.
${\mathbf{wavnam}}=\text{'}\text{DB}\mathbit{n}\text{'}$, where $\mathbit{n}=2,3,\dots ,38$
Daubechies wavelet with $\mathbit{n}$ vanishing moments ($2\mathbit{n}$ coefficients). For example, ${\mathbf{wavnam}}=\text{'DB4'}$ is the name for the Daubechies wavelet with $4$ vanishing moments ($8$ coefficients).
${\mathbf{wavnam}}=\text{'}\text{COIF}\mathbit{n}\text{'}$, where $\mathbit{n}=1,2,\dots ,17$
Coiflet wavelet of order $\mathbit{n}$.
${\mathbf{wavnam}}=\text{'BEYL'}$
Beylkin wavelet.
${\mathbf{wavnam}}=\text{'VAID'}$
Vaidyanathan wavelet.
${\mathbf{wavnam}}=\text{'}\text{SYM}\mathbit{n}\text{'}$, where $\mathbit{n}=2,3,\dots ,20$
Symlet wavelet of order $\mathbit{n}$.
${\mathbf{wavnam}}=\text{'}\text{BIOR}\mathbit{x}.\mathbit{y}\text{'}$, where $\mathbit{x}.\mathbit{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 $\mathbit{x}.\mathbit{y}$. For example ${\mathbf{wavnam}}=\text{'BIOR3.1'}$ is the name for the biorthogonal wavelet of order $3.1$.
${\mathbf{wavnam}}=\text{'}\text{RBIO}\mathbit{x}.\mathbit{y}\text{'}$, where $\mathbit{x}.\mathbit{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 $\mathbit{x}.\mathbit{y}$. For example ${\mathbf{wavnam}}=\text{'RBIO3.1'}$ is the name for the reverse biorthogonal wavelet of order $3.1$.
Constraint: ${\mathbf{wavnam}}=\text{'HAAR'}\text{, ​}\text{'DB1'}$, $\text{'DB2'}$, $\text{'DB3'}$, $\text{'DB4'}$, $\text{'DB5'}$, $\text{'DB6'}$, $\text{'DB7'}$, $\text{'DB8'}$, $\text{'DB9'}$, $\text{'DB10'}$, $\text{'DB11'}$, $\text{'DB12'}$, $\text{'DB13'}$, $\text{'DB14'}$, $\text{'DB15'}$, $\text{'DB16'}$, $\text{'DB17'}$, $\text{'DB18'}$, $\text{'DB19'}$, $\text{'DB20'}$, $\text{'DB21'}$, $\text{'DB22'}$, $\text{'DB23'}$, $\text{'DB24'}$, $\text{'DB25'}$, $\text{'DB26'}$, $\text{'DB27'}$, $\text{'DB28'}$, $\text{'DB29'}$, $\text{'DB30'}$, $\text{'DB31'}$, $\text{'DB32'}$, $\text{'DB33'}$, $\text{'DB34'}$, $\text{'DB35'}$, $\text{'DB36'}$, $\text{'DB37'}$, $\text{'DB38'}$, $\text{'COIF1'}$, $\text{'COIF2'}$, $\text{'COIF3'}$, $\text{'COIF4'}$, $\text{'COIF5'}$, $\text{'COIF6'}$, $\text{'COIF7'}$, $\text{'COIF8'}$, $\text{'COIF9'}$, $\text{'COIF10'}$, $\text{'COIF11'}$, $\text{'COIF12'}$, $\text{'COIF13'}$, $\text{'COIF14'}$, $\text{'COIF15'}$, $\text{'COIF16'}$, $\text{'COIF17'}$, $\text{'BEYL'}$, $\text{'VAID'}$, $\text{'SYM2'}$, $\text{'SYM3'}$, $\text{'SYM4'}$, $\text{'SYM5'}$, $\text{'SYM6'}$, $\text{'SYM7'}$, $\text{'SYM8'}$, $\text{'SYM9'}$, $\text{'SYM10'}$, $\text{'SYM11'}$, $\text{'SYM12'}$, $\text{'SYM13'}$, $\text{'SYM14'}$, $\text{'SYM15'}$, $\text{'SYM16'}$, $\text{'SYM17'}$, $\text{'SYM18'}$, $\text{'SYM19'}$, $\text{'SYM20'}$, $\text{'BIOR1.1'}$, $\text{'BIOR1.3'}$, $\text{'BIOR1.5'}$, $\text{'BIOR2.2'}$, $\text{'BIOR2.4'}$, $\text{'BIOR2.6'}$, $\text{'BIOR2.8'}$, $\text{'BIOR3.1'}$, $\text{'BIOR3.3'}$, $\text{'BIOR3.5'}$, $\text{'BIOR3.7'}$, $\text{'BIOR3.9'}$, $\text{'BIOR4.4'}$, $\text{'BIOR5.5'}$, $\text{'BIOR6.8'}$, $\text{'RBIO1.1'}$, $\text{'RBIO1.3'}$, $\text{'RBIO1.5'}$, $\text{'RBIO2.2'}$, $\text{'RBIO2.4'}$, $\text{'RBIO2.6'}$, $\text{'RBIO2.8'}$, $\text{'RBIO3.1'}$, $\text{'RBIO3.3'}$, $\text{'RBIO3.5'}$, $\text{'RBIO3.7'}$, $\text{'RBIO3.9'}$, $\text{'RBIO4.4'}$, $\text{'RBIO5.5'}$ or $\text{'RBIO6.8'}$.
2: $\mathbf{wtrans}$Character(1) Input
On entry: the type of discrete wavelet transform that is to be applied.
${\mathbf{wtrans}}=\text{'S'}$
Single-level decomposition or reconstruction by discrete wavelet transform.
${\mathbf{wtrans}}=\text{'M'}$
Multiresolution, by a multi-level DWT or its inverse.
${\mathbf{wtrans}}=\text{'T'}$
Single-level decomposition or reconstruction by maximal overlap discrete wavelet transform.
${\mathbf{wtrans}}=\text{'U'}$
Multi-level resolution by a maximal overlap discrete wavelet transform or its inverse.
Constraint: ${\mathbf{wtrans}}=\text{'S'}$, $\text{'M'}$, $\text{'T'}$ or $\text{'U'}$.
3: $\mathbf{mode}$Character(1) Input
On entry: the end extension method. Note that only periodic end extension is currently available for the MODWT.
${\mathbf{mode}}=\text{'P'}$
Periodic end extension.
${\mathbf{mode}}=\text{'H'}$
Half-point symmetric end extension.
${\mathbf{mode}}=\text{'W'}$
Whole-point symmetric end extension.
${\mathbf{mode}}=\text{'Z'}$
Zero end extension.
Constraints:
• ${\mathbf{mode}}=\text{'P'}$, $\text{'H'}$, $\text{'W'}$ or $\text{'Z'}$ for DWT;
• ${\mathbf{mode}}=\text{'P'}$ for MODWT.
4: $\mathbf{n}$Integer Input
On entry: the number of elements, $n$, in the input data array, $x$.
Constraint: ${\mathbf{n}}\ge 2$.
5: $\mathbf{nwlmax}$Integer Output
On exit: the maximum number of levels of resolution, ${l}_{\mathrm{max}}$, that can be computed when a multi-level discrete wavelet transform is applied. It is such that ${2}^{{l}_{\mathrm{max}}}\le n<{2}^{{l}_{\mathrm{max}}+1}$, for ${l}_{\mathrm{max}}$ an integer.
6: $\mathbf{nf}$Integer Output
On exit: the filter length, ${n}_{f}$, for the supplied mother wavelet. This is used to determine the number of coefficients to be generated by the chosen transform.
7: $\mathbf{nwc}$Integer Output
On exit: for a single-level transform (${\mathbf{wtrans}}=\text{'S'}$ or $\text{'T'}$), 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 (${\mathbf{wtrans}}=\text{'M'}$ or $\text{'U'}$) the total number of coefficients that would be generated over ${l}_{\mathrm{max}}$ levels and with ${\mathbf{keepa}}=\text{'A'}$ for MODWT.
8: $\mathbf{icomm}\left(100\right)$Integer array Communication Array
On exit: contains details of the wavelet transform and the problem dimension which is to be communicated to the one-dimensional discrete transform routines in this chapter.
9: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ 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).

## 6Error Indicators and Warnings

If on entry ${\mathbf{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:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{wavnam}}=⟨\mathit{\text{value}}⟩$ was an illegal value.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{wtrans}}=⟨\mathit{\text{value}}⟩$ was an illegal value.
${\mathbf{ifail}}=3$
On entry, ${\mathbf{mode}}=⟨\mathit{\text{value}}⟩$ was an illegal value.
On entry, ${\mathbf{wtrans}}=\text{'T'}$ or $\text{'U'}$ and ${\mathbf{mode}}\ne \text{'P'}$.
Constraint: ${\mathbf{mode}}=\text{'P'}$ when ${\mathbf{wtrans}}=\text{'T'}$ or $\text{'U'}$.
${\mathbf{ifail}}=4$
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}\ge 2$.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable.

## 8Parallelism and Performance

c09aaf is not threaded in any implementation.

None.

## 10Example

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.

### 10.1Program Text

Program Text (c09aafe.f90)

### 10.2Program Data

Program Data (c09aafe.d)

### 10.3Program Results

Program Results (c09aafe.r)
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 212, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9269977807998657, "perplexity": 1238.110424662035}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-31/segments/1627046154432.2/warc/CC-MAIN-20210803061431-20210803091431-00298.warc.gz"}