differential_equations/linalg/
error.rs1#[derive(Debug, Clone, PartialEq)]
5pub enum LinalgError {
6 BadInput { message: String },
8 Singular { step: usize },
10 PivotSizeMismatch { expected: usize, actual: usize },
12}
13
14impl std::fmt::Display for LinalgError {
15 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16 match self {
17 LinalgError::BadInput { message } => {
18 write!(f, "Linear algebra input error: {}", message)
19 }
20 LinalgError::Singular { step } => write!(f, "Matrix is singular at step {}", step),
21 LinalgError::PivotSizeMismatch { expected, actual } => {
22 write!(
23 f,
24 "Pivot vector size mismatch: expected {}, got {}",
25 expected, actual
26 )
27 }
28 }
29 }
30}
31
32impl std::error::Error for LinalgError {}