#[derive(Debug, thiserror::Error)]
pub enum SolverError {
#[error("matrix must be square: got {rows}x{cols}")]
NotSquare {
rows: usize,
cols: usize,
},
#[error("singular matrix: zero pivot at position {0}")]
SingularMatrix(usize),
#[error("matrix is not positive definite: non-positive diagonal at position {0}")]
NotPositiveDefinite(usize),
#[error("dimension mismatch: matrix is {matrix_n}x{matrix_n}, rhs has {rhs_len} elements")]
DimensionMismatch {
matrix_n: usize,
rhs_len: usize,
},
#[error("SVD: matrix is {m}x{n}, but output buffers have wrong dimensions")]
SvdDimensionMismatch {
m: usize,
n: usize,
},
#[error("QR: matrix is {m}x{n} (requires m >= n)")]
QrNotTallSkinny {
m: usize,
n: usize,
},
#[error("invalid input: {reason}")]
InvalidInput {
reason: &'static str,
},
#[error("buffer length {got} does not match expected {expected} for {rows}x{cols} matrix")]
BufferLengthMismatch {
expected: usize,
got: usize,
rows: usize,
cols: usize,
},
}