omni-wave

Easy to use DWT (Discrete Wavelet Transform) library, no need to worry about padding, and a variety of wavelets are available.

CAUTION: My knowledge can't vouch for it being "correct", but it does "concentrate energy" and "reconstruct perfectly".

``` rust use approx::assertabsdiffeq; use ndarray::{Array1, Array2, Axis}; use omniwave::*;

let wavelet = wavelet::BIOR31; let love = Array2::fromshapevec((8, 8), vec![0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,99., 0., 0.,99., 0., 0., 0.,99.,99.,99.,99.,99.,99., 0., 0.,99.,99.,99.,99.,99.,99., 0., 0.,99.,99.,99.,99.,99.,99., 0., 0., 0.,99.,99.,99.,99., 0., 0., 0., 0., 0.,99.,99., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,]).unwrap();

let mut signal = love.clone(); let mut buffer = Array1::zeros(signal.lenof(Axis(0)) + wavelet.windowsize() - 2); // The minimum length of a buffer

completelydecompose2d(signal.viewmut(), buffer.viewmut(), wavelet); completelyreconstruct2d(signal.viewmut(), buffer.viewmut(), wavelet);

love.intoiter() .zip(signal) .foreach(|(a, b)| assertabsdiff_eq!(a, b, epsilon = 0.0001)); ```

Features

Knowledges

Signal

The data need to transform. The length should be even. Failure to meet the length requirement may not result a panic, but the behavior of functions will be undefined.

The left half of the input will be considered as Approx, while the right half will be considered as Detail.

Padding

The extension of a signal when processing. Our filling method named periodic (in PyWavelets), ppd (in Matlab) or wrap (in numpy.pad).

plaintext [ A.B.C.D.E.F.G.H ] a.b.c.d ... ↑^^^^^^^^^^^^^^ ↑^^^^^^ Original signal Padding: automatically fill & detach.

Originally, I planned to provide more extension mode, but found that the first coefficient of wavelets such as bior2.2 is zero... Wouldn't the information be lost in this way? ? So currently only periodic mode is provided. Let me know if you have a better suggestion.

Buffer

Temporary buffer for calculations. For performance, it is strongly recommended that it be contiguous in memory.

window_size

The number of wavelet coefficients.