mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Document filter coefficients. [CI SKIP]
This commit is contained in:
@@ -40,20 +40,37 @@ The first ambiguity is whether they should be indexed by the number of vanishing
|
||||
/Boost.Math indexes the family by the number of vanishing moments./
|
||||
This indexing convention is the same as PyWavelets and Mathematica, but differs from Numerical Recipes.
|
||||
|
||||
Next, we need to ask whether the coefficients
|
||||
The next ambiguity is the overall scale.
|
||||
We (and PyWavelets) normalize the filters so that their L[sub 2] norm is 1.
|
||||
Others normalize so that the L[sub 2] norm is [sqrt]2.
|
||||
|
||||
Here are some printing of the coefficents to help recognize the ambiguities:
|
||||
Finally, we can use a convolutional representation of the filters, or a dot product representation.
|
||||
The dot product has all elements reversed relative to the convolutional representation.
|
||||
|
||||
|
||||
WaveletFilterCoefficients[DaubechiesWavelet[2], "PrimalLowpass"]
|
||||
{{0, 0.341506}, {1, 0.591506}, {2, 0.158494}, {3, -0.0915064}}
|
||||
|
||||
>>> print(pywt.Wavelet('db2').dec_lo)
|
||||
[-0.12940952255126037, 0.2241438680420134, 0.8365163037378079, 0.48296291314453416]
|
||||
>>> np.linalg.norm(pywt.Wavelet('db2').dec_lo)
|
||||
1.0
|
||||
The Boost convention:
|
||||
|
||||
// ...
|
||||
auto h = boost::math::filters::daubechies_scaling_filter<double, 2>();
|
||||
std::cout << "h = {" << h[0] << ", " << h[1] << ", " << h[2] << ", " << h[3] << "}\n";
|
||||
// output:
|
||||
h = {0.48296291314453416, 0.83651630373780794, 0.22414386804201339, -0.12940952255126037}
|
||||
|
||||
|
||||
Mathematica conventions:
|
||||
|
||||
WaveletFilterCoefficients[DaubechiesWavelet[2], "PrimalLowpass"]
|
||||
{{0, 0.341506}, {1, 0.591506}, {2, 0.158494}, {3, -0.0915064}}
|
||||
|
||||
|
||||
PyWavelet conventions:
|
||||
|
||||
>>> import pywt
|
||||
>>> print(pywt.Wavelet('db2').dec_lo)
|
||||
[-0.12940952255126037, 0.2241438680420134, 0.8365163037378079, 0.48296291314453416]
|
||||
>>> np.linalg.norm(pywt.Wavelet('db2').dec_lo)
|
||||
1.0
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -730,6 +730,10 @@ and as a CD ISBN 0-9504833-2-X 978-0-9504833-2-0, Classification 519.2-dc22.
|
||||
[include differentiation/lanczos_smoothing.qbk]
|
||||
[endmathpart]
|
||||
|
||||
[mathpart filters Filters]
|
||||
[include filters/daubechies.qbk]
|
||||
[endmathpart]
|
||||
|
||||
[include complex/complex-tr1.qbk]
|
||||
[include quaternion/math-quaternion.qbk]
|
||||
[include octonion/math-octonion.qbk]
|
||||
|
||||
Reference in New Issue
Block a user