#[non_exhaustive]pub enum LaError {
Singular {
pivot_col: usize,
},
NonFinite {
row: Option<usize>,
col: usize,
},
Overflow {
index: Option<usize>,
},
}Expand description
Linear algebra errors.
This enum is #[non_exhaustive] — downstream match arms must include a
wildcard (_) pattern to compile, allowing new variants to be added in
future minor releases without breaking existing code.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Singular
The matrix is (numerically) singular.
Fields
NonFinite
A non-finite value (NaN/∞) was encountered.
The (row, col) coordinate follows a consistent convention across the crate:
row: Some(r), col: c— a stored matrix cell at(r, c)is non-finite. Used byMatrix::det,Lu::factor,Ldlt::factor, and thesolve_vecpaths when they detect a corrupt stored factor (only reachable via direct struct construction;factoritself rejects such inputs).row: None, col: c— the non-finite value is either a vector input entry at indexc, or a computed intermediate at stepc(e.g. an accumulator that overflowed during forward/back substitution).
Fields
Overflow
The exact result overflows the target representation (e.g. f64).
Returned by Matrix::det_exact_f64 and Matrix::solve_exact_f64
(requires exact feature) when an exact value is too large to
represent as a finite f64.
Implementations§
Source§impl LaError
impl LaError
Sourcepub const fn non_finite_cell(row: usize, col: usize) -> Self
pub const fn non_finite_cell(row: usize, col: usize) -> Self
Construct a LaError::NonFinite pinpointing a stored matrix cell at (row, col).
Use this for non-finite values read from a stored Matrix entry or
factorization cell. The resulting error has row: Some(row), col,
matching the stored-cell convention documented on
NonFinite. For vector-input entries or computed
intermediates, use non_finite_at.
Sourcepub const fn non_finite_at(col: usize) -> Self
pub const fn non_finite_at(col: usize) -> Self
Construct a LaError::NonFinite pinpointing a vector-input entry or
computed-intermediate step at index col.
Use this for non-finite values in a Vector input or an accumulator
that overflowed during forward/back substitution. The resulting error
has row: None, col, matching the vector/intermediate convention
documented on NonFinite. For stored matrix cells,
use non_finite_cell.
Trait Implementations§
Source§impl Error for LaError
impl Error for LaError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()