File Coverage

blib/lib/Math/DWT/Wavelet/Coiflet.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::Coiflet;
2 1     1   638 use strict;
  1         1  
  1         22  
3 1     1   3 use warnings;
  1         1  
  1         526  
4              
5              
6             =head1 NAME
7              
8             Math::DWT::Wavelet::Coiflet - FIR lo- & hi-pass filter coefficients for the Coiflet wavelet.
9              
10             =head1 VERSION
11              
12             Version 0.022
13              
14             =cut
15              
16             our $VERSION = '0.022';
17              
18             =head1 SYNOPSIS
19              
20             This module provides the lo- and hi-pass decomposition and reconstruction filter coefficients for the Coiflet 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('Coiflet');
26             my $udwt = Math::DWT::UDWT->new('Coiflet');
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 $coiflet4 = Math::DWT::Wavelet::Coiflet->new(4);
38              
39             This method returns a Math::DWT::Wavelet::Coiflet 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::Coiflet->vars();
46             print scalar(@v); # 5
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::Daubechies(3pm), Math::DWT::Wavelet::Symlet(3pm), Math::DWT::Wavelet::Biorthogonal(3pm), Math::DWT::Wavelet::ReverseBiorthogonal(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             my @vars=qw/1 2 3 4 5/;
132              
133             my %lo_d; my %hi_d; my %lo_r; my %hi_r;
134              
135              
136             $lo_d{1}=[qw/-0.01565572813546454 -0.0727326195128539 0.38486484686420286 0.8525720202122554 0.3378976624578092 -0.0727326195128539/];
137             $hi_d{1}=[qw/0.0727326195128539 0.3378976624578092 -0.8525720202122554 0.38486484686420286 0.0727326195128539 -0.01565572813546454/];
138             $lo_r{1}=[qw/-0.0727326195128539 0.3378976624578092 0.8525720202122554 0.38486484686420286 -0.0727326195128539 -0.01565572813546454/];
139             $hi_r{1}=[qw/-0.01565572813546454 0.0727326195128539 0.38486484686420286 -0.8525720202122554 0.3378976624578092 0.0727326195128539/];
140              
141             $lo_d{2}=[qw/-0.0007205494453645122 -0.0018232088707029932 0.0056114348193944995 0.023680171946334084 -0.0594344186464569 -0.0764885990783064 0.41700518442169254 0.8127236354455423 0.3861100668211622 -0.06737255472196302 -0.04146493678175915 0.016387336463522112/];
142             $hi_d{2}=[qw/-0.016387336463522112 -0.04146493678175915 0.06737255472196302 0.3861100668211622 -0.8127236354455423 0.41700518442169254 0.0764885990783064 -0.0594344186464569 -0.023680171946334084 0.0056114348193944995 0.0018232088707029932 -0.0007205494453645122/];
143             $lo_r{2}=[qw/0.016387336463522112 -0.04146493678175915 -0.06737255472196302 0.3861100668211622 0.8127236354455423 0.41700518442169254 -0.0764885990783064 -0.0594344186464569 0.023680171946334084 0.0056114348193944995 -0.0018232088707029932 -0.0007205494453645122/];
144             $hi_r{2}=[qw/-0.0007205494453645122 0.0018232088707029932 0.0056114348193944995 -0.023680171946334084 -0.0594344186464569 0.0764885990783064 0.41700518442169254 -0.8127236354455423 0.3861100668211622 0.06737255472196302 -0.04146493678175915 -0.016387336463522112/];
145              
146             $lo_d{3}=[qw/-3.459977283621256e-05 -7.098330313814125e-05 0.0004662169601128863 0.0011175187708906016 -0.0025745176887502236 -0.00900797613666158 0.015880544863615904 0.03455502757306163 -0.08230192710688598 -0.07179982161931202 0.42848347637761874 0.7937772226256206 0.4051769024096169 -0.06112339000267287 -0.0657719112818555 0.023452696141836267 0.007782596427325418 -0.003793512864491014/];
147             $hi_d{3}=[qw/0.003793512864491014 0.007782596427325418 -0.023452696141836267 -0.0657719112818555 0.06112339000267287 0.4051769024096169 -0.7937772226256206 0.42848347637761874 0.07179982161931202 -0.08230192710688598 -0.03455502757306163 0.015880544863615904 0.00900797613666158 -0.0025745176887502236 -0.0011175187708906016 0.0004662169601128863 7.098330313814125e-05 -3.459977283621256e-05/];
148             $lo_r{3}=[qw/-0.003793512864491014 0.007782596427325418 0.023452696141836267 -0.0657719112818555 -0.06112339000267287 0.4051769024096169 0.7937772226256206 0.42848347637761874 -0.07179982161931202 -0.08230192710688598 0.03455502757306163 0.015880544863615904 -0.00900797613666158 -0.0025745176887502236 0.0011175187708906016 0.0004662169601128863 -7.098330313814125e-05 -3.459977283621256e-05/];
149             $hi_r{3}=[qw/-3.459977283621256e-05 7.098330313814125e-05 0.0004662169601128863 -0.0011175187708906016 -0.0025745176887502236 0.00900797613666158 0.015880544863615904 -0.03455502757306163 -0.08230192710688598 0.07179982161931202 0.42848347637761874 -0.7937772226256206 0.4051769024096169 0.06112339000267287 -0.0657719112818555 -0.023452696141836267 0.007782596427325418 0.003793512864491014/];
150              
151             $lo_d{4}=[qw/-1.7849850030882614e-06 -3.2596802368833675e-06 3.1229875865345646e-05 6.233903446100713e-05 -0.00025997455248771324 -0.0005890207562443383 0.0012665619292989445 0.003751436157278457 -0.00565828668661072 -0.015211731527946259 0.025082261844864097 0.03933442712333749 -0.09622044203398798 -0.06662747426342504 0.4343860564914685 0.782238930920499 0.41530840703043026 -0.05607731331675481 -0.08126669968087875 0.026682300156053072 0.016068943964776348 -0.0073461663276420935 -0.0016294920126017326 0.0008923136685823146/];
152             $hi_d{4}=[qw/-0.0008923136685823146 -0.0016294920126017326 0.0073461663276420935 0.016068943964776348 -0.026682300156053072 -0.08126669968087875 0.05607731331675481 0.41530840703043026 -0.782238930920499 0.4343860564914685 0.06662747426342504 -0.09622044203398798 -0.03933442712333749 0.025082261844864097 0.015211731527946259 -0.00565828668661072 -0.003751436157278457 0.0012665619292989445 0.0005890207562443383 -0.00025997455248771324 -6.233903446100713e-05 3.1229875865345646e-05 3.2596802368833675e-06 -1.7849850030882614e-06/];
153             $lo_r{4}=[qw/0.0008923136685823146 -0.0016294920126017326 -0.0073461663276420935 0.016068943964776348 0.026682300156053072 -0.08126669968087875 -0.05607731331675481 0.41530840703043026 0.782238930920499 0.4343860564914685 -0.06662747426342504 -0.09622044203398798 0.03933442712333749 0.025082261844864097 -0.015211731527946259 -0.00565828668661072 0.003751436157278457 0.0012665619292989445 -0.0005890207562443383 -0.00025997455248771324 6.233903446100713e-05 3.1229875865345646e-05 -3.2596802368833675e-06 -1.7849850030882614e-06/];
154             $hi_r{4}=[qw/-1.7849850030882614e-06 3.2596802368833675e-06 3.1229875865345646e-05 -6.233903446100713e-05 -0.00025997455248771324 0.0005890207562443383 0.0012665619292989445 -0.003751436157278457 -0.00565828668661072 0.015211731527946259 0.025082261844864097 -0.03933442712333749 -0.09622044203398798 0.06662747426342504 0.4343860564914685 -0.782238930920499 0.41530840703043026 0.05607731331675481 -0.08126669968087875 -0.026682300156053072 0.016068943964776348 0.0073461663276420935 -0.0016294920126017326 -0.0008923136685823146/];
155              
156             $lo_d{5}=[qw/-9.517657273819165e-08 -1.6744288576823017e-07 2.0637618513646814e-06 3.7346551751414047e-06 -2.1315026809955787e-05 -4.134043227251251e-05 0.00014054114970203437 0.00030225958181306315 -0.0006381313430451114 -0.0016628637020130838 0.0024333732126576722 0.006764185448053083 -0.009164231162481846 -0.01976177894257264 0.03268357426711183 0.0412892087501817 -0.10557420870333893 -0.06203596396290357 0.4379916261718371 0.7742896036529562 0.4215662066908515 -0.05204316317624377 -0.09192001055969624 0.02816802897093635 0.023408156785839195 -0.010131117519849788 -0.004159358781386048 0.0021782363581090178 0.00035858968789573785 -0.00021208083980379827/];
157             $hi_d{5}=[qw/0.00021208083980379827 0.00035858968789573785 -0.0021782363581090178 -0.004159358781386048 0.010131117519849788 0.023408156785839195 -0.02816802897093635 -0.09192001055969624 0.05204316317624377 0.4215662066908515 -0.7742896036529562 0.4379916261718371 0.06203596396290357 -0.10557420870333893 -0.0412892087501817 0.03268357426711183 0.01976177894257264 -0.009164231162481846 -0.006764185448053083 0.0024333732126576722 0.0016628637020130838 -0.0006381313430451114 -0.00030225958181306315 0.00014054114970203437 4.134043227251251e-05 -2.1315026809955787e-05 -3.7346551751414047e-06 2.0637618513646814e-06 1.6744288576823017e-07 -9.517657273819165e-08/];
158             $lo_r{5}=[qw/-0.00021208083980379827 0.00035858968789573785 0.0021782363581090178 -0.004159358781386048 -0.010131117519849788 0.023408156785839195 0.02816802897093635 -0.09192001055969624 -0.05204316317624377 0.4215662066908515 0.7742896036529562 0.4379916261718371 -0.06203596396290357 -0.10557420870333893 0.0412892087501817 0.03268357426711183 -0.01976177894257264 -0.009164231162481846 0.006764185448053083 0.0024333732126576722 -0.0016628637020130838 -0.0006381313430451114 0.00030225958181306315 0.00014054114970203437 -4.134043227251251e-05 -2.1315026809955787e-05 3.7346551751414047e-06 2.0637618513646814e-06 -1.6744288576823017e-07 -9.517657273819165e-08/];
159             $hi_r{5}=[qw/-9.517657273819165e-08 1.6744288576823017e-07 2.0637618513646814e-06 -3.7346551751414047e-06 -2.1315026809955787e-05 4.134043227251251e-05 0.00014054114970203437 -0.00030225958181306315 -0.0006381313430451114 0.0016628637020130838 0.0024333732126576722 -0.006764185448053083 -0.009164231162481846 0.01976177894257264 0.03268357426711183 -0.0412892087501817 -0.10557420870333893 0.06203596396290357 0.4379916261718371 -0.7742896036529562 0.4215662066908515 0.05204316317624377 -0.09192001055969624 -0.02816802897093635 0.023408156785839195 0.010131117519849788 -0.004159358781386048 -0.0021782363581090178 0.00035858968789573785 0.00021208083980379827/];
160             ;
161              
162             sub new {
163 0     0 1   my $class=shift;
164 0           my $self={};
165 0           my $var=shift;
166              
167             $self={lo_d=>$lo_d{$var},
168             hi_d=>$hi_d{$var},
169             lo_r=>$lo_r{$var},
170 0           hi_r=>$hi_r{$var}
171             };
172            
173 0           bless $self,$class;
174 0           return $self;
175             };
176              
177             sub vars {
178 0     0 1   my $self=shift;
179 0 0         if (wantarray()) {
180 0           return (@vars);
181             };
182 0           return \@vars;
183             };
184              
185             sub filters {
186 0     0 1   my $self=shift;
187 0           my $lo_d=$self->lo_d;
188 0           my $hi_d=$self->hi_d;
189 0           my $lo_r=$self->lo_r;
190 0           my $hi_r=$self->hi_r;
191 0           my @a=( $lo_d,$hi_d,$lo_r,$hi_r);
192 0 0         if (wantarray()) {
193 0           return (@a);
194             };
195 0           return \@a;
196             };
197              
198             sub lo_d {
199 0     0 1   my $self=shift;
200 0           my $a=$self->{lo_d};
201 0 0         if (wantarray()) {
202 0           return (@{$a});
  0            
203             };
204 0           return $a;
205             };
206             sub hi_d {
207 0     0 1   my $self=shift;
208 0           my $a=$self->{hi_d};
209 0 0         if (wantarray()) {
210 0           return (@{$a});
  0            
211             };
212 0           return $a;
213             };
214             sub lo_r {
215 0     0 1   my $self=shift;
216 0           my $a=$self->{lo_r};
217 0 0         if (wantarray()) {
218 0           return (@{$a});
  0            
219             };
220 0           return $a;
221             };
222             sub hi_r {
223 0     0 1   my $self=shift;
224 0           my $a=$self->{hi_r};
225 0 0         if (wantarray()) {
226 0           return (@{$a});
  0            
227             };
228 0           return $a;
229             };
230              
231            
232             1;