#[derive(Debug, Clone, PartialEq)]
pub enum LinalgError {
BadInput { message: String },
Singular { step: usize },
PivotSizeMismatch { expected: usize, actual: usize },
}
impl std::fmt::Display for LinalgError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
LinalgError::BadInput { message } => {
write!(f, "Linear algebra input error: {}", message)
}
LinalgError::Singular { step } => write!(f, "Matrix is singular at step {}", step),
LinalgError::PivotSizeMismatch { expected, actual } => {
write!(
f,
"Pivot vector size mismatch: expected {}, got {}",
expected, actual
)
}
}
}
}
impl std::error::Error for LinalgError {}