pub enum MathError {
DimensionMismatch {
expected: usize,
got: usize,
},
EmptyInput {
context: String,
},
NumericalInstability {
message: String,
},
ConvergenceFailure {
iterations: usize,
residual: f64,
},
InvalidParameter {
name: String,
reason: String,
},
NotOnManifold {
message: String,
},
SingularMatrix {
context: String,
},
CurvatureViolation {
message: String,
},
}Expand description
Errors that can occur in mathematical operations
Variants§
DimensionMismatch
Dimension mismatch between inputs
EmptyInput
Empty input where non-empty was required
NumericalInstability
Numerical instability detected
ConvergenceFailure
Convergence failure in iterative algorithm
InvalidParameter
Invalid parameter value
NotOnManifold
Point not on manifold
SingularMatrix
Singular matrix encountered
CurvatureViolation
Curvature constraint violated
Implementations§
Source§impl MathError
impl MathError
Sourcepub fn dimension_mismatch(expected: usize, got: usize) -> Self
pub fn dimension_mismatch(expected: usize, got: usize) -> Self
Create a dimension mismatch error
Sourcepub fn empty_input(context: impl Into<String>) -> Self
pub fn empty_input(context: impl Into<String>) -> Self
Create an empty input error
Sourcepub fn numerical_instability(message: impl Into<String>) -> Self
pub fn numerical_instability(message: impl Into<String>) -> Self
Create a numerical instability error
Sourcepub fn convergence_failure(iterations: usize, residual: f64) -> Self
pub fn convergence_failure(iterations: usize, residual: f64) -> Self
Create a convergence failure error
Sourcepub fn invalid_parameter(
name: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn invalid_parameter( name: impl Into<String>, reason: impl Into<String>, ) -> Self
Create an invalid parameter error
Sourcepub fn not_on_manifold(message: impl Into<String>) -> Self
pub fn not_on_manifold(message: impl Into<String>) -> Self
Create a not on manifold error
Sourcepub fn singular_matrix(context: impl Into<String>) -> Self
pub fn singular_matrix(context: impl Into<String>) -> Self
Create a singular matrix error
Sourcepub fn curvature_violation(message: impl Into<String>) -> Self
pub fn curvature_violation(message: impl Into<String>) -> Self
Create a curvature violation error
Trait Implementations§
Source§impl Error for MathError
impl Error for MathError
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()
impl StructuralPartialEq for MathError
Auto Trait Implementations§
impl Freeze for MathError
impl RefUnwindSafe for MathError
impl Send for MathError
impl Sync for MathError
impl Unpin for MathError
impl UnwindSafe for MathError
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