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
impl SparseLu
Sourcepub fn factor(a: &CsrMatrix, ordering: Ordering) -> Result<SparseLu>
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.
Sourcepub fn factor_with_order(a: &CsrMatrix, q: &[usize]) -> Result<SparseLu>
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.
Sourcepub fn refactor(&self, a: &CsrMatrix) -> Result<SparseLu>
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.
Sourcepub fn flops(&self) -> f64
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.