Skip to main content

SparseLu

Struct SparseLu 

Source
pub struct SparseLu { /* private fields */ }
Expand description

A sparse LU factorisation P A Q = L U (SciPy’s splu, with its own algorithm).

Implementations§

Source§

impl SparseLu

Source

pub fn factor(a: &CsrMatrix, ordering: Ordering) -> Result<SparseLu>

Factorises a square sparse matrix column by column (left-looking): each column of A Q is solved against the columns of L found so far, visiting only the rows its pattern can reach in the graph of L (found by a depth-first search, which also gives a valid order), and the largest remaining entry becomes the pivot.

Source

pub fn factor_with_order(a: &CsrMatrix, q: &[usize]) -> Result<SparseLu>

As SparseLu::factor, with the column order given explicitly: q[k] is the original column eliminated at step k. This takes the orderings that are separate functions, colamd and nested_dissection, or any other permutation.

Source

pub fn refactor(&self, a: &CsrMatrix) -> Result<SparseLu>

The factorisation of a matrix a with the same sparsity pattern as the one factored to make self but new values (the Newton matrices of an ODE solver, the Jacobians of a nonlinear solve), keeping the column order, the pivot rows and the structure of L and U: no search for the reach of each column, only the numerical updates. Where a pivot is smaller than a tenth of the largest candidate in its column (the pivot sequence is no longer a good one), or an update would land outside the stored structure, the result is LinalgError::Singular and the caller factors from scratch with SparseLu::factor_with_order.

Source

pub fn solve(&self, b: &[f64]) -> Result<Vec<f64>>

Solves A x = b.

Source

pub fn flops(&self) -> f64

The floating-point operations of the factorisation: for each pivot, one division per entry below it and a multiply and an add per entry of its rank-one update, so ℓₖ + 2 ℓₖ uₖ with ℓₖ the entries of L below the pivot and uₖ those of U to its right. A measure of the cost an ordering leads to, independent of the machine.

Source

pub fn nnz(&self) -> usize

The number of stored entries of L and U together (the fill).

Trait Implementations§

Source§

impl Clone for SparseLu

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 SparseLu

Source§

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

Formats the value using the given formatter. Read more

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.