MEMDConfig

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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§num_directions: usize

Number 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: usize

Maximum number of IMFs to extract. Default 8.

§sifting_tolerance: f64

Rilling α — 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: f64

Rilling β — strict bound; stopping requires σ(t) < β on all (channel, sample) points. Default 0.75 (10·α convention).

§sifting_fraction: f64

Rilling fraction — maximum fraction of points allowed to exceed α (provided they still satisfy β). Default 0.05.

§max_sifting_iterations: usize

Maximum sifting iterations per IMF. Default 100.

§direction_strategy: DirectionStrategy

How 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: EndEffectStrategy

End-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::SymmetricExtension reflects 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::AutoRegressive fits 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

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

Override the maximum IMF count.

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

Override the Rilling β strict tolerance.

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

Override the per-IMF sifting iteration cap.

pub fn with_direction_strategy( self, direction_strategy: DirectionStrategy, ) -> 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

Choose the end-effect strategy used during per-channel envelope construction.

Trait Implementations§

§

impl Clone for MEMDConfig

§

fn clone(&self) -> MEMDConfig

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for MEMDConfig

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Default for MEMDConfig

§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> IntoEither for T

§

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
§

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.
§

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

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,