Skip to main content

LdltError

Enum LdltError 

Source
pub enum LdltError {
    ZeroPivot(usize),
    NearZeroPivot {
        column: usize,
        pivot: f64,
        scale: f64,
        suggested_shift: f64,
    },
    InvalidInput(&'static str),
    SizeMismatch {
        expected: usize,
        got: usize,
    },
}
Expand description

Failure modes of the factorization and solves.

Eq is deliberately not derived: LdltError::NearZeroPivot carries f64 payloads.

Variants§

§

ZeroPivot(usize)

A zero pivot (D[k] == 0) was hit at this column: the matrix is singular or the un-pivoted factorization broke down there.

§

NearZeroPivot

A pivot that is not exactly zero but has lost every significant digit to cancellation: |D[k]| < NEAR_ZERO_PIVOT_REL * scale.

This is the honest report of the case that used to be returned silently, and it matters because the sign pattern of D is the matrix inertia (Sylvester’s law). A pivot at this magnitude still has a sign, but that sign is rounding noise, so the inertia read from the factorization would be noise too - and downstream that inertia is a Sturm eigenvalue count, i.e. an eigenvalue or buckling load. Returning it is strictly better than returning a number nobody can tell is wrong.

Recover by moving off the near-singular point: either shift the matrix yourself, or call SparseLdlt::factor_shifted, which does exactly that and reports the shift it used through SparseLdlt::shift.

Fields

§column: usize

The column at which the pivot collapsed.

§pivot: f64

The computed pivot value. Its sign is not trustworthy at this magnitude.

§scale: f64

The largest absolute diagonal entry of the input matrix - the reference the tolerance is relative to.

§suggested_shift: f64

A diagonal shift large enough to clear the breakdown: sqrt( NEAR_ZERO_PIVOT_REL ) * scale, i.e. comfortably outside the tolerance band rather than on its edge. Factoring A + suggested_shift * I is an exact factorization of a NEARBY matrix, not of A.

§

InvalidInput(&'static str)

The CSC arrays were inconsistent (bad length, col_ptr not monotonic, an index out of range, or a non-finite value).

§

SizeMismatch

A right-hand side (or multi-RHS row) did not match the factored matrix’s order.

Fields

§expected: usize

The order of the factored matrix.

§got: usize

The length that was supplied.

Trait Implementations§

Source§

impl Clone for LdltError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for LdltError

Source§

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

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

impl PartialEq for LdltError

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LdltError

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.