Skip to main content

LuFactor

Trait LuFactor 

Source
pub trait LuFactor<T: Real> {
Show 14 methods // Required methods fn factorize<C: ColumnSource<T>>(&mut self, cols: &C) -> Result<(), LuError>; fn refactorize_same_pattern<C: ColumnSource<T>>( &mut self, cols: &C, ) -> Result<(), LuError>; fn symbolic(&self) -> Option<&SymbolicLu>; fn ftran(&mut self, v: &mut SparseVec<T>); fn btran(&mut self, v: &mut SparseVec<T>); fn ftran_for_update(&mut self, v: &mut SparseVec<T>); fn update(&mut self, r: usize, alpha_r: T) -> Result<UpdateOutcome, LuError>; fn m(&self) -> usize; fn is_valid(&self) -> bool; fn stats(&self) -> &LuStats; fn update_stats(&self) -> &UpdateStats; fn options(&self) -> &LuOptions; fn set_options(&mut self, opts: LuOptions); fn check_invariants(&self) -> Result<(), SparseError>;
}
Expand description

What every LU of the crate exposes; the simplex method programs against this trait (the contract’s LuFactor<T>).

Required Methods§

Source

fn factorize<C: ColumnSource<T>>(&mut self, cols: &C) -> Result<(), LuError>

Algorithm L: factorizes the m × m basis B whose columns the source gives.

On success the factor represents B and all previous updates are discarded. On LuError::Singular the factor is invalid until the next successful call; the error names the dependent positions and the rows without pivot, so the caller can substitute logicals and retry. On LuError::Structure (invariant (B1) violated) nothing was factorized.

Source

fn refactorize_same_pattern<C: ColumnSource<T>>( &mut self, cols: &C, ) -> Result<(), LuError>

Algorithm R (Chapter 5.12): factorizes the m × m basis B with the pivot sequence of the last successful factorization — no search, no count lists — as long as every pivot passes the threshold test; otherwise (or without a sequence of order m) it falls back to LuFactor::factorize. Meant for new values on the same pattern; the outcome and the errors are those of factorize, and LuStats::symbolic_reuses / LuStats::symbolic_fallbacks say which path ran.

Source

fn symbolic(&self) -> Option<&SymbolicLu>

The pivot sequence of the last successful factorization, if any.

Source

fn ftran(&mut self, v: &mut SparseVec<T>)

v ← B⁻¹ v: row-indexed in, position-indexed out (D-0016).

Source

fn btran(&mut self, v: &mut SparseVec<T>)

v ← B⁻ᵀ v: position-indexed in, row-indexed out.

Source

fn ftran_for_update(&mut self, v: &mut SparseVec<T>)

LuFactor::ftran that also records the spike for the next LuFactor::update.

Source

fn update(&mut self, r: usize, alpha_r: T) -> Result<UpdateOutcome, LuError>

Replaces the column at position r; alpha_r is entry r of the α_q returned by the last ftran_for_update. The factor never refactorizes on its own.

Source

fn m(&self) -> usize

Dimension m of the last basis given to factorize.

Source

fn is_valid(&self) -> bool

true iff the factor holds a valid factorization (the last factorize succeeded).

Source

fn stats(&self) -> &LuStats

Statistics of the current factor.

Source

fn update_stats(&self) -> &UpdateStats

Statistics of the update policy since the last factorization.

Source

fn options(&self) -> &LuOptions

The options in force.

Source

fn set_options(&mut self, opts: LuOptions)

Replaces the options. The factorization reads them at the next factorize, the solves and the update at their next call (e.g. a tighter LuOptions::rel_pivot_tol after numerical trouble, PLAN.md §8).

Source

fn check_invariants(&self) -> Result<(), SparseError>

Checks invariants (F1)–(F3) of a valid factor (and of its updates).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Real, U: BasisUpdate<T>> LuFactor<T> for Lu<T, U>