File Coverage

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