Skip to main content

Crate ndwt

Crate ndwt 

Source
Expand description

Wavelet transforms for real and complex signals.

This crate provides two families of wavelet transform:

  • DWT (dwt) — the classic Discrete Wavelet Transform via convolution/subsampling.
  • LWT (lwt) — the Lifting Wavelet Transform, an in-place factorisation of the DWT.

Both families support 1-D and N-D transforms, multi-level decomposition, periodic and general boundary conditions, SIMD acceleration (via pulp), and optional rayon parallelism (feature rayon).

Also notable is that we provide adjoint operations for all of the forward and inverse transforms that respect the boundary extension modes, enabling these transforms to be cleanly used in optimization problems.

§Wavelet families

All concrete wavelet types live in the sub-modules below. Each type is a zero-size marker struct that carries the filter coefficients as compile-time constants.

ModuleWavelets
daubechiesDaubechies 1–10
symletSymlets 4–6
coifletCoiflets 1–3
biorBiorthogonal & CDF variants

The Wavelet enum lets you select a wavelet at runtime without generics.

§Quick start

use ndwt::{Wavelet, boundarys::BoundaryCondition, dwt::driver::WaveletTransform};

// Build a DWT driver for Daubechies-4 with zero boundary padding.
let xfm: = WaveletTransform::new(Wavelet::Daubechies4, BoundaryCondition::Zero);

let input = vec![1.0_f64; 128];
let nsd = ndwt::dwt::get_outlen(8, input.len());
let mut approx = vec![0.0; nsd];
let mut detail = vec![0.0; nsd];
xfm.forward_1d(&input, &mut approx, &mut detail);

Modules§

bior
Biorthogonal and CDF wavelet families.
boundarys
Boundary extension strategies for wavelet transforms.
coiflet
Coiflet wavelets (orders 1–3).
daubechies
Daubechies orthogonal wavelets (orders 1–10).
dwt
Discrete Wavelet Transform (DWT) via direct convolution and subsampling.
iter
N-dimensional lane iteration over flat slices and ndarray arrays.
lwt
Lifting Wavelet Transform (LWT).
simd
SIMD extension traits and CPU-dispatch infrastructure used by the wavelet kernels.
symlet
Symlet near-symmetric wavelets (orders 4–6).
utils
Array layout utilities for wavelet sub-band manipulation.

Enums§

Wavelet
Wavelet family selector.

Traits§

ChunkWidth
Marker trait setting N to be a good default value for the driver chunk sizes for type T.
MulScalarAdd
Fused multiply-add: self * a + b.
Transformable
Element type that can participate in wavelet filter convolutions.

Functions§

max_level
Compute the maximum number of decomposition levels for a filter of width N applied to a signal of length n.
max_level_nd
Compute the maximum number of decomposition levels for a filter of width N applied to an n-dimensional signal with shape along axes.