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§
Sourcefn factorize<C: ColumnSource<T>>(&mut self, cols: &C) -> Result<(), LuError>
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.
Sourcefn refactorize_same_pattern<C: ColumnSource<T>>(
&mut self,
cols: &C,
) -> Result<(), LuError>
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.
Sourcefn symbolic(&self) -> Option<&SymbolicLu>
fn symbolic(&self) -> Option<&SymbolicLu>
The pivot sequence of the last successful factorization, if any.
Sourcefn ftran(&mut self, v: &mut SparseVec<T>)
fn ftran(&mut self, v: &mut SparseVec<T>)
v ← B⁻¹ v: row-indexed in, position-indexed out (D-0016).
Sourcefn ftran_for_update(&mut self, v: &mut SparseVec<T>)
fn ftran_for_update(&mut self, v: &mut SparseVec<T>)
LuFactor::ftran that also records the spike for the next
LuFactor::update.
Sourcefn update(&mut self, r: usize, alpha_r: T) -> Result<UpdateOutcome, LuError>
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.
Sourcefn is_valid(&self) -> bool
fn is_valid(&self) -> bool
true iff the factor holds a valid factorization (the last
factorize succeeded).
Sourcefn update_stats(&self) -> &UpdateStats
fn update_stats(&self) -> &UpdateStats
Statistics of the update policy since the last factorization.
Sourcefn set_options(&mut self, opts: LuOptions)
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).
Sourcefn check_invariants(&self) -> Result<(), SparseError>
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".