Struct VMDConfig
#[non_exhaustive]pub struct VMDConfig {
pub num_modes: usize,
pub alpha: AlphaSpec,
pub tau: f64,
pub tolerance: f64,
pub max_iterations: usize,
pub init: ModeInitialization,
pub dc_mode: bool,
pub random_seed: Option<u64>,
}Expand description
Configuration for vmd.
Construct via VMDConfig::default and chain with_* setters; the struct
is #[non_exhaustive] so struct-literal construction from outside the
crate is blocked.
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_modes: usizeNumber of modes to extract. Must be ≥ 1. Default 5.
alpha: AlphaSpecBandwidth-constraint parameter α. Default
AlphaSpec::PaperDefault (α = 2000).
tau: f64Dual-ascent step size τ. 0.0 (default) drops the constraint
Σ_k u_k = x: the Lagrange multiplier λ stays at zero and only
the per-mode bandwidth-penalty quadratic acts, so reconstruction is
approximate (~1e-4 on the paper’s three-tone signal) but ADMM
converges in fewer iterations. The paper calls this the “noise
tolerance” setting because it lets the algorithm soak constraint
violations rather than enforcing equality. Positive τ engages
dual ascent and drives Σ u_k → x to within tolerance — required
for round-trip fidelity (τ = 0.5 reaches < 1e-6 in the
paper_3_4_reconstruction_below_1e_minus_6_with_dual_ascent test).
Use τ > 0 when you need exact reconstruction; keep τ = 0 when you
only care about the mode shapes / center frequencies and want the
faster path.
tolerance: f64ADMM convergence threshold on
Σ_k ‖û_k^{n+1} − û_k^n‖² / ‖û_k^n‖². Default 1e-7.
max_iterations: usizeMaximum ADMM iterations. Default 500.
init: ModeInitializationCenter-frequency initialization scheme. Default
ModeInitialization::LinearSpaced.
dc_mode: boolForce the first mode’s center frequency to 0 and skip its centroid
update entirely. Default false.
Note: the (corrected) centroid update already includes the DC bin
in its denominator, so any mode that picks up DC/trend energy will
naturally anchor near ω = 0 without this flag — dc_mode = false
is the right choice for most decompositions, including signals
with a constant offset.
Set dc_mode = true only when you need to guarantee a slot at
ω = 0 regardless of what the data does. Useful when (a) trend
energy is small enough that another mode could otherwise win the
centroid race for the lowest slot, or (b) you want a stable,
reproducible “trend mode” placement across runs on related
signals where DC content varies.
random_seed: Option<u64>Seed for ModeInitialization::Uniform. Ignored otherwise. None
falls back to a fixed sentinel (0xVMD_DEFAULT) so a default
Uniform run is reproducible across processes; set explicitly for
independent draws.
Implementations§
§impl VMDConfig
impl VMDConfig
pub fn with_num_modes(self, num_modes: usize) -> Self
pub fn with_num_modes(self, num_modes: usize) -> Self
Override the number of modes K.
pub fn with_alpha(self, alpha: AlphaSpec) -> Self
pub fn with_alpha(self, alpha: AlphaSpec) -> Self
Override the bandwidth-constraint specification.
pub fn with_tolerance(self, tolerance: f64) -> Self
pub fn with_tolerance(self, tolerance: f64) -> Self
Override the convergence tolerance.
pub fn with_max_iterations(self, max_iterations: usize) -> Self
pub fn with_max_iterations(self, max_iterations: usize) -> Self
Override the maximum ADMM iteration count.
pub fn with_init(self, init: ModeInitialization) -> Self
pub fn with_init(self, init: ModeInitialization) -> Self
Override the center-frequency initialization scheme.
pub fn with_dc_mode(self, dc_mode: bool) -> Self
pub fn with_dc_mode(self, dc_mode: bool) -> Self
Toggle DC mode (forces ω_0 = 0).
pub fn with_seed(self, seed: u64) -> Self
pub fn with_seed(self, seed: u64) -> Self
Set the seed used by ModeInitialization::Uniform.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VMDConfig
impl RefUnwindSafe for VMDConfig
impl Send for VMDConfig
impl Sync for VMDConfig
impl Unpin for VMDConfig
impl UnwindSafe for VMDConfig
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.