use std::fmt; use std::sync::Arc; #[derive(Debug)] pub enum LlsError { SingularMatrix, } impl std::error::Error for LlsError {} #[derive(Debug, Clone, PartialEq, Eq)] pub enum InversionError { SingularMatrix, EmptyMatrix, } impl fmt::Display for LlsError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { LlsError::SingularMatrix => write!(f, "Matrix is singular and cannot be inverted."), } } } impl fmt::Display for InversionError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { InversionError::SingularMatrix => { write!(f, "Matrix is singular and cannot be inverted.") } InversionError::EmptyMatrix => write!(f, "Matrix is empty and cannot be inverted."), } } } impl std::error::Error for InversionError {}