pub struct FaerLdl {
pub supernodal: Option<bool>,
}Expand description
The v0.1 backend (D10, hybrid): faer’s sparse LDLᵀ (normal
equations, quasi-definite augmented systems) or intranodal LBLᵀ with
Bunch–Kaufman pivots (unregularized augmented systems), with faer’s
simplicial/supernodal selection, ordered by our ordering through
KktSolver::analyze. Regularization policy and refinement are the
trait’s (Chapter 5.14).
Normal equations A D Aᵀ + δI, analyzed once and factorized for two
diagonals D (the pattern does not change between interior-point
iterations):
use xingo_sparse::{Amd, Col, CscMatrix, FaerLdl, KktForm, KktSolver, Refinement, Regularization, Row};
// A = [1 1 0; 0 1 1]; lower triangle of A D Aᵀ.
let normal = |d: [f64; 3]| {
CscMatrix::from_triplets(2, 2, &[
(Row(0), Col(0), d[0] + d[1]), (Row(1), Col(0), d[1]), (Row(1), Col(1), d[1] + d[2]),
])
.unwrap()
};
let solver = FaerLdl::default();
let form = KktForm::NormalEquations;
let sym = solver.analyze(&normal([1.0; 3]).pattern(), form, &Amd::default()).unwrap();
for d in [[1.0, 2.0, 3.0], [1e-6, 1e4, 1e-3]] {
let k = normal(d);
// δ is taken in the equilibrated matrix (the default).
let (num, inertia) = solver.factorize(&sym, &k, Regularization::default()).unwrap();
assert_eq!(inertia.positive, 2);
let (b, mut x) = ([1.0, -1.0], [0.0; 2]);
// Refining against k itself removes the bias of the shift δ, down to
// the rounding floor ε‖K‖‖x‖ of the computed residual (≈ 10⁻⁸ for
// the second D, whose K has condition ≈ 10⁷).
let report = solver.solve_refined(&num, &k, &b, &mut x, Refinement::default());
assert!(report.residual <= 1e-8);
}Fields§
§supernodal: Option<bool>Force the supernodal path (Some(true)), the simplicial one
(Some(false)), or let faer choose by flops per nnz(L)
(None).
Trait Implementations§
impl Copy for FaerLdl
impl Eq for FaerLdl
Source§impl KktSolver<f64> for FaerLdl
impl KktSolver<f64> for FaerLdl
Source§type Symbolic = FaerSymbolic
type Symbolic = FaerSymbolic
The result of the symbolic phase.
Source§type Numeric = FaerNumeric<f64>
type Numeric = FaerNumeric<f64>
The result of the numeric phase.
Source§fn analyze(
&self,
pattern: &Pattern,
form: KktForm,
ordering: &dyn Ordering,
) -> Result<FaerSymbolic, KktError>
fn analyze( &self, pattern: &Pattern, form: KktForm, ordering: &dyn Ordering, ) -> Result<FaerSymbolic, KktError>
Symbolic phase on the lower triangle of
pattern (plus a full
diagonal) with the given ordering; done once per pattern.Source§fn factorize(
&self,
symbolic: &FaerSymbolic,
k: &CscMatrix<f64>,
reg: Regularization<f64>,
) -> Result<(FaerNumeric<f64>, Inertia), KktError>
fn factorize( &self, symbolic: &FaerSymbolic, k: &CscMatrix<f64>, reg: Regularization<f64>, ) -> Result<(FaerNumeric<f64>, Inertia), KktError>
Numeric phase on the lower triangle of
k (inside the analyzed
pattern) with regularization (Algorithm K); returns the factor and
its inertia (S6).Source§fn nnz_factor(&self, numeric: &FaerNumeric<f64>) -> usize
fn nnz_factor(&self, numeric: &FaerNumeric<f64>) -> usize
Nonzeros of the factor (for the IPM log).
Source§fn solve_refined(
&self,
numeric: &Self::Numeric,
k: &CscMatrix<T>,
b: &[T],
x: &mut [T],
refinement: Refinement<T>,
) -> RefineReport<T>
fn solve_refined( &self, numeric: &Self::Numeric, k: &CscMatrix<T>, b: &[T], x: &mut [T], refinement: Refinement<T>, ) -> RefineReport<T>
Solve followed by iterative refinement against
k (Algorithm F);
keeps the best iterate (S7). k is the matrix to be solved — the
unregularized one the factor approximates, or any other with the
same order; only its lower triangle is read. x is overwritten.
Allocates its work vectors; KktSolver::solve_refined_with
reuses them. Read moreSource§fn solve_refined_with(
&self,
numeric: &Self::Numeric,
k: &CscMatrix<T>,
b: &[T],
x: &mut [T],
refinement: Refinement<T>,
work: &mut RefineWorkspace<T>,
) -> RefineReport<T>
fn solve_refined_with( &self, numeric: &Self::Numeric, k: &CscMatrix<T>, b: &[T], x: &mut [T], refinement: Refinement<T>, work: &mut RefineWorkspace<T>, ) -> RefineReport<T>
KktSolver::solve_refined with caller-owned work vectors: once
work has served a call with the same order and budget, the
refinement allocates nothing. Read moreimpl StructuralPartialEq for FaerLdl
Auto Trait Implementations§
impl Freeze for FaerLdl
impl RefUnwindSafe for FaerLdl
impl Send for FaerLdl
impl Sync for FaerLdl
impl Unpin for FaerLdl
impl UnsafeUnpin for FaerLdl
impl UnwindSafe for FaerLdl
Blanket Implementations§
impl<T> Boilerplate for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more