pub struct WaveletCompression {
pub original_length: usize,
pub nonzero_count: usize,
pub sparse_indices: Vec<usize>,
pub sparse_values: Vec<f64>,
pub threshold: f64,
}Expand description
Wavelet-based signal compression using coefficient thresholding.
Implements sparse representation, zero-tree coding concept, and compression ratio estimation.
Fields§
§original_length: usizeOriginal signal length.
nonzero_count: usizeNumber of non-zero coefficients after compression.
sparse_indices: Vec<usize>Compressed coefficient vector (zero-tree encoded as sparse indices+values).
sparse_values: Vec<f64>Coefficient values at sparse indices.
threshold: f64Threshold used for compression.
Implementations§
Source§impl WaveletCompression
impl WaveletCompression
Sourcepub fn compress(signal: &[f64], retain_fraction: f64) -> Self
pub fn compress(signal: &[f64], retain_fraction: f64) -> Self
Compress a signal by retaining only DWT coefficients above retain_fraction.
retain_fraction is the fraction of energy to preserve (e.g., 0.99 retains
99% of signal energy).
Sourcepub fn decompress(&self) -> Vec<f64>
pub fn decompress(&self) -> Vec<f64>
Reconstruct signal from compressed sparse representation.
Fills a full coefficient vector from the sparse representation and applies the inverse DWT.
Sourcepub fn compression_ratio(&self) -> f64
pub fn compression_ratio(&self) -> f64
Compute compression ratio = original_length / nonzero_count.
Returns 1.0 if no compression occurred.
Sourcepub fn reconstruction_error(&self, original: &[f64]) -> f64
pub fn reconstruction_error(&self, original: &[f64]) -> f64
Compute the root-mean-square error between original and reconstructed signal.
Trait Implementations§
Source§impl Clone for WaveletCompression
impl Clone for WaveletCompression
Source§fn clone(&self) -> WaveletCompression
fn clone(&self) -> WaveletCompression
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for WaveletCompression
impl RefUnwindSafe for WaveletCompression
impl Send for WaveletCompression
impl Sync for WaveletCompression
impl Unpin for WaveletCompression
impl UnsafeUnpin for WaveletCompression
impl UnwindSafe for WaveletCompression
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.