Math::...avelet(3pm)

πŸ’– Math::GSL::Wavelet(3pm) πŸ’–

okay bestie, gather round, because today we're talking about Math::GSL::Wavelet β€” it's the Perl wrapper for 1-D (Real) Wavelets and honestly? it's giving math girlboss energy. πŸ¦‹

this page is from the User Contributed Perl Documentation, and it's all about allocating wavelets, transforming your data, and then putting it back together again. no cap.


✨ SYNOPSIS ✨

just one line and it's a baddie:

use Math::GSL::Wavelet qw/:all/;

import everything, we don't gatekeep here πŸ’…


🌸 DESCRIPTION 🌸

gsl_wavelet_alloc($T, $k)

this one allocates and initializes a whole wavelet object of type $T. and what is $T, you ask? it has to be one of the constants listed further down, no substitutions πŸ™…β€β™€οΈ and the parameter $k picks which specific member of that wavelet family you're getting. so like, $T says which family and $k says which sibling. slay.

gsl_wavelet_free($w)

frees the wavelet object $w. say thank u and let it go 🫢

gsl_wavelet_name

okay so this one is literally just chillin' there in the docs with no description attached. iconic in a mysterious way. πŸŽ€

gsl_wavelet_workspace_alloc($n)

allocates a workspace for the discrete wavelet transform. here's the deal:

  • to do a one-dimensional transform on $n elements, you need a workspace of size $n. that's it, that's the requirement.
  • for two-dimensional transforms of $n-by-$n matrices? you only need a workspace of size $n, because the transform operates on individual rows and columns. so much cheaper than you'd think, we love an efficient queen ✨

gsl_wavelet_workspace_free($work)

frees the allocated workspace work. bye babe πŸ’œ

gsl_wavelet_transform

also listed here with zero description. she's quiet, she's mysterious, she's there. πŸ™ˆ

gsl_wavelet_transform_forward($w, $data, $stride, $n, $work)

okay THIS is the main character. πŸ”₯ these functions compute in-place forward discrete wavelet transforms of length $n with stride $stride on the array $data.

the length of the transform $n is restricted to powers of two. no exceptions bestie, it's giving strict.

for the forward transform, the elements of the original array get replaced by the discrete wavelet transform:

f_i -> w_{j,k}

in a packed triangular storage layout, where:

  • j is the index of the level, j = 0 ... J-1
  • k is the index of the coefficient within each level, k = 0 ... (2^j)-1
  • the total number of levels is J = \log_2(n)

and the output data has this exact form:

(s_{-1,0}, d_{0,0}, d_{1,0}, d_{1,1}, d_{2,0}, ..., d_{j,k}, ..., d_{J-1,2^{J-1}-1})

sooo the very first element is the smoothing coefficient s_{-1,0}, and then come all the detail coefficients d_{j,k} for each level j. πŸ’«

the backward transform inverts these coefficients to get your original data back. it's giving reversible, it's giving restore-from-backup, we love a round trip. 🌈

these functions return a status of $GSL_SUCCESS when everything goes off without a hitch. but $GSL_EINVAL gets returned if:

  • $n is not an integer power of 2, or
  • insufficient workspace is provided

so like, double-check your args before you come crying to me 😭

gsl_wavelet_transform_inverse

another one just vibing in the list with no writeup. noted. ⭐


🧚 the constants 🧚

this module also contains the following constants, with their valid k value for the gsl_wavelet_alloc function:

  • $gsl_wavelet_daubechies
  • $gsl_wavelet_daubechies_centered

this is the Daubechies wavelet family of maximum phase with k/2 vanishing moments. the implemented wavelets are k=4, 6, ..., 20, with k even. so like, 4, 6, 8... you get it, all the even girlies. πŸ’–

  • $gsl_wavelet_haar
  • $gsl_wavelet_haar_centered

this is the Haar wavelet. and the only valid choice of k for Haar is k=2. one option only, no choices, she said what she said. πŸ‘‘

  • $gsl_wavelet_bspline
  • $gsl_wavelet_bspline_centered

this is the biorthogonal B-spline wavelet family of order (i,j). the implemented values of k = 100*i + j are:

103, 105, 202, 204, 206, 208, 301, 303, 305 307, 309

(yes, exactly like that β€” I'm not touching a single character of the source, not even the missing comma, that's the author's business πŸ™ˆ)


πŸ‘‘ AUTHORS πŸ‘‘

Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>

shoutout to the devs, absolute legends, fr fr 🫢


Copyright (C) 2008-2024 Jonathan "Duke" Leto and Thierry Moisan

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

so like, go wild, but under Perl's terms. legal bestie behavior only. πŸ’…


and that's the whole page, no notes ✨

this lil' manual page ships with perl v5.42.3 and is dated 2026-08-20 β€” go forth and wavelet, babe πŸ’–πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from