Struct VmdSelectKConfig
#[non_exhaustive]pub struct VmdSelectKConfig {
pub k_range: RangeInclusive<usize>,
pub improvement_threshold: f64,
pub boundary_fidelity: f64,
pub base_config: VMDConfig,
}Expand description
Configuration for vmd_select_k.
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.k_range: RangeInclusive<usize>Range of K values to sweep (inclusive). Default 1..=10.
The lower bound must be ≥ 1 and must include K = 1 to make
K = start + 1 selectable: the second-derivative elbow detector
needs three consecutive residual points and can only flag the
middle one, so K = start itself is never returned. Including
K = 1 (residual = signal energy, a known baseline) means a
two-tone signal can still pick K = 2 from the first
window [1, 2, 3].
improvement_threshold: f64Second-derivative elbow threshold used by the main detector.
Define Δ_K = E[K-1] − E[K] as the residual-energy drop gained by
going from K-1 modes to K. The sweep returns the smallest K
for which Δ_{K+1} / Δ_K < improvement_threshold — adding another
mode shrinks the next drop to a small fraction of the previous
one. Simple “next drop < threshold” rules don’t recover the right
K here: after the true elbow, residuals keep falling by ~20–30 %
per added mode (each new mode picks up a sliver of leakage /
mode-split) and a fractional criterion never trips.
Default 0.01 (1 %). Lowering it makes the detector demand
sharper elbows before declaring K; raising it makes it more
eager. Separate from boundary_fidelity
because the elbow measures diminishing returns (ratio) while the
boundary check measures reconstruction fidelity (absolute).
boundary_fidelity: f64Absolute residual threshold for the K = start boundary check.
If E[start] ≤ boundary_fidelity (normalized residual energy
‖x − Σ u_k‖² / ‖x‖²), the sweep recommends K = start
directly without consulting the ratio detector. This pre-check
exists because the ratio detector uses windows(3) and
physically cannot return start; without it, true single-mode
inputs are over-decomposed.
Default 0.05 (5 %). Set this higher than
improvement_threshold because
the default τ = 0 (constraint-dropped) base config produces
non-trivial reconstruction residuals — a clean single-tone near
Nyquist (e.g. cos(2π·0.45t)) sits at ~1 % residual, and noisy
or band-limited inputs go higher. Empirical positioning of the
5 % default:
- Single tone (low freq) at K=1: residual ≪ 1 % → trips ✓
- Single tone near Nyquist at K=1: residual ≈ 1 % → trips ✓
- Two-tone at K=1: residual ≈ 50 % → does not trip ✓
- Three-tone (paper §3.4) at K=2: residual ≈ 7.9 % → does not trip ✓
- Multi-tone broadband at K=2: residual ≥ 50 % → does not trip ✓
Lower it only if you want to reject anything but near-perfect
single-mode fits. Raise it if your signals are noisier and you
want to accept K = start more eagerly.
base_config: VMDConfigBase VMDConfig used for each sweep point; num_modes is
overridden per iteration.
Must keep VMDConfig::tau at 0.0: vmd_select_k uses
reconstruction residual as the selection metric, and positive
dual-ascent τ drives that residual toward zero even when K
is too small.
Implementations§
§impl VmdSelectKConfig
impl VmdSelectKConfig
pub fn with_k_range(self, range: RangeInclusive<usize>) -> Self
pub fn with_k_range(self, range: RangeInclusive<usize>) -> Self
Override the K sweep range.
pub fn with_improvement_threshold(self, t: f64) -> Self
pub fn with_improvement_threshold(self, t: f64) -> Self
Override the elbow threshold.
pub fn with_boundary_fidelity(self, t: f64) -> Self
pub fn with_boundary_fidelity(self, t: f64) -> Self
Override the boundary-fidelity threshold.
pub fn with_base_config(self, base: VMDConfig) -> Self
pub fn with_base_config(self, base: VMDConfig) -> Self
Override the base VMD config.
Trait Implementations§
§impl Clone for VmdSelectKConfig
impl Clone for VmdSelectKConfig
§fn clone(&self) -> VmdSelectKConfig
fn clone(&self) -> VmdSelectKConfig
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for VmdSelectKConfig
impl Debug for VmdSelectKConfig
Auto Trait Implementations§
impl Freeze for VmdSelectKConfig
impl RefUnwindSafe for VmdSelectKConfig
impl Send for VmdSelectKConfig
impl Sync for VmdSelectKConfig
impl Unpin for VmdSelectKConfig
impl UnwindSafe for VmdSelectKConfig
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.