WaveletDictionary

Struct WaveletDictionary 

Source
pub struct WaveletDictionary { /* private fields */ }
Expand description

Wavelet-based dictionary for Matching Pursuit

Pre-computes and stores all dictionary atoms for fast matching. Uses parallel generation and optimized memory layout for performance.

§Invariants

  • Unit Norm: All atoms have L2 norm = 1 (normalized during generation)
  • Completeness: All valid (wavelet, scale, position) combinations are pre-generated
  • Fast Lookup: O(1) atom access via HashMap indexing

Implementations§

Source§

impl WaveletDictionary

Source

pub const MAX_SIGNAL_LENGTH: usize = 4_096usize

Maximum signal length for pre-computed dictionary

Source

pub fn new( wavelets: Vec<Box<dyn Wavelet>>, max_scale: usize, signal_length: usize, ) -> Result<Self>

Create a new wavelet dictionary with pre-computed atoms

Generates and stores all atoms in parallel for fast matching.

§Arguments
  • wavelets - Collection of wavelets to use for atom generation
  • max_scale - Maximum decomposition scale
  • signal_length - Length of signals this dictionary will process (max 4096)
§Returns

New WaveletDictionary instance with pre-computed atoms

§Errors

Returns error if:

  • No wavelets provided
  • Signal length is 0 or > 4096
  • max_scale is 0 (no atoms would be generated)
  • max_scale is too large (would result in 0 positions at highest scale)
  • Atom generation fails (includes wavelet index, scale, and position in error message)
  • Any generated atom has near-zero norm (< 1e-10), violating the unit-norm invariant
Source

pub fn num_wavelets(&self) -> usize

Get number of wavelets in dictionary

Source

pub fn max_scale(&self) -> usize

Get maximum scale

Trait Implementations§

Source§

impl Dictionary<f64> for WaveletDictionary

Source§

fn get_atom(&self, index: &AtomIndex) -> Result<Signal<f64>>

Get the atom at the specified index Read more
Source§

fn get_atom_data(&self, index: &AtomIndex) -> Result<&[f64]>

Get read-only access to atom data without cloning Read more
Source§

fn find_best_match(&self, signal: &Signal<f64>) -> Result<(AtomIndex, f64)>

Find the atom that best matches the given signal Read more
Source§

fn size(&self) -> usize

Total number of atoms in the dictionary
Source§

fn signal_length(&self) -> usize

Signal length that this dictionary supports

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V