pub enum Error {
LengthMismatch(usize, usize),
Empty,
NonFinite {
idx: usize,
value: f64,
},
Negative {
idx: usize,
value: f64,
},
NotNormalized {
sum: f64,
},
InvalidAlpha {
alpha: f64,
forbidden: f64,
},
Domain(&'static str),
}Expand description
Errors for information-measure computations.
Variants§
LengthMismatch(usize, usize)
Two input slices have different lengths (e.g., p and q in a divergence).
Empty
An input slice is empty where at least one element is required.
NonFinite
An entry is NaN or infinite where a finite value is required.
Negative
An entry is negative where a nonnegative value is required (probability distributions).
NotNormalized
The distribution does not sum to 1 within the specified tolerance.
InvalidAlpha
The alpha parameter is outside its valid domain (e.g., negative or non-finite).
Fields
Domain(&'static str)
Catch-all for domain violations: zero standard deviation, q_i=0 while p_i>0, insufficient sample size for KSG, and similar precondition failures.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
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
Mutably borrows from an owned value. Read more