#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum CalcError {
DerivativeOrderZero,
DerivativeOrderUnsupported,
StepSizeZero,
IndexOutOfRange,
IterationsZero,
IntegrationLimitsIllDefined,
QuadratureOrderOutOfRange,
EmptyFunctionSet,
Underdetermined,
SingularMatrix,
NotPositiveDefinite,
DidNotConverge,
NonFiniteValue,
InvalidBracket,
}
impl core::fmt::Display for CalcError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_str(match self {
CalcError::DerivativeOrderZero => "derivative order cannot be zero",
CalcError::DerivativeOrderUnsupported => "derivative order is not supported",
CalcError::StepSizeZero => "step size cannot be zero",
CalcError::IndexOutOfRange => "variable index out of range",
CalcError::IterationsZero => "number of iterations cannot be zero",
CalcError::IntegrationLimitsIllDefined => {
"lower limit must be strictly less than upper limit"
}
CalcError::QuadratureOrderOutOfRange => "quadrature order is out of supported range",
CalcError::EmptyFunctionSet => "function set cannot be empty",
CalcError::Underdetermined => "system is underdetermined (M < N)",
CalcError::SingularMatrix => "matrix is singular or rank-deficient",
CalcError::NotPositiveDefinite => "matrix is not positive definite",
CalcError::DidNotConverge => {
"solver did not converge within the iteration/evaluation budget"
}
CalcError::NonFiniteValue => "residual or Jacobian contained a non-finite value",
CalcError::InvalidBracket => "bracket endpoints must enclose a sign change",
})
}
}
impl core::error::Error for CalcError {}