Apply nan/inf handling patch from Sisyphus
[Math-GSL.git] / Wavelet.i
blobbf30e70e697e13149b69f08716209dc8f4c8dbc5
1 %module "Math::GSL::Wavelet"
2 %include "gsl_typemaps.i"
3 %{
4 #include "gsl/gsl_types.h"
5 #include "gsl/gsl_wavelet.h"
6 %}
8 typedef int size_t;
10 %include "gsl/gsl_types.h"
11 %include "gsl/gsl_wavelet.h"
13 %include "typemaps.i"
16 %perlcode %{
19 @EXPORT_OK = qw/
20 gsl_wavelet_alloc
21 gsl_wavelet_free
22 gsl_wavelet_name
23 gsl_wavelet_workspace_alloc
24 gsl_wavelet_workspace_free
25 gsl_wavelet_transform
26 gsl_wavelet_transform_forward
27 gsl_wavelet_transform_inverse
28 $gsl_wavelet_daubechies
29 $gsl_wavelet_daubechies_centered
30 $gsl_wavelet_haar
31 $gsl_wavelet_haar_centered
32 $gsl_wavelet_bspline
33 $gsl_wavelet_bspline_centered
37 %EXPORT_TAGS = ( all => [ @EXPORT_OK ], );
39 =head1 NAME
41 Math::GSL::Wavelet - Wavelets (for 1-D real data)
43 =head1 SYNOPSIS
45 use Math::GSL::Wavelet qw/:all/;
47 =cut
49 =head1 DESCRIPTION
51 Here is a list of all the functions included in this module :
53 =over 1
55 =item C<gsl_wavelet_alloc($T, $k)> - This function allocates and initializes a wavelet object of type $T, where $T must be one of the constants below. The parameter $k selects the specific member of the wavelet family.
57 =item C<gsl_wavelet_free($w)> - This function frees the wavelet object $w.
59 =item C<gsl_wavelet_name>
61 =item C<gsl_wavelet_workspace_alloc($n)> - This function allocates a workspace for the discrete wavelet transform. To perform a one-dimensional transform on $n elements, a workspace of size $n must be provided. For two-dimensional transforms of $n-by-$n matrices it is sufficient to allocate a workspace of size $n, since the transform operates on individual rows and columns.
63 =item C<gsl_wavelet_workspace_free($work)> - This function frees the allocated workspace work.
65 =item C<gsl_wavelet_transform>
67 =item C<gsl_wavelet_transform_forward($w, $data, $stride, $n, $work)> - This 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. For the forward transform, the elements of the original array are 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 and 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). The output data has the following form,
69 =over
71 =item (s_{-1,0}, d_{0,0}, d_{1,0}, d_{1,1}, d_{2,0}, ...,
73 =item d_{j,k}, ..., d_{J-1,2^{J-1}-1})
75 =back
77 where the first element is the smoothing coefficient s_{-1,0}, followed by the detail coefficients d_{j,k} for each level j. The backward transform inverts these coefficients to obtain the original data. These functions return a status of $GSL_SUCCESS upon successful completion. $GSL_EINVAL is returned if $n is not an integer power of 2 or if insufficient workspace is provided.
79 =item C<gsl_wavelet_transform_inverse>
81 =back
83 This module also contains the following constants with their valid k value for the gsl_wavelet_alloc function :
85 =over 1
87 =item $gsl_wavelet_daubechies
89 =item $gsl_wavelet_daubechies_centered
91 =back
93 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.
95 =over 1
97 =item $gsl_wavelet_haar
99 =item $gsl_wavelet_haar_centered
101 =back
103 This is the Haar wavelet. The only valid choice of k for the Haar wavelet is k=2.
105 =over 1
107 =item $gsl_wavelet_bspline
109 =item $gsl_wavelet_bspline_centered
111 =back
113 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.
115 =head1 AUTHORS
117 Jonathan Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
119 =head1 COPYRIGHT AND LICENSE
121 Copyright (C) 2008 Jonathan Leto and Thierry Moisan
123 This program is free software; you can redistribute it and/or modify it
124 under the same terms as Perl itself.
126 =cut