Skip to main content

LaError

Enum LaError 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Singular

The matrix is (numerically) singular.

Fields

§pivot_col: usize

The factorization column/step where a suitable pivot/diagonal could not be found.

§

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 by Matrix::det, Lu::factor, Ldlt::factor, and the solve_vec paths when they detect a corrupt stored factor (only reachable via direct struct construction; factor itself rejects such inputs).
  • row: None, col: c — the non-finite value is either a vector input entry at index c, or a computed intermediate at step c (e.g. an accumulator that overflowed during forward/back substitution).

Fields

§row: Option<usize>

Row of the non-finite entry for a stored matrix cell, or None for a vector-input entry or a computed intermediate. See the variant docs for the full convention.

§col: usize

Column index (stored cell), vector index, or factorization/solve step where the non-finite value was detected.

§

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.

Fields

§index: Option<usize>

For vector results (e.g. solve_exact_f64), the index of the component that overflowed. None for scalar results.

Implementations§

Source§

impl LaError

Source

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.

Source

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 Clone for LaError

Source§

fn clone(&self) -> LaError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LaError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for LaError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for LaError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for LaError

Source§

fn eq(&self, other: &LaError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for LaError

Source§

impl Eq for LaError

Source§

impl StructuralPartialEq for LaError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.