#[non_exhaustive]pub enum CopulaError {
InvalidParameter {
message: String,
suggestion: Option<String>,
},
DimensionMismatch {
expected: usize,
actual: usize,
context: Option<String>,
},
InvalidRange {
values: Vec<f64>,
},
NumericalError {
message: String,
},
MatrixError {
operation: String,
reason: String,
},
OptimizationError {
reason: String,
},
StatisticalError {
message: String,
},
DataError {
message: String,
},
NotImplemented {
feature: String,
},
ComputationError {
message: String,
},
SerializationError {
message: String,
},
}Expand description
Errors that can occur in copula operations.
This enum covers all possible error conditions that can arise when working with copulas, from parameter validation to numerical computation issues.
The enum is #[non_exhaustive]: some variants only exist when the
corresponding Cargo feature is enabled, and new variants may be added in
minor releases. Match with a wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidParameter
Invalid parameter value provided to a copula constructor or method.
This occurs when parameters are outside their valid domain, such as negative values for parameters that must be positive, or correlation matrices that are not positive definite.
Fields
DimensionMismatch
Dimension mismatch between expected and actual dimensions.
This occurs when the number of variables doesn’t match the copula’s expected dimension, or when matrix dimensions are incompatible.
Fields
InvalidRange
Input values are outside the valid range [0, 1] for copula evaluation.
Copula functions are defined on the unit hypercube [0, 1]ⁿ, so all input values must be in this range.
NumericalError
Numerical computation error.
This occurs when numerical methods fail due to numerical instability, convergence issues, or other computational problems.
MatrixError
Matrix operation failed.
This occurs when matrix operations like inversion or decomposition fail, typically due to singular or ill-conditioned matrices.
OptimizationError
estimation only.Optimization algorithm failed to converge.
This occurs during parameter estimation when the optimization algorithm cannot find a solution within the specified tolerances or iterations.
StatisticalError
Statistical test or computation error.
This occurs when statistical procedures fail, such as when there’s insufficient data or when test assumptions are violated.
DataError
Data validation error.
This occurs when input data doesn’t meet requirements, such as containing NaN values, having insufficient sample size, or violating distributional assumptions.
NotImplemented
Feature not yet implemented.
This is used for methods that are planned but not yet implemented. Users should check the library roadmap for implementation timeline.
ComputationError
Generic computation error with custom message.
This is a catch-all for other computational errors that don’t fit into the more specific categories above.
SerializationError
serde only.Serialization or deserialization error.
This occurs when converting copulas to/from serialized formats.
Implementations§
Source§impl CopulaError
impl CopulaError
Sourcepub fn invalid_parameter<S: Into<String>>(message: S) -> Self
pub fn invalid_parameter<S: Into<String>>(message: S) -> Self
Create an invalid parameter error with a custom message.
Sourcepub fn invalid_parameter_with_suggestion<S: Into<String>>(
message: S,
suggestion: S,
) -> Self
pub fn invalid_parameter_with_suggestion<S: Into<String>>( message: S, suggestion: S, ) -> Self
Create an invalid parameter error with a custom message and suggestion.
Sourcepub fn dimension_mismatch(expected: usize, actual: usize) -> Self
pub fn dimension_mismatch(expected: usize, actual: usize) -> Self
Create a dimension mismatch error.
Sourcepub fn dimension_mismatch_with_context<S: Into<String>>(
expected: usize,
actual: usize,
context: S,
) -> Self
pub fn dimension_mismatch_with_context<S: Into<String>>( expected: usize, actual: usize, context: S, ) -> Self
Create a dimension mismatch error with context.
Sourcepub fn invalid_range(values: Vec<f64>) -> Self
pub fn invalid_range(values: Vec<f64>) -> Self
Create an invalid range error for values outside [0, 1].
Sourcepub fn numerical<S: Into<String>>(message: S) -> Self
pub fn numerical<S: Into<String>>(message: S) -> Self
Create a numerical error with a custom message.
Sourcepub fn matrix_error<S: Into<String>>(operation: S, reason: S) -> Self
pub fn matrix_error<S: Into<String>>(operation: S, reason: S) -> Self
Create a matrix operation error.
Sourcepub fn optimization<S: Into<String>>(reason: S) -> Self
Available on crate feature estimation only.
pub fn optimization<S: Into<String>>(reason: S) -> Self
estimation only.Create an optimization error.
Sourcepub fn statistical<S: Into<String>>(message: S) -> Self
pub fn statistical<S: Into<String>>(message: S) -> Self
Create a statistical error with a custom message.
Sourcepub fn data_error<S: Into<String>>(message: S) -> Self
pub fn data_error<S: Into<String>>(message: S) -> Self
Create a data validation error.
Sourcepub fn not_implemented<S: Into<String>>(feature: S) -> Self
pub fn not_implemented<S: Into<String>>(feature: S) -> Self
Create a not implemented error.
Sourcepub fn computation<S: Into<String>>(message: S) -> Self
pub fn computation<S: Into<String>>(message: S) -> Self
Create a generic computation error.
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Check if the error is recoverable.
Some errors (like numerical instability) might be recoverable by adjusting parameters or using different algorithms, while others (like invalid parameters) are not.
Trait Implementations§
Source§impl Debug for CopulaError
impl Debug for CopulaError
Source§impl Display for CopulaError
impl Display for CopulaError
Source§impl Error for CopulaError
impl Error for CopulaError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for CopulaError
impl RefUnwindSafe for CopulaError
impl Send for CopulaError
impl Sync for CopulaError
impl Unpin for CopulaError
impl UnsafeUnpin for CopulaError
impl UnwindSafe for CopulaError
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
impl<T> SendAlias for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.