Struct MEMDConfig
#[non_exhaustive]pub struct MEMDConfig {
pub num_directions: usize,
pub max_imfs: usize,
pub sifting_tolerance: f64,
pub sifting_tolerance_strict: f64,
pub sifting_fraction: f64,
pub max_sifting_iterations: usize,
pub direction_strategy: DirectionStrategy,
pub random_seed: Option<u64>,
pub end_effect_strategy: EndEffectStrategy,
}Expand description
Configuration for memd.
Builder-style setters mirror super::emd::EMDConfig; the struct is
#[non_exhaustive] so downstream callers must construct via
MEMDConfig::default (or one of the preset constructors) and chain
with_* methods.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.num_directions: usizeNumber of direction vectors. Must be ≥ 1. Rehman & Mandic (2010)
recommend ≥ 2·n for n ≤ 4 and K = 64 as a sweet-spot default
for 4 ≤ n ≤ 8; for very high-dimensional inputs (n ≫ 8, e.g.
64-channel EEG arrays) prefer K ≥ 2·n. Default is 64.
Degenerate case: K = 1 reduces MEMD to univariate EMD on a
single fixed projection and loses the joint scale-alignment
property that motivates MEMD in the first place. Permitted but
not recommended.
max_imfs: usizeMaximum number of IMFs to extract. Default 8.
sifting_tolerance: f64Rilling α — primary tolerance on per-sample σ(t) = |mean|/amplitude.
Stopping requires σ(t) < α on at least 1 − sifting_fraction of the
(channel, sample) population. Default 0.075.
sifting_tolerance_strict: f64Rilling β — strict bound; stopping requires σ(t) < β on all
(channel, sample) points. Default 0.75 (10·α convention).
sifting_fraction: f64Rilling fraction — maximum fraction of points allowed to exceed α (provided they still satisfy β). Default 0.05.
max_sifting_iterations: usizeMaximum sifting iterations per IMF. Default 100.
direction_strategy: DirectionStrategyHow to generate direction vectors. Default DirectionStrategy::Hammersley.
random_seed: Option<u64>Seed used by DirectionStrategy::Uniform; ignored under Hammersley.
None falls back to a nanos-based seed (non-deterministic across runs).
end_effect_strategy: EndEffectStrategyEnd-effect strategy applied to per-channel cubic-spline envelope
construction. Default is EndEffectStrategy::MirrorExtrema{ num_extrema: 3 } (Rilling, Flandrin & Gonçalves 2003), matching the
v2.0.0 super::emd::EMDConfig default.
Only EndEffectStrategy::LinearSlope and
EndEffectStrategy::MirrorExtrema are accepted by memd. The
other variants mix conventions that have no basis in the MEMD
literature when ported from univariate EMD:
EndEffectStrategy::SymmetricExtensionreflects channel-residue y-values around the channel’s boundary samples (2·data[boundary] − data[idx]), but the extrema indices come from the projection, so the reflected anchor pairs values from one signal with positions from another.EndEffectStrategy::AutoRegressivefits an AR model on the channel residue and extends it past the boundary, but the interior knot positions are projection-derived; the exterior AR-extension extrema and the interior projection extrema are computed under different criteria and cannot be cleanly stitched.
Passing either rejected variant returns
WaveletError::InvalidParameter from memd.
Implementations§
§impl MEMDConfig
impl MEMDConfig
pub fn with_num_directions(self, num_directions: usize) -> Self
pub fn with_num_directions(self, num_directions: usize) -> Self
Override the number of direction vectors.
pub fn with_max_imfs(self, max_imfs: usize) -> Self
pub fn with_max_imfs(self, max_imfs: usize) -> Self
Override the maximum IMF count.
pub fn with_sifting_tolerance(self, sifting_tolerance: f64) -> Self
pub fn with_sifting_tolerance(self, sifting_tolerance: f64) -> Self
Override the Rilling α tolerance.
pub fn with_sifting_tolerance_strict(
self,
sifting_tolerance_strict: f64,
) -> Self
pub fn with_sifting_tolerance_strict( self, sifting_tolerance_strict: f64, ) -> Self
Override the Rilling β strict tolerance.
pub fn with_sifting_fraction(self, sifting_fraction: f64) -> Self
pub fn with_sifting_fraction(self, sifting_fraction: f64) -> Self
Override the Rilling fraction.
pub fn with_max_sifting_iterations(self, max_sifting_iterations: usize) -> Self
pub fn with_max_sifting_iterations(self, max_sifting_iterations: usize) -> Self
Override the per-IMF sifting iteration cap.
pub fn with_direction_strategy(
self,
direction_strategy: DirectionStrategy,
) -> Self
pub fn with_direction_strategy( self, direction_strategy: DirectionStrategy, ) -> Self
Choose DirectionStrategy.
pub fn with_seed(self, seed: u64) -> Self
pub fn with_seed(self, seed: u64) -> Self
Set the RNG seed for DirectionStrategy::Uniform.
This only sets random_seed — it does not
change direction_strategy. Under the
default DirectionStrategy::Hammersley the seed is ignored
(Hammersley is deterministic). To get seeded reproducibility, pair
this with MEMDConfig::with_direction_strategy(
DirectionStrategy::Uniform) — order does not matter:
MEMDConfig::default()
.with_direction_strategy(DirectionStrategy::Uniform)
.with_seed(42)pub fn with_end_effect_strategy(
self,
end_effect_strategy: EndEffectStrategy,
) -> Self
pub fn with_end_effect_strategy( self, end_effect_strategy: EndEffectStrategy, ) -> Self
Choose the end-effect strategy used during per-channel envelope construction.
Trait Implementations§
§impl Clone for MEMDConfig
impl Clone for MEMDConfig
§fn clone(&self) -> MEMDConfig
fn clone(&self) -> MEMDConfig
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for MEMDConfig
impl Debug for MEMDConfig
Auto Trait Implementations§
impl Freeze for MEMDConfig
impl RefUnwindSafe for MEMDConfig
impl Send for MEMDConfig
impl Sync for MEMDConfig
impl Unpin for MEMDConfig
impl UnwindSafe for MEMDConfig
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)§impl<T> IntoEither for T
impl<T> IntoEither for T
§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.