Skip to main content

FaerLdl

Struct FaerLdl 

Source
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§

Source§

impl Clone for FaerLdl

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 Copy for FaerLdl

Source§

impl Debug for FaerLdl

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for FaerLdl

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for FaerLdl

Source§

impl KktSolver<f64> for FaerLdl

Source§

type Symbolic = FaerSymbolic

The result of the symbolic phase.
Source§

type Numeric = FaerNumeric<f64>

The result of the numeric phase.
Source§

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>

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 solve(&self, numeric: &FaerNumeric<f64>, x: &mut [f64])

x ← F⁻¹ x in place, dense, with F the regularized factor. Read more
Source§

fn nnz_factor(&self, numeric: &FaerNumeric<f64>) -> usize

Nonzeros of the factor (for the IPM log).
Source§

fn name(&self) -> &'static str

A short name for logs and tables.
Source§

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 more
Source§

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 more
Source§

impl PartialEq for FaerLdl

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FaerLdl

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
§

impl<T> Boilerplate for T
where T: Copy + Send + Sync + Debug + PartialEq + 'static,

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
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

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.

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

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.