Skip to main content

CopulaError

Enum CopulaError 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

§message: String

Description of what makes the parameter invalid

§suggestion: Option<String>

Optional suggestion for fixing the issue

§

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

§expected: usize

Expected dimension

§actual: usize

Actual dimension provided

§context: Option<String>

Optional context about where the mismatch occurred

§

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.

Fields

§values: Vec<f64>

The problematic values

§

NumericalError

Numerical computation error.

This occurs when numerical methods fail due to numerical instability, convergence issues, or other computational problems.

Fields

§message: String

Description of the numerical issue

§

MatrixError

Matrix operation failed.

This occurs when matrix operations like inversion or decomposition fail, typically due to singular or ill-conditioned matrices.

Fields

§operation: String

The operation that failed

§reason: String

Reason for failure

§

OptimizationError

Available on crate feature 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.

Fields

§reason: String

Reason for optimization failure

§

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.

Fields

§message: String

Description of the statistical issue

§

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.

Fields

§message: String

Description of the data issue

§

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.

Fields

§feature: String

The feature that is not implemented

§

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.

Fields

§message: String

Description of the computation error

§

SerializationError

Available on crate feature serde only.

Serialization or deserialization error.

This occurs when converting copulas to/from serialized formats.

Fields

§message: String

Description of the serialization issue

Implementations§

Source§

impl CopulaError

Source

pub fn invalid_parameter<S: Into<String>>(message: S) -> Self

Create an invalid parameter error with a custom message.

Source

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.

Source

pub fn dimension_mismatch(expected: usize, actual: usize) -> Self

Create a dimension mismatch error.

Source

pub fn dimension_mismatch_with_context<S: Into<String>>( expected: usize, actual: usize, context: S, ) -> Self

Create a dimension mismatch error with context.

Source

pub fn invalid_range(values: Vec<f64>) -> Self

Create an invalid range error for values outside [0, 1].

Source

pub fn numerical<S: Into<String>>(message: S) -> Self

Create a numerical error with a custom message.

Source

pub fn matrix_error<S: Into<String>>(operation: S, reason: S) -> Self

Create a matrix operation error.

Source

pub fn optimization<S: Into<String>>(reason: S) -> Self

Available on crate feature estimation only.

Create an optimization error.

Source

pub fn statistical<S: Into<String>>(message: S) -> Self

Create a statistical error with a custom message.

Source

pub fn data_error<S: Into<String>>(message: S) -> Self

Create a data validation error.

Source

pub fn not_implemented<S: Into<String>>(feature: S) -> Self

Create a not implemented error.

Source

pub fn computation<S: Into<String>>(message: S) -> Self

Create a generic computation error.

Source

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.

Source

pub fn category(&self) -> &'static str

Get the error category as a string.

Trait Implementations§

Source§

impl Debug for CopulaError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for CopulaError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Error for CopulaError

1.30.0 · Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SendAlias for T

Source§

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

Source§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

fn from_subset(element: &SS) -> SP

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

impl<T> SyncAlias for T

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.