File: wavelet_transforms.qbk

package info (click to toggle)
scipy 1.16.0-1exp7
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 234,820 kB
  • sloc: cpp: 503,145; python: 344,611; ansic: 195,638; javascript: 89,566; fortran: 56,210; cs: 3,081; f90: 1,150; sh: 848; makefile: 785; pascal: 284; csh: 135; lisp: 134; xml: 56; perl: 51
file content (62 lines) | stat: -rw-r--r-- 1,934 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[/
Copyright (c) 2019 Nick Thompson
Copyright (c) 2019 Paul A. Bristow
Use, modification and distribution are subject to the
Boost Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
]

[section:wavelet_transforms Wavelet Transforms]

[heading Synopsis]

```
    #include <boost/math/quadrature/wavelet_transforms.hpp>
    
    namespace boost::math::quadrature {

    template<class F, typename Real, int p>
    class daubechies_wavelet_transform
    {
    public:
        daubechies_wavelet_transform(F f, int grid_refinements = -1, Real tol = 100*std::numeric_limits<Real>::epsilon(),
        int max_refinements = 12) {}

        daubechies_wavelet_transform(F f, boost::math::daubechies_wavelet<Real, p> wavelet, Real tol = 100*std::numeric_limits<Real>::epsilon(),
        int max_refinements = 12);

        auto operator()(Real s, Real t)->decltype(std::declval<F>()(std::declval<Real>())) const;

    };
    } 
```

The wavelet transform of a function /f/ with respect to a wavelet \u03C8 is

[$../graphs/wavelet_transform_definition.svg]

For compactly supported Daubechies wavelets, the bounds can always be taken as finite, and we have 

[$../graphs/daubechies_wavelet_transform_definition.svg]

which also defines the /s/=0 case.

The code provided by Boost merely forwards a lambda to the trapezoidal quadrature routine, which converges quickly due to the Euler-Maclaurin summation formula.
However, the convergence is not as rapid as for infinitely differentiable functions, so the default tolerances are modified.

A basic usage is 

    auto psi = daubechies_wavelet<double, 8>();
    auto f = [](double x) {
        return sin(1/x);
    };
    auto Wf = daubechies_wavelet_transform(f, psi);

    double w = Wf(0.8, 7.2);

An image from this function is shown below.

[$../graphs/scalogram_sin1t_light.png]


[endsect] [/section:wavelet_transforms]