pub struct Factorization { /* private fields */ }Expand description
Value-typed handle holding a sparse symmetric factorization.
Construction (via Factorization::new) performs the symbolic +
numeric factor; subsequent Factorization::solve calls are pure
back-substitution. Factorization::refactor replaces the numeric
values without redoing the symbolic work.
The matrix is supplied in triplet (COO) format with 1-based
indices over the lower triangle — the universal denominator the
trait expects. Backends that prefer CSR are fed via the standard
TripletToCsrConverter inside the wrapper.
Implementations§
Source§impl Factorization
impl Factorization
Sourcepub fn new(
dim: Index,
airn: Vec<Index>,
ajcn: Vec<Index>,
values: Vec<Number>,
backend: Box<dyn SparseSymLinearSolverInterface>,
) -> Result<Self, FactorizationError>
pub fn new( dim: Index, airn: Vec<Index>, ajcn: Vec<Index>, values: Vec<Number>, backend: Box<dyn SparseSymLinearSolverInterface>, ) -> Result<Self, FactorizationError>
Factor a new matrix. Pattern (airn, ajcn) and values are
the lower-triangle triplet of A, 1-based indices, length
nnz each. backend is any implementor (feral, MA57, …).
Performs both the symbolic and numeric factorization. Subsequent
Self::solve calls are back-substitution only;
Self::refactor redoes the numeric work but reuses the
symbolic factor.
§Errors
FactorizationError::Singular— the supplied matrix is numerically singular.FactorizationError::FatalError— unrecoverable backend error.
§Panics
Panics if airn.len() != ajcn.len() or if values.len() != airn.len().
Sourcepub fn solve(
&mut self,
rhs: &mut [Number],
nrhs: usize,
) -> Result<(), FactorizationError>
pub fn solve( &mut self, rhs: &mut [Number], nrhs: usize, ) -> Result<(), FactorizationError>
Back-substitute against the cached factor. rhs packs nrhs
columns (each length dim) in column-major layout; solutions
overwrite rhs in place.
§Errors
FactorizationError::FatalError — backend solve failed.
§Panics
Panics if rhs.len() != dim * nrhs.
Sourcepub fn solve_one(
&mut self,
rhs: &mut [Number],
) -> Result<(), FactorizationError>
pub fn solve_one( &mut self, rhs: &mut [Number], ) -> Result<(), FactorizationError>
Convenience for the common nrhs=1 case. Identical to
solve(rhs, 1).
Sourcepub fn number_of_neg_evals(&self) -> Option<Index>
pub fn number_of_neg_evals(&self) -> Option<Index>
Number of negative eigenvalues from the most recent factor, if
the backend reports inertia. None otherwise.