NAME

Math::DWT::UDWT - Pure Perl 1-D Undecimated Discrete Wavelet Transform.

VERSION

Version 0.01

SYNOPSIS

This module implements a pure Perl version of the 1-D Undecimated Discrete Wavelet Transform (UDWT), also known as the "stationary" Discrete Wavelet Transform, because it is shift-invariant.

Do not look here for efficiency - only implementation. It is designed to be a reference for others who would like to see wavelets in action. It is based off of MATLAB code from Ivan Selesnick's website at http://eeweb.poly.edu/iselesni/software/index.html.

use Math::DWT::UDWT;

# new object with Math::DWT::Wavelet::Symmlet module loaded
# as wavelet; specifically, Symmlet5
my $udwt = Math::DWT::UDWT->new('Symmlet',5);

@signal=@signal[0..509];
my $x = \@signal;  # can be any length - not just 2^n

# performs one iteration of the UDWT on $x
my $coeffs = $udwt->udwt($x);

# notice how the UDWT returns more data than it took in
# this is due to the linear convolution used right now.
print scalar(@{$coeffs->[0]}); # 265
print scalar(@{$coeffs->[1]}); # 265

# test Perfect Reconstruction
my $y=$udwt->iudwt($coeffs);

my $maxerr=0;
foreach my $i (0 .. scalar(@x)-1) {
    my $err = abs($x[$i] - $y->[$i]);
    $maxerr = $err if ($err > $maxerr);
}
print "$maxerr\n"; # prints 7.92255150372512e-12 (close to 0)

SUBROUTINES/METHODS

new(WAVELET,VAR)

new(WAVELET)

new()

Create a new UDWT object with the wavelet WAVELET and variable VAR.

udwt(SIGNAL,LEVEL,LO-PASS,HI-PASS)

udwt(SIGNAL,LEVEL)

udwt(SIGNAL)

This performs the forward Undecimated Discrete Wavelet Transform on SIGNAL using LO-PASS and HI-PASS as filters. The process is repeated LEVEL times. If the filters are omitted, it uses the filters set in the wavelet when the udwt object was created. LEVEL defaults to 1.

The structure of $coeffs is the same as in Math::DWT, i.e., the first LEVEL arrayrefs are iterative arrays of detail coefficients, and the last arrayref is the remaining array of scaling coefficients.

iudwt(COEFFICIENTS,LEVEL,LO-PASS,HI-PASS)

iudwt(COEFFICIENTS,LEVEL)

iudwt(COEFFICIENTS)

Inverse Undecimated Discrete Wavelet Transform. Same options as for Math::DWT::idwt.

set_filters(LO_D,HI_D,LO_R,HI_R)

Set the filters manually. Each of LO_D, HI_D, LO_R, and HI_R is an arrayref to the set of coefficients for the respective filter set. Returns undef.

get_filters()

Get the set of filters. Returns an array or an arrayref containing LO_D, HI_D, LO_R, HI_R in that order.

AUTHOR

Mike Kroh, <kroh at cpan.org>

BUGS

Please report any bugs or feature requests to bug-math-dwt-udwt at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Math-DWT-UDWT. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2016 Mike Kroh.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0

Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.

If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.

This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.

This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.