File Coverage

blib/lib/Math/DWT/Wavelet/Biorthogonal.pm
Criterion Covered Total %
statement 6 49 12.2
branch 0 12 0.0
condition n/a
subroutine 2 9 22.2
pod 7 7 100.0
total 15 77 19.4


line stmt bran cond sub pod time code
1             package Math::DWT::Wavelet::Biorthogonal;
2 1     1   669 use strict;
  1         1  
  1         23  
3 1     1   3 use warnings;
  1         1  
  1         816  
4              
5             =head1 NAME
6              
7             Math::DWT::Wavelet::Biorthogonal - FIR lo- & hi-pass filter coefficients for the Biorthogonal wavelet.
8              
9             =head1 VERSION
10              
11             Version 0.022
12              
13             =cut
14              
15             our $VERSION = '0.022';
16              
17             =head1 SYNOPSIS
18              
19             This module provides the lo- and hi-pass decomposition and reconstruction filter coefficients for the Biorthogonal wavelet. It is meant to be used with other Math::DWT modules:
20              
21             use Math::DWT;
22             use Math::DWT::UDWT;
23              
24             my $dwt = Math::DWT->new('Biorthogonal');
25             my $udwt = Math::DWT::UDWT->new('Biorthogonal');
26              
27              
28             =cut
29              
30             =head1 SUBROUTINES/METHODS
31              
32             =head2 new(VAR)
33              
34             Takes a single argument, var, which determines the particular filter set which the object will provide. You can get a list of available filter sets with the vars() method.
35              
36             my $biorthogonal2_2 = Math::DWT::Wavelet::Biorthogonal->new('2.2');
37              
38             This method returns a Math::DWT::Wavelet::Biorthogonal object;
39              
40             =head2 vars()
41              
42             This method returns a list of possible choices for VAR when creating a new object, e.g.:
43              
44             my @v = Math::DWT::Wavelet::Biorthogonal->vars();
45             print scalar(@v); # 15
46              
47              
48             =head2 filters()
49              
50             Depending on the context in which it is called, returns an array or an arrayref containing (lo_d, hi_d, lo_r, hi_r) - the set of filters which are defined with the instantiated object.
51              
52              
53             =head2 lo_d()
54              
55             =head2 hi_d()
56              
57             =head2 lo_r()
58              
59             =head2 hi_r()
60              
61             Returns the requested set of filter coefficients as either an array or arrayref, depending on calling context.
62              
63             =head1 SEE ALSO
64              
65             Math::DWT(3pm), Math::DWT::UDWT(3pm), Math::DWT::Wavelet::Haar(3pm), Math::DWT::Wavelet::Coiflet(3pm), Math::DWT::Wavelet::Symlet(3pm), Math::DWT::Wavelet::Daubechies(3pm), Math::DWT::Wavelet::ReverseBiorthogonal(3pm), Math::DWT::Wavelet::DiscreteMeyer(3pm), perl(1)
66              
67              
68             =head1 AUTHOR
69              
70              
71             Mike Kroh, C<< >>
72              
73             =head1 BUGS
74              
75              
76             Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
77              
78              
79              
80             =head1 ACKNOWLEDGEMENTS
81              
82             These wavelet filter coefficients were scraped from this site: L.
83              
84             =head1 LICENSE AND COPYRIGHT
85              
86              
87             Copyright 2016 Mike Kroh.
88              
89             This program is free software; you can redistribute it and/or modify it
90             under the terms of the the Artistic License (2.0). You may obtain a
91             copy of the full license at:
92              
93             L
94              
95             Any use, modification, and distribution of the Standard or Modified
96             Versions is governed by this Artistic License. By using, modifying or
97             distributing the Package, you accept this license. Do not use, modify,
98             or distribute the Package, if you do not accept this license.
99              
100             If your Modified Version has been derived from a Modified Version made
101             by someone other than you, you are nevertheless required to ensure that
102             your Modified Version complies with the requirements of this license.
103              
104             This license does not grant you the right to use any trademark, service
105             mark, tradename, or logo of the Copyright Holder.
106              
107             This license includes the non-exclusive, worldwide, free-of-charge
108             patent license to make, have made, use, offer to sell, sell, import and
109             otherwise transfer the Package with respect to any patent claims
110             licensable by the Copyright Holder that are necessarily infringed by the
111             Package. If you institute patent litigation (including a cross-claim or
112             counterclaim) against any party alleging that the Package constitutes
113             direct or contributory patent infringement, then this Artistic License
114             to you shall terminate on the date that such litigation is filed.
115              
116             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
117             AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
118             THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
119             PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
120             YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
121             CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
122             CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
123             EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
124              
125              
126             =cut
127              
128              
129              
130              
131             my @vars=qw/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 6.8/;
132              
133             my %lo_d; my %hi_d; my %lo_r; my %hi_r;
134              
135              
136             $lo_d{1.1}=[qw/0.7071067811865476 0.7071067811865476/];
137             $hi_d{1.1}=[qw/-0.7071067811865476 0.7071067811865476/];
138             $lo_r{1.1}=[qw/0.7071067811865476 0.7071067811865476/];
139             $hi_r{1.1}=[qw/0.7071067811865476 -0.7071067811865476/];
140              
141             $lo_d{1.3}=[qw/-0.08838834764831845 0.08838834764831845 0.7071067811865476 0.7071067811865476 0.08838834764831845 -0.08838834764831845/];
142             $hi_d{1.3}=[qw/0.0 0.0 -0.7071067811865476 0.7071067811865476 0.0 0.0/];
143             $lo_r{1.3}=[qw/0.0 0.0 0.7071067811865476 0.7071067811865476 0.0 0.0/];
144             $hi_r{1.3}=[qw/-0.08838834764831845 -0.08838834764831845 0.7071067811865476 -0.7071067811865476 0.08838834764831845 0.08838834764831845/];
145              
146             $lo_d{1.5}=[qw/0.01657281518405971 -0.01657281518405971 -0.12153397801643787 0.12153397801643787 0.7071067811865476 0.7071067811865476 0.12153397801643787 -0.12153397801643787 -0.01657281518405971 0.01657281518405971/];
147             $hi_d{1.5}=[qw/0.0 0.0 0.0 0.0 -0.7071067811865476 0.7071067811865476 0.0 0.0 0.0 0.0/];
148             $lo_r{1.5}=[qw/0.0 0.0 0.0 0.0 0.7071067811865476 0.7071067811865476 0.0 0.0 0.0 0.0/];
149             $hi_r{1.5}=[qw/0.01657281518405971 0.01657281518405971 -0.12153397801643787 -0.12153397801643787 0.7071067811865476 -0.7071067811865476 0.12153397801643787 0.12153397801643787 -0.01657281518405971 -0.01657281518405971/];
150              
151             $lo_d{2.2}=[qw/0.0 -0.1767766952966369 0.3535533905932738 1.0606601717798214 0.3535533905932738 -0.1767766952966369/];
152             $hi_d{2.2}=[qw/0.0 0.3535533905932738 -0.7071067811865476 0.3535533905932738 0.0 0.0/];
153             $lo_r{2.2}=[qw/0.0 0.3535533905932738 0.7071067811865476 0.3535533905932738 0.0 0.0/];
154             $hi_r{2.2}=[qw/0.0 0.1767766952966369 0.3535533905932738 -1.0606601717798214 0.3535533905932738 0.1767766952966369/];
155              
156             $lo_d{2.4}=[qw/0.0 0.03314563036811942 -0.06629126073623884 -0.1767766952966369 0.4198446513295126 0.9943689110435825 0.4198446513295126 -0.1767766952966369 -0.06629126073623884 0.03314563036811942/];
157             $hi_d{2.4}=[qw/0.0 0.0 0.0 0.3535533905932738 -0.7071067811865476 0.3535533905932738 0.0 0.0 0.0 0.0/];
158             $lo_r{2.4}=[qw/0.0 0.0 0.0 0.3535533905932738 0.7071067811865476 0.3535533905932738 0.0 0.0 0.0 0.0/];
159             $hi_r{2.4}=[qw/0.0 -0.03314563036811942 -0.06629126073623884 0.1767766952966369 0.4198446513295126 -0.9943689110435825 0.4198446513295126 0.1767766952966369 -0.06629126073623884 -0.03314563036811942/];
160              
161             $lo_d{2.6}=[qw/0.0 -0.006905339660024878 0.013810679320049757 0.046956309688169176 -0.10772329869638811 -0.16987135563661201 0.4474660099696121 0.966747552403483 0.4474660099696121 -0.16987135563661201 -0.10772329869638811 0.046956309688169176 0.013810679320049757 -0.006905339660024878/];
162             $hi_d{2.6}=[qw/0.0 0.0 0.0 0.0 0.0 0.3535533905932738 -0.7071067811865476 0.3535533905932738 0.0 0.0 0.0 0.0 0.0 0.0/];
163             $lo_r{2.6}=[qw/0.0 0.0 0.0 0.0 0.0 0.3535533905932738 0.7071067811865476 0.3535533905932738 0.0 0.0 0.0 0.0 0.0 0.0/];
164             $hi_r{2.6}=[qw/0.0 0.006905339660024878 0.013810679320049757 -0.046956309688169176 -0.10772329869638811 0.16987135563661201 0.4474660099696121 -0.966747552403483 0.4474660099696121 0.16987135563661201 -0.10772329869638811 -0.046956309688169176 0.013810679320049757 0.006905339660024878/];
165              
166             $lo_d{2.8}=[qw/0.0 0.0015105430506304422 -0.0030210861012608843 -0.012947511862546647 0.02891610982635418 0.052998481890690945 -0.13491307360773608 -0.16382918343409025 0.4625714404759166 0.9516421218971786 0.4625714404759166 -0.16382918343409025 -0.13491307360773608 0.052998481890690945 0.02891610982635418 -0.012947511862546647 -0.0030210861012608843 0.0015105430506304422/];
167             $hi_d{2.8}=[qw/0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.3535533905932738 -0.7071067811865476 0.3535533905932738 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0/];
168             $lo_r{2.8}=[qw/0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.3535533905932738 0.7071067811865476 0.3535533905932738 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0/];
169             $hi_r{2.8}=[qw/0.0 -0.0015105430506304422 -0.0030210861012608843 0.012947511862546647 0.02891610982635418 -0.052998481890690945 -0.13491307360773608 0.16382918343409025 0.4625714404759166 -0.9516421218971786 0.4625714404759166 0.16382918343409025 -0.13491307360773608 -0.052998481890690945 0.02891610982635418 0.012947511862546647 -0.0030210861012608843 -0.0015105430506304422/];
170              
171             $lo_d{3.1}=[qw/-0.3535533905932738 1.0606601717798214 1.0606601717798214 -0.3535533905932738/];
172             $hi_d{3.1}=[qw/-0.1767766952966369 0.5303300858899107 -0.5303300858899107 0.1767766952966369/];
173             $lo_r{3.1}=[qw/0.1767766952966369 0.5303300858899107 0.5303300858899107 0.1767766952966369/];
174             $hi_r{3.1}=[qw/-0.3535533905932738 -1.0606601717798214 1.0606601717798214 0.3535533905932738/];
175              
176             $lo_d{3.3}=[qw/0.06629126073623884 -0.19887378220871652 -0.15467960838455727 0.9943689110435825 0.9943689110435825 -0.15467960838455727 -0.19887378220871652 0.06629126073623884/];
177             $hi_d{3.3}=[qw/0.0 0.0 -0.1767766952966369 0.5303300858899107 -0.5303300858899107 0.1767766952966369 0.0 0.0/];
178             $lo_r{3.3}=[qw/0.0 0.0 0.1767766952966369 0.5303300858899107 0.5303300858899107 0.1767766952966369 0.0 0.0/];
179             $hi_r{3.3}=[qw/0.06629126073623884 0.19887378220871652 -0.15467960838455727 -0.9943689110435825 0.9943689110435825 0.15467960838455727 -0.19887378220871652 -0.06629126073623884/];
180              
181             $lo_d{3.5}=[qw/-0.013810679320049757 0.04143203796014927 0.052480581416189075 -0.26792717880896527 -0.07181553246425874 0.966747552403483 0.966747552403483 -0.07181553246425874 -0.26792717880896527 0.052480581416189075 0.04143203796014927 -0.013810679320049757/];
182             $hi_d{3.5}=[qw/0.0 0.0 0.0 0.0 -0.1767766952966369 0.5303300858899107 -0.5303300858899107 0.1767766952966369 0.0 0.0 0.0 0.0/];
183             $lo_r{3.5}=[qw/0.0 0.0 0.0 0.0 0.1767766952966369 0.5303300858899107 0.5303300858899107 0.1767766952966369 0.0 0.0 0.0 0.0/];
184             $hi_r{3.5}=[qw/-0.013810679320049757 -0.04143203796014927 0.052480581416189075 0.26792717880896527 -0.07181553246425874 -0.966747552403483 0.966747552403483 0.07181553246425874 -0.26792717880896527 -0.052480581416189075 0.04143203796014927 0.013810679320049757/];
185              
186             $lo_d{3.7}=[qw/0.0030210861012608843 -0.009063258303782653 -0.01683176542131064 0.074663985074019 0.03133297870736289 -0.301159125922835 -0.026499240945345472 0.9516421218971786 0.9516421218971786 -0.026499240945345472 -0.301159125922835 0.03133297870736289 0.074663985074019 -0.01683176542131064 -0.009063258303782653 0.0030210861012608843/];
187             $hi_d{3.7}=[qw/0.0 0.0 0.0 0.0 0.0 0.0 -0.1767766952966369 0.5303300858899107 -0.5303300858899107 0.1767766952966369 0.0 0.0 0.0 0.0 0.0 0.0/];
188             $lo_r{3.7}=[qw/0.0 0.0 0.0 0.0 0.0 0.0 0.1767766952966369 0.5303300858899107 0.5303300858899107 0.1767766952966369 0.0 0.0 0.0 0.0 0.0 0.0/];
189             $hi_r{3.7}=[qw/0.0030210861012608843 0.009063258303782653 -0.01683176542131064 -0.074663985074019 0.03133297870736289 0.301159125922835 -0.026499240945345472 -0.9516421218971786 0.9516421218971786 0.026499240945345472 -0.301159125922835 -0.03133297870736289 0.074663985074019 0.01683176542131064 -0.009063258303782653 -0.0030210861012608843/];
190              
191             $lo_d{3.9}=[qw/-0.000679744372783699 0.002039233118351097 0.005060319219611981 -0.020618912641105536 -0.014112787930175846 0.09913478249423216 0.012300136269419315 -0.32019196836077857 0.0020500227115698858 0.9421257006782068 0.9421257006782068 0.0020500227115698858 -0.32019196836077857 0.012300136269419315 0.09913478249423216 -0.014112787930175846 -0.020618912641105536 0.005060319219611981 0.002039233118351097 -0.000679744372783699/];
192             $hi_d{3.9}=[qw/0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.1767766952966369 0.5303300858899107 -0.5303300858899107 0.1767766952966369 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0/];
193             $lo_r{3.9}=[qw/0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1767766952966369 0.5303300858899107 0.5303300858899107 0.1767766952966369 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0/];
194             $hi_r{3.9}=[qw/-0.000679744372783699 -0.002039233118351097 0.005060319219611981 0.020618912641105536 -0.014112787930175846 -0.09913478249423216 0.012300136269419315 0.32019196836077857 0.0020500227115698858 -0.9421257006782068 0.9421257006782068 -0.0020500227115698858 -0.32019196836077857 -0.012300136269419315 0.09913478249423216 0.014112787930175846 -0.020618912641105536 -0.005060319219611981 0.002039233118351097 0.000679744372783699/];
195              
196             $lo_d{4.4}=[qw/0.0 0.03782845550726404 -0.023849465019556843 -0.11062440441843718 0.37740285561283066 0.8526986790088938 0.37740285561283066 -0.11062440441843718 -0.023849465019556843 0.03782845550726404/];
197             $hi_d{4.4}=[qw/0.0 -0.06453888262869706 0.04068941760916406 0.41809227322161724 -0.7884856164055829 0.41809227322161724 0.04068941760916406 -0.06453888262869706 0.0 0.0/];
198             $lo_r{4.4}=[qw/0.0 -0.06453888262869706 -0.04068941760916406 0.41809227322161724 0.7884856164055829 0.41809227322161724 -0.04068941760916406 -0.06453888262869706 0.0 0.0/];
199             $hi_r{4.4}=[qw/0.0 -0.03782845550726404 -0.023849465019556843 0.11062440441843718 0.37740285561283066 -0.8526986790088938 0.37740285561283066 0.11062440441843718 -0.023849465019556843 -0.03782845550726404/];
200              
201             $lo_d{5.5}=[qw/0.0 0.0 0.03968708834740544 0.007948108637240322 -0.05446378846823691 0.34560528195603346 0.7366601814282105 0.34560528195603346 -0.05446378846823691 0.007948108637240322 0.03968708834740544 0.0/];
202             $hi_d{5.5}=[qw/-0.013456709459118716 -0.002694966880111507 0.13670658466432914 -0.09350469740093886 -0.47680326579848425 0.8995061097486484 -0.47680326579848425 -0.09350469740093886 0.13670658466432914 -0.002694966880111507 -0.013456709459118716 0.0/];
203             $lo_r{5.5}=[qw/0.013456709459118716 -0.002694966880111507 -0.13670658466432914 -0.09350469740093886 0.47680326579848425 0.8995061097486484 0.47680326579848425 -0.09350469740093886 -0.13670658466432914 -0.002694966880111507 0.013456709459118716 0.0/];
204             $hi_r{5.5}=[qw/0.0 0.0 0.03968708834740544 -0.007948108637240322 -0.05446378846823691 -0.34560528195603346 0.7366601814282105 -0.34560528195603346 -0.05446378846823691 -0.007948108637240322 0.03968708834740544 0.0/];
205              
206             $lo_d{6.8}=[qw/0.0 0.0019088317364812906 -0.0019142861290887667 -0.016990639867602342 0.01193456527972926 0.04973290349094079 -0.07726317316720414 -0.09405920349573646 0.4207962846098268 0.8259229974584023 0.4207962846098268 -0.09405920349573646 -0.07726317316720414 0.04973290349094079 0.01193456527972926 -0.016990639867602342 -0.0019142861290887667 0.0019088317364812906/];
207             $hi_d{6.8}=[qw/0.0 0.0 0.0 0.014426282505624435 -0.014467504896790148 -0.07872200106262882 0.04036797903033992 0.41784910915027457 -0.7589077294536541 0.41784910915027457 0.04036797903033992 -0.07872200106262882 -0.014467504896790148 0.014426282505624435 0.0 0.0 0.0 0.0/];
208             $lo_r{6.8}=[qw/0.0 0.0 0.0 0.014426282505624435 0.014467504896790148 -0.07872200106262882 -0.04036797903033992 0.41784910915027457 0.7589077294536541 0.41784910915027457 -0.04036797903033992 -0.07872200106262882 0.014467504896790148 0.014426282505624435 0.0 0.0 0.0 0.0/];
209             $hi_r{6.8}=[qw/0.0 -0.0019088317364812906 -0.0019142861290887667 0.016990639867602342 0.01193456527972926 -0.04973290349094079 -0.07726317316720414 0.09405920349573646 0.4207962846098268 -0.8259229974584023 0.4207962846098268 0.09405920349573646 -0.07726317316720414 -0.04973290349094079 0.01193456527972926 0.016990639867602342 -0.0019142861290887667 -0.0019088317364812906/];
210             ;
211              
212             sub new {
213 0     0 1   my $class=shift;
214 0           my $self={};
215 0           my $var=shift;
216              
217             $self={lo_d=>$lo_d{$var},
218             hi_d=>$hi_d{$var},
219             lo_r=>$lo_r{$var},
220 0           hi_r=>$hi_r{$var}
221             };
222            
223 0           bless $self,$class;
224 0           return $self;
225             };
226              
227             sub vars {
228 0     0 1   my $self=shift;
229 0 0         if (wantarray()) {
230 0           return (@vars);
231             };
232 0           return \@vars;
233             };
234              
235             sub filters {
236 0     0 1   my $self=shift;
237 0           my $lo_d=$self->lo_d;
238 0           my $hi_d=$self->hi_d;
239 0           my $lo_r=$self->lo_r;
240 0           my $hi_r=$self->hi_r;
241 0           my @a=( $lo_d,$hi_d,$lo_r,$hi_r);
242 0 0         if (wantarray()) {
243 0           return (@a);
244             };
245 0           return \@a;
246             };
247              
248             sub lo_d {
249 0     0 1   my $self=shift;
250 0           my $a=$self->{lo_d};
251 0 0         if (wantarray()) {
252 0           return (@{$a});
  0            
253             };
254 0           return $a;
255             };
256             sub hi_d {
257 0     0 1   my $self=shift;
258 0           my $a=$self->{hi_d};
259 0 0         if (wantarray()) {
260 0           return (@{$a});
  0            
261             };
262 0           return $a;
263             };
264             sub lo_r {
265 0     0 1   my $self=shift;
266 0           my $a=$self->{lo_r};
267 0 0         if (wantarray()) {
268 0           return (@{$a});
  0            
269             };
270 0           return $a;
271             };
272             sub hi_r {
273 0     0 1   my $self=shift;
274 0           my $a=$self->{hi_r};
275 0 0         if (wantarray()) {
276 0           return (@{$a});
  0            
277             };
278 0           return $a;
279             };
280              
281            
282             1;